Can't calculate window border sizes if 1080p or higher

0 favourites
  • 4 posts
From the Asset Store
Get Ready for the New Wave of "Bottom Screen" Games!
  • Problem Description

    I use NWjs.WindowWidth - WindowWidth to calculate the width of a window border so I can properly resize a window. Same for height. This has worked fine for all of my projects. However, if I set my project's window size to 1920x1080 or higher (my screen's resolution), this expression returns the wrong numbers.

    It looks like the window is automatically resized if the game is launched at a resolution that matches or exceeds the device's screen resolution. This might be part of the problem somehow.

    Attach a Capx

    https://dl.dropboxusercontent.com/u/105 ... e_Bug.capx

    Description of Capx

    Calculates the size of the window borders and prints them out to a text object.

    Steps to Reproduce Bug

    • Preview the layout. Note the border sizes printed to the text object.
    • Close the window.
    • Set the window size in the project properties your device's screen resolution or higher.
    • Preview the layout again. Note the border sizes are not the same as they were, and the window size is not exactly what you set it to.

    Observed Result

    Border size results are wrong and window is resized.

    Expected Result

    Border size results should be the same as when you first previewed the layout.

    Affected Browsers

    • NWjs

    Operating System and Service Pack

    Windows 10

    Construct 2 Version ID

    211

  • I got exactly same issue using same method two days ago. I could set the window to any size - even 1920x1080 and all looks and behaves properly, but soon as I went fullscreen I was not being able to get 1920x1080

    But today I got my new screen and when I go to full screen mode (which is now 2560x1440) it displays correctly. Borderless game window size = to screen resolution.

    My previous screen was standard 1920x1080.

  • The WindowWidth and WindowHeight system expressions are really badly named. Really they are the ViewportWidth and ViewportHeight, as in how much of your layout you can see at a time. With letterbox scale, this basically has nothing to do with the OS size of the window!

    I've added Window{Inner,Outer}{Width,Height} expressions to the Browser object for the next beta, which can return the actual window size.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley Yep. Every engine I've used uses "Window" instead of "Viewport" here and it never works the first time lol.

    Anyway, just to clarify, we can now simply subtract Window Inner from Window Outer to get the border sizes, then add the border sizes to the desired window size?

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