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

Bugs will be moved here once resolved.

Post » Thu Oct 08, 2015 3:21 pm

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
Last edited by Tokinsom on Thu Oct 08, 2015 4:00 pm, edited 1 time in total.
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Thu Oct 08, 2015 3:37 pm

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.
ImageImageImageImage
B
158
S
67
G
43
Posts: 2,603
Reputation: 36,003

Post » Mon Oct 12, 2015 4:28 pm

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.
Scirra Founder
B
402
S
238
G
89
Posts: 24,613
Reputation: 195,993

Post » Mon Oct 12, 2015 4:50 pm

@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?
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 0 guests