el3um4s's Forum Posts

  • My submission to Trijam #110;

    Link:

  • 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.

  • 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.

  • Here there are my latest experiments

    Unit Test

    Typo Battle

    Construct 3 & YouTube

    File System Access API

    Mesh & Shapes

    Deno, C3 & WebView

    Multi Windows

  • 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

  • My last test with Construct3 + Deno + WebView2. Later or tomorrow I'll write something about

    github: https://github.com/el3um4s/DenoC3Webview2

  • adnan97m thank you

  • 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 have these warnings in the console

    Failed to register service worker: TypeError: Failed to register a ServiceWorker for scope ('https://app.localhost/') with script ('https://app.localhost/sw.js'): An unknown error occurred when fetching the script.

    C3_RegisterSW register-sw.js:1

    Web app manifest should have the filename extension 'webmanifest'.

    https://github.com/el3um4s/DenoC3Webview2/tree/main/source/c3p

    Furthermore the window does not remember the size after resizing by hand

    Some random ideas. Obviously I don't know if they are technically feasible, or if the work to make them is disproportionate to their usefulness.

    1. I would like the ability to run files on disk (NWjs: run file.exe)
    2. I would like open a window without toolbars, borders, or other graphical "chrome" (like electronjs). I would like to be able to draw close, minimize, maximize buttons directly in c3
    3. Weird Idea: I don't know if it's technically possible, but I'd like the option to have transparent windows. It would be interesting to experiment with a transparent canvas and window, and "windows" of various shapes drawn directly from construct.
    4. Related to the size/position of the window: the possibility of creating tray applications would be interesting (Cross-Platform Desktop Applications: chapter 8)
    5. This is a very specific idea, and maybe it's just a quirk of mine: capturing output from shell stdout (I'd like something like this). But it's a very borderline use of Construct 🤔

    Thanks for all your work

  • Hurray! I've been experimenting with denojs, webview and c3 for a few days: I'm happy to be able to try a more "native" solution

    Avast currently recognizes the file as a threat

  • Qplaze You have to set the "Purpose" property

  • You can vote this suggestion

    https://construct3.ideas.aha.io/ideas/C3-I-1705

  • Wow, Amazing!

  • mOOnpunk You're right, this would be amazing

    RASHID_AB You can do this:

    c3p

    github

    Demo online