Search code examples
windows-8winjsconstruct-2

How to change the "Fullscreen in browser" for the Snapped view (Windows 8 apps - Construct 2)


I'm working on a Windows 8 application using Construct 2.

I set the Fullscreen in browser to Letterbox scale, and I want to change it to Scale for the Snaped view.

I found the Windows8 on view state Snapped event, but I didn't found the action that change the Fullscreen in browser.


Solution

  • I found a solution that works for me.

    First I export the windows 8 application from construct 2 without minifying the script (uncheck Minify script), and then under VS2012 I added to the end of c2runtime.js this lines:

    window.addEventListener("resize", onResize);
    function onResize() {
        window.location.reload();
    }
    

    and I changed the line 18068, that contains the mode number to :

    (Windows.UI.ViewManagement.ApplicationViewState.snapped == Windows.UI.ViewManagement.ApplicationView.value)?2:3
    

    Which means when the state view change, I set the Fullscreen in browser to 2 or 3 depending on Windows.UI.ViewManagement.ApplicationView.value

    PS : 0 = off, 1 = crop, 2 = scale, 3 = letterbox scale, 4 = integer letterbox scale

    The last part of the c2runtime.js :

        "media/",
        false,
        768,
        1366,
        (Windows.UI.ViewManagement.ApplicationViewState.snapped == Windows.UI.ViewManagement.ApplicationView.value)?2:3,
        true,
        true,
        true,
        "1.0",
        2,
        false,
        0,
        false
    ];
    };
    
    window.addEventListener("resize", onResize);
    function onResize() {
        window.location.reload();
    }