Quicksand's Recent Forum Activity

  • I add an event emitter, the user could close with window 'X'

    Oh yeah? Can you explain further?

  • you can test with this plugin nodewebkit extended

    I saw that in the other thread, but I'd prefer to have a solution where the user can close the window with the X like normal.

    Pretty sure it's a file name issue. Renaming the project and deleting, and redoing the sounds fixes mine.

    With that info, perhaps someone could figure out a fix for capx's.

    Something like renaming the folder or something we don't have access to in the editor.

    Does pasting my code into the index.html work for you? If that does work there's probably a way to insert it into the template index.html so it shows up in all exports automatically.

  • Ok I worked on it a little more with the help of a programmer friend and we figured out a better way. Ignore the solution in the first post.

    1. Find your exported project's package.nw file and open it (it can be opened as a zip archive, you can even rename it to a .zip file if you remember to change it back after).

    2. Open up the index.html file inside that archive.

    3. Paste this code right before the last closing </script> tag:

    var win = window['nwgui'].Window.get();

    win.on('close', function () {

    window['nwgui'].App.quit();

    });

    4. Save the new index.html file and the changed package.nw.

    5. Test out your game to see if all processes close fully upon exit.

  • So in the bugs forum many people have been reporting a problem where NW.JS games don't fully close when exiting- they seem to close but processes are left behind, taking up resources. That thread is here:

    So I've been working on a crudely-implemented but seemingly effective solution to this problem. If it works for other people then hopefully someone who actually knows what they're doing can redo my work in a better way. So this isn't really a full fix, but I think its a good start.

    (EDIT- see the next post for an updated solution)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads

    EDIT- Ok I worked on this issue a little more with the help of a programmer friend and we figured out a better possible solution.

    1. Find your exported project's package.nw file and open it (it can be opened as a zip).

    2. Open up the index.html file inside that archive.

    3. Paste this code right before the last closing </script> tag:

    var win = window['nwgui'].Window.get();

    win.on('close', function () {

    window['nwgui'].App.quit();

    });

    4. Save the new index.html file and the changed package.nw.

    5. Test out your game to see if all processes close fully upon exit.

  • >

    > What exactly did you change to get it back working like was used to before?

    >

    >

    This is the code that was already in preview.js:

    // Pause on blur (unfocus)

    if (this.pauseOnBlur && !this.isMobile)

    {

    jQuery(window).focus(function ()

    {

    self["setSuspended"](false);

    });

    jQuery(window).blur(function ()

    {

    self["setSuspended"](true);

    });

    }

    I simply moved it outside of the part that made it only activate when in preview mode.

    But yeah, I'll try to get it working again with the browser plugin instead.

    Is the nwjs team even aware of the problem yet?

    I don't think so. We could report the issue here:

    https://github.com/nwjs/nw.js/issues

    But if the gui.App.quit(); command works properly, which it seems to, then it seems this would be something to fix in Construct rather than in NW.JS.

  • >

    > > It's designed to stop the game running while you go back to edit it further in Construct 2. Why would you want that after publishing?

    > >

    >

    > Because people tend to multi-task on computers and so its nice to have the game automatically pause events and especially sound when one clicks on a different window.

    >

    > Thanks for the info.

    >

    What about timescaling?

    Check if the game is out of focus, when it is just set it to 0.

    The browser plugin has all the conditions you need for that.

    I tried that but it doesn't seem to work when NW.JS is used as the ersatz browser. Unless I just had it set up wrong.

    Anyway modifying the runtime code myself worked, its just not the most convenient way of going about this.

  • According to the store page "Once you make more than $5,000 USD revenue (or equivalent) from your creations you must upgrade to Business Edition."

  • It's designed to stop the game running while you go back to edit it further in Construct 2. Why would you want that after publishing?

    Because people tend to multi-task on computers and so its nice to have the game automatically pause events and especially sound when one clicks on a different window.

    Thanks for the info.

  • Ashley could you explain why the feature was restricted? I'll be releasing my game soon and I don't want to keep that in if it causes known issues.

    doable... but I prefer hide windows frame in order to avoid user to close the app by clicking on window's X

    That's the solution I'm using for my game for now. And I've managed to get it so that you can drag the window by its border while still being able to click within the window normally, without dragging it. Now the only worry is if someone right clicks on the game in the taskbar and closes it that way (I have a message telling the player not to, but that's not ideal).

Quicksand's avatar

Quicksand

Member since 11 Apr, 2014

None one is following Quicksand yet!

Connect with Quicksand

Trophy Case

  • 10-Year Club

Progress

10/44
How to earn trophies