Preview in node webkit?

Discussion and feedback on Construct 2

Post » Wed Jul 03, 2013 4:17 am

I know this has been brought up before, but now that we have file operations in the node webkit plugin, it's more relevant now. For those of us wanting to make a game that uses node WebKit's file io, it's very inconvenient to have to export every time we want to preview. I thought I had an idea how to work around the problem, by exporting a node webkit 'game' that was set to do one thing, go to the preview URL on the start of layout.

At first, I thought that worked great - previewing that way in node webkit works just like chrome, when pressing preview in c2 updates the node webkit window. But then I realized that the node webkit code wasn't working - it wasn't reading or writing files to disk. I looked at the preview source and it seems like the node webkit plugin is a disabled in preview.

Is there anything that could be done about this? Perhaps something simple like adding node webkit to the list of browsers to preview with? Or a way to make the method I described above work? It would make things much, much easier to be able to preview with one click rather than have to export every time we want to test our code.Arima2013-07-03 04:19:02
Moderator
B
91
S
32
G
33
Posts: 3,005
Reputation: 27,552

Post » Wed Jul 03, 2013 4:34 am

That would be very helpful to be able to preview in node webkit
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
76
S
20
G
19
Posts: 1,931
Reputation: 17,159

Post » Wed Jul 03, 2013 4:41 am

Literally... what if C++ developers have to compile and test, then re-compile and test again?
B
91
S
31
G
29
Posts: 3,129
Reputation: 27,789

Post » Wed Jul 03, 2013 1:18 pm

I looked in to this, and node-webkit's user-agent string by default looks exactly the same as Chrome's, and I didn't want to add detection based on a common global variable name ("require"). So for the next build I've made a change where you can just add "nw" to the query string, and it forces it to detect as node-webkit. i.e. just visit http://localhost:50000/?nw instead and it should enable all node-webkit features. (Obviously don't do this from a browser, since it will just throw javascript errors when it hits the node-webkit specific code.)
Scirra Founder
B
378
S
220
G
84
Posts: 23,863
Reputation: 188,019

Post » Wed Jul 03, 2013 2:39 pm

thanks for this :)
can't wait for next stable release to try all the new featuresDrGreenThumbCAN2013-07-03 14:39:36
B
40
S
12
G
6
Posts: 136
Reputation: 6,347

Post » Wed Jul 03, 2013 7:18 pm

Nice, thanks Ashley!
Moderator
B
91
S
32
G
33
Posts: 3,005
Reputation: 27,552

Post » Thu Jul 04, 2013 6:00 am

This might sound silly, but how do you actually test node in preview now with the new beta version?

I learned quickly that attempting from the browser was a no no. I also downloaded node-webkit itself, but I guess I am using it just like a browser and get the same javascript error.

So how does someone actually go about testing their game without having to export. I searched and was unable to find a tutorial as of yet either.

Also, exporting my game as node does yield the correct results. I do get my text file in the user directory with the correct content in it. But I do not know how to actually make this happen with preview.

Thank youTwinsonian2013-07-04 06:07:07
B
8
S
1
Posts: 61
Reputation: 1,210

Post » Wed Dec 18, 2013 12:13 pm

You can change the preview browser/mode if you click on the project title and then select "Preview Browser" > Node WebkitBl4ckSh33p2013-12-18 12:15:18
B
51
S
15
G
6
Posts: 682
Reputation: 8,911

Post » Wed Dec 18, 2013 2:37 pm

[QUOTE=Bl4ckSh33p] You can change the preview browser/mode if you click on the project title and then select "Preview Browser" > Node Webkit[/QUOTE] Yeah, that feature was added after this thread was created.
B
21
S
8
G
6
Posts: 346
Reputation: 4,891


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 8 guests