Page 1 of 1

Feature request: NW.js window size settings

PostPosted: Fri May 22, 2015 11:56 am
by ErekT
The way window size works right now is it includes the window borders when you set resolution. So if I set window size to 320x256 in Windows 7 it'll fit the window borders inside that resolution so the actual game window is only 304x218. Problem is, window border size varies between OS'es, Windows versions, and theme settings so it's impossible to make sure the game always runs at the same resolution in windowed mode. If I run the same 320x256 res in classic mode for instance, the game resolution is suddenly 312x218.

It would be great if we had an alternate window size setting that made window borders expand to fit the game resolution instead of the other way around.

Re: Feature request: NW.js window size settings

PostPosted: Fri May 22, 2015 3:30 pm
by Tokinsom
You just have to calculate the size of the border and add it to the final window size. Set 2 global vars to the native resolution, then subtract that from the retrieved window size.

Re: Feature request: NW.js window size settings

PostPosted: Sat May 23, 2015 8:26 pm
by ErekT
Thanks :)

Re: Feature request: NW.js window size settings

PostPosted: Sat May 23, 2015 8:54 pm
by Quicksand
Tokinsom wrote:You just have to calculate the size of the border and subtract it. Set 2 global vars to the native resolution, then subtract that from the retrieved window size.


Could you reword or dumb this down for me please? Or make a project file of it, if that's not too much to ask.

Re: Feature request: NW.js window size settings

PostPosted: Sat May 23, 2015 10:48 pm
by ErekT
Fisholith made an example here:

nw-js-object-and-window-sizes_t145083

Re: Feature request: NW.js window size settings

PostPosted: Mon May 25, 2015 2:07 am
by Quicksand
ErekT wrote:Fisholith made an example here:

nw-js-object-and-window-sizes_t145083


Thanks to you and them, then.