Experimental new lightweight Windows wrapper

3 favourites
  • Another thing missing: file.path which exposes the file's real path on filesystem

    I don't know if Node has this function, but electronjs allows you to get the absolute position of a loaded file through a chooser file: https://www.electronjs.org/docs/api/file-object

  • I like the ability to export directly from the editor!

    I noticed that it is very fast and allows you to test a project much faster than "save as html" -> "copy it to a local server" -> "reload the page". Last night it was very helpful: I used export as WebView to check for a problem with an outdated plugin

  • Tried it today for a short while, worked fine, though I found one issue, pressing 'ESC' seems to cancel fullscreen.

  • Gave it a quick try too. Works pretty good, performance is nice, filesize is nice, I hope it will support greenworks in the future :)

  • Gave it a quick try too. Works pretty good, performance is nice, filesize is nice, I hope it will support greenworks in the future :)

    He's already said that Greenworks might be a no go, but the regular sdk might be doable.

    Its definitely something we need though.

  • Even if it doesn't end supporting the same features as NWjs. I still think this would be amazing for the C3 editor itself. I mean it's essentially a Chrome PWA with less or no security prompts.

    Maybe I'll create a launcher or something for it in the future.

  • He's already said that Greenworks might be a no go, but the regular sdk might be doable.

    Oh I kind of read that as "not yet". Uh well, based on what the greenworks plugin does it´s not like it´s missing that much. Achievements and Steam Overlay is like ¯\_(ツ)_/¯ and you won´t have to bloat your 25mb game with 300mb of browser.

  • There's no point using this for the editor - the only reason now that we distribute an NW.js editor is to make it convenient to test when using the NW.js plugin. WebView2 doesn't support the NW.js plugin, so there's no point making an editor wrapper with it. Just use Chrome and install the PWA for an app-like experience.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't know if it's a limitation of WebView, or if it's a bug.

    This is my code

    console.log(`${globalThis.screenX} - ${globalThis.screenY}`);
    

    In this test I want to record the position of the window on the screen. In the preview when I move the window it seems to work:

    But in WebView it doesn't work. Only record the position when starting the layout. Or only when resizing the window.

  • Ashley

    I am experimenting with using multiple windows at the same time for the same game. In my first test I used a local server and WebSock to make the different windows communicate. But I think it might be interesting to get the same result without using external tools.

    WebSockets can be replaced with LocalStorage: all instances of WebView share the same memory (and they always refer to app.localhost/index.html)

    I have two problems left

    1. the ability to launch a new instance of WebView directly from WebView itself. If there will be a specific plugin for WebView I would like an action like "run file" of the NWjs plugin
    1. 2. the possibility of launching WebView with arguments readable by Construct 3

    My idea is a command (PowerShell or command line) like MyProject.exe x=5 y=6

    In C3 I would likethe opportunity to have something similar to:

    const x = runtime.WebView.arguments[0];
    const y = runtime.WebView.arguments[0];
    
    // or 
    const { x, y} = runtime.WebView.arguments;
    
    
    const result = x + y;
    
    runtime.objects.Text.text = result;
    

    This would allow you to open multiple windows at the same time, each on a different layer portion always using the same source file.

    In my experiment I used Deno to launch WebView 4 times, each time from a different folder.

     await Deno.run({ cmd: ["./webview/cameras/A/MultiWindows.exe"] });
     await Deno.run({ cmd: ["./webview/cameras/B/MultiWindows.exe"] });
     await Deno.run({ cmd: ["./webview/cameras/C/MultiWindows.exe"] });
     await Deno.run({ cmd: ["./webview/cameras/D/MultiWindows.exe"] });
    

    It would be nice if it were possible to avoid such code perhaps using an event similar to:

    // pseudocode
    Run File: "MultiWindows.exe layout=A"
    Run File: "MultiWindows.exe layout=B"
    Run File: "MultiWindows.exe layout=C"
    Run File: "MultiWindows.exe layout=D"
    
    //or
    Run File: "MultiWindows.exe A"
    Run File: "MultiWindows.exe B"
    Run File: "MultiWindows.exe C"
    Run File: "MultiWindows.exe D"
    
    // pseudocode
    On start: go to layout WebView.arguments.layout
    
    // or
    On start: go to layout WebView.arguments[0]
    

    I believe that the combination of these two things can allow the creation of projects like this without having to go through other applications.

    Obviously, I don't know if it's technically feasible, if it's worth the effort, if it's in your priorities.

  • Hi, I have a problem.

    1) If I export via NW.js, then the game does not slow down and gives out 144 FPS ( " every tick - set text to - fps" ), good!

    2) If I export a clean, empty project-project via webview2, then the game does not slow down and gives out 144 FPS ( " every tick - set text to - fps" ), good!

    3) But, if I export my game not through NW.js, but through webview2 using the same Project settings as in the base project (if I create a new clean project), then the game gives out not 144 fps, but 50-55 ...

    4) If you lower all the Project settings in the game, such as anisotropic filtering, the frame rate and so on, or turn it off, then you get a fps of 70-85, but not higher.

    5) I tried running the game directly in the Microsoft Edge browser and everything worked smoothly there. (I actually use C3 in google chrome)

    I don't think the game can consume a lot of video memory or processor resources, in any case, I have a powerful computer, this is not crisis 3 .... any ideas how to help me? I thought, after export, the FPS limiter would be set, but depending on whether several of them are enabled or disabled, the FPS settings may be slightly lower or higher. It turns out that the computer gives 144 fps, the game is 50-70 fps and I see micro-micro freezes (sorry, I use google translator)

    My game, you can try to export via webview2 and check if you will have fps 70 - 85 cloud.mail.ru/public/UB6F/6DxgrYrZU

    UPD: I found a problem, when I used export via NW.js, then I entered this into the command line '--in-process-gpu --disable-direct-composition --enable-features=nw2' , now I did export with a clean command line and everything is fine

  • Hello, how can I disable the cntrl-P cntr-R keyboard shortcuts when exporting via Microsoft Edge WebView2 ... or how can I disable the buttons participating in the keyboard combination, for example P or R, etc ...?

    For example, for export via NW.js, such a script is implemented and work:

    window.addEventListener('keydown', ev => {

    if (ev.ctrlKey && (ev.code === 'KeyP' || ev.code === 'KeyR' || ev.code === 'KeyF')) {

    ev.preventDefault();

    }

    });

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