The Big NW.js Roundup - News & Tips

7 favourites
From the Asset Store
Jump over the small square and avoid hitting it as long as you can!
  • What I mean is how I can integrate it into a C2 game...

    1) How can I include NPM module in a C2 export?

    2) How can I access methods in NPM module with C2 interface?

    Sorry to say the following but I think that I will not include this in the roundup.

    (It's too much information that I cannot sum up in a short paragraph.)

    However Armaldio, a guy that knows a lot about the java's and the scripts might be able to help you out.

    He's already made and updated a tutorial about it HERE, if you still got questions left feel free to join our discord server and have chat with him about it.

  • Short update:

    • Due to various reasons I decided to switch to Google Drive as my file hoster. (Images should load again now.)

    The following is a message to the guy/girl that decided to maliciously report my helpful tool called "NW.js Secure Assets" and got it blocked:

    Feel free to PM me here or in our C2 Discord server (in which you also participate), so we can talk and get the obvious problems that you have with me cleared up.

    I would also like to ask you not to maliciously report any of my projects in the future, without providing any kind of proof or trying to get in contact with me first.

    For everyone that wants proof that I'm not giving you some sort of "virus" that could harm your computer, HERE is the source code which you can easily convert to a batch file.

    (I've basically done that and compiled it to an executable file to make it more visually appealing.)

    P.s. Thanks to the community member that informed me about the file being blocked, as it seems like the Dropbox team doesn't care enough to at least notify me about it.

  • Awesome thanks!

  • Short update:

    • Removed the "How To: Export To Windows 32bit only" tutorial (+ reason below)

    Why would you remove it, is there something wrong with it?

    No, it worked and still works fine, I just felt like it was a little bit too "hacky" and unreliable.

    I've included a new version (which is not causing any error messages) in THIS old topic of mine.

    Happy holidays everyone!

  • TheRealDannyyy Amazing post. Thank you.

    I have Steam overlay problem for my game exported in NWjs. Maybe you could help me.

    C2 and game configuration:

    • NWjs v0.19.2 (Chromium 55) released 14th December 2016
    • Construct 2 Release r239 (last stable)
    • Game "Fullscreen in browser" property set to "Letterbox Integer scale"
    • Game resolution is 1366x768

    Steps to reproduce:

    1. Launch a game on a Steam (on screen bigger than 1366x768)

    2. Press shift+tab to show overlay

    3. Press shift+tab to hide overlay

    Effect / issue:

    there is still an overlay in the background:

    Game normally has black background like this:

    If I switch to other application (alt+tab) and return to game - the background is black again.

    How to fix this issue with overlay staying in the background of my game?

  • Steam Overlay needs a constant refresh in order to work correctly, black bars from letterbox are not refresh by canvas that's why you have this bug.

  • Thank you for your answer. Is there any way I could avoid this happening?

  • I have Steam overlay problem for my game exported in NWjs. Maybe you could help me. ...

    Thanks for your feedback and also thanks to everyone else that provided feedback previously.

    I see that the flash, I mean MadSpy is already helping you out so I will keep him doing the work for now.

    MadSpy Do you already know a workaround for this one?

    (Would be better if we use Discord for this and only provide the fix here.)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Please consider adding this method of replacing the terrible right-click context menu (when you right-click on textbox and forms) with one that permits Cut / Copy / Paste methods:

    Browser Execute Javascript:

    "var gui = require('nw.gui');
      
      var menu = new gui.Menu;
      
      menu.append(new gui.MenuItem({
        label: 'Cut',
        click: function() {
          document.execCommand('cut');
        }
      }));
      
      menu.append(new gui.MenuItem({
        label: 'Copy',
        click: function() {
          document.execCommand('copy');
        }
      }));
      
      menu.append(new gui.MenuItem({
        label: 'Paste',
        click: function() {
          document.execCommand('paste');
        }
      }));
      
      document.addEventListener('contextmenu', function(e) {
        e.preventDefault();
        if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target.isContentEditable) {
          menu.popup(e.x, e.y);
        }
      });"[/code:1ob7b4x0]
    
    Sourced from [url=https://github.com/b1rdex/nw-contextmenu]here[/url] and works like a champ.
  • TheRealDannyyy , MadSpy any good news?

    Unfortunately there is another issue:

    BitDefender keeps on removing nw.exe from users system. It says it has some PUA's packed into it. I used latest NWjs v0.19.2.

    I used Resource Hacker v.4.2.5 to change icon - maybe this is causing the problem. Did you encountered similar problems?

  • Please consider adding this method of replacing the terrible right-click context menu (when you right-click on textbox and forms) with one that permits Cut / Copy / Paste methods:

    Browser Execute Javascript:

    *Codebox Here*

    Sourced from here and works like a champ.

    Yeah I was thinking about adding that to the roundup, I also have my own method of doing this.

    I'm not a JS expert so I let you be the judge, is my code more effecient or yours?

    The code I use:

    "document.addEventListener('contextmenu', function(e){e.preventDefault();}, false);"[/code:25ltlgy2]
    
    
    

    TheRealDannyyy , MadSpy any good news?

    Unfortunately there is another issue:

    BitDefender keeps on removing nw.exe from users system. It says it has some PUA's packed into it. I used latest NWjs v0.19.2.

    I used Resource Hacker v.4.2.5 to change icon - maybe this is causing the problem. Did you encountered similar problems?

    About the letterboxing thing, Madspy pretty much said that he should be able to provide a fix within his Steam plugin.

    Greenworks users will most-likely have to use the browser action execute JS, in order to fix this on their ends.

    There is currently no ETA, I guess it will be done after the festivities have come to an end.

    Oh BitDefender, the antivirus software with anxiety issues.

    I've had my fair share of experiences with it, not in combination with NW.js but with native software that I've developed.

    I think there is not much that I can do about that, the NW.js team could try to modify their application in order for it to work well with BitDefender but there's a 90% chance that they will tell me to add "nw.exe" to the list of exceptions.

    That's why I will do the same and recommend you to tell those users to take a look at THIS.

    If you're not satisfied with that workaround, feel free to DOWNLOAD and use this software to replace the icon but I highly doubt that ResHack is at fault here.

    Replace icon using Anolis Resorces:

    • Open Resourcer.exe

      [.../bin/Resourcer.exe]

    • Click "Open" and select "nw.exe" (32bit/64bit)
    • Click on "Icon Image" and select the icon that you want to replace
    • Click on "Replace" (should be enabled now)
    • Click on "Browse" and select your new icon (I recommend importing a .png file, this program doesn't seem to like other formats)
    • Click on "Load" and then "OK" if everything is alright
    • Click on "Save" and that's it
  • I'm not a JS expert so I let you be the judge, is my code more effecient or yours?

    The code I use:

    "document.addEventListener('contextmenu', function(e){e.preventDefault();}, false);"[/code:ummrm5zk]
    

    That only works if you don't want to have a Cut / Copy / Paste option by using a right click. Both sets of code are valid with different objectives.

  • That only works if you don't want to have a Cut / Copy / Paste option by using a right click. Both sets of code are valid with different objectives.

    Alrighty, so your code doesn't completly remove right clicking and mine does?

    If that's the case I might consider adding both methods to the roundup soon, also no ETA for this one.

  • Alrighty, so your code doesn't completly remove right clicking and mine does?

    That's correct - it permits right-click cut/copy/paste actions only. All other right-click context menus are prevented.

  • FYI, NW.js 0.19.2 still produce black screen on OBS without '--disable-direct-composition'.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)