[Suggestion] C2 Preview Using Multiple Windows (+Nw.js bug?)

Discussion and feedback on Construct 2

Post » Mon Jul 18, 2016 5:11 pm

Hello there!
I'm currently struggling with a minor previewing issue. I'm working on a multiplayer based game for a while now.
This basically means that I have to open 2 preview windows each time, when I want to test out the new things that I've added.
C2 unfortunately, as far as I know doesn't offer a shortcut icon or specific option to open another preview window, while maintaining the existing one.
However, I've found a workaround by using the browser plugin to open a new localhost window which works on almost all browser except NWjs.

Since I'm aiming to release the game using NW.js as the endproduct, I would also like to be able to preview with the endproduct.
I'm not 100% sure if this is a bug by NWjs or the way that C2 handles previews with NWjs but the bug is basically that the second window opened with the browser plugin, totally bugs out on my end and flickers in black and white all the time. (On start of layout > Open new window [param = "localhost URL"])

To sum it up, an additional icon or shortcut (key + click on preview) to open a new preview window while maintaining the existing one would be amazing!
ImageImageImage
B
63
S
23
G
78
Posts: 664
Reputation: 44,941

Post » Mon Jul 18, 2016 6:33 pm

Using an appropriate trigger event so this won't happen during the final version of the game...

Browser: Execute Javascript:

Code: Select all
"// Load native UI library
var gui = require('nw.gui');

//open a new window to localhost
var win = gui.Window.open ('http://localhost:50000/', {
  position: 'center',
  width: 480,
  height: 270
});"


This is the 'with options' version of the javascript that is detailed here in the nw.js github wiki. Works like a champ - and both windows will close at the same time too. :)
A big fan of JavaScript.
B
76
S
20
G
73
Posts: 2,241
Reputation: 45,956

Post » Tue Jul 19, 2016 1:55 pm

Colludium wrote:Using an appropriate trigger event so this won't happen during the final version of the game...

Browser: Execute Javascript:

Code: Select all
"// Load native UI library
var gui = require('nw.gui');

//open a new window to localhost
var win = gui.Window.open ('http://localhost:50000/', {
  position: 'center',
  width: 480,
  height: 270
});"


This is the 'with options' version of the javascript that is detailed here in the nw.js github wiki. Works like a champ - and both windows will close at the same time too. :)

Not working for me, the 2nd window says: "This site can’t be reached localhost refused to connect."

EDIT: It worked, I just had to change the localhost IP. They don't close at the same time as you said but they work and that is all I asked for, thanks!
ImageImageImage
B
63
S
23
G
78
Posts: 664
Reputation: 44,941


Return to Construct 2 General

Who is online

Users browsing this forum: Cubeeo and 4 guests