Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / [SOLVED] [BUG?] Running scene_setup() resets resolution and window size

Author
Message
Zappo
Valued Member
19
Years of Service
User Offline
Joined: 27th Oct 2004
Location: In the post
Posted: 20th Aug 2022 13:03
Having multiple AppGameKit Studio scenes in a game works great but when you run the scene_setup() command on a Windows PC it reruns the SetVirtualResolution and SetWindowSize commands. If the player has maximised the game window this causes it to jump back down to windowed mode when you setup the scene.
Here is the code that is automatically inserted into the scene which is causing the issue:


I could change the line if myscene1_change_window = 1 to be if myscene1_change_window = 99 but am worried it will put it back if I edit the scene in the future. Is there a proper way to prevent it resetting the resolution and window size when setting up a scene?

The author of this post has marked a post as an answer.

Go to answer

Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 20th Aug 2022 15:25 Edited at: 20th Aug 2022 15:38
no experience with scenes myself but is THIS applicable?
preben wrote: "if you have more then one scene using the same resolution you could add all those scenes to the same .scene file"

again, no personal experience but if it's all one .scene, nothing should change since

?
Zappo
Valued Member
19
Years of Service
User Offline
Joined: 27th Oct 2004
Location: In the post
Posted: 20th Aug 2022 15:59
Thanks for the quick reply Virtual Nomad, but all that appears to do is put all of the functions for additional scenes into the same file. They still have to be called whenever you change a scene and still contain the code to reset the virtual resolution and window size.
Dark Raven
9
Years of Service
User Offline
Joined: 27th Jul 2014
Location: United States
Posted: 21st Aug 2022 02:37
This post has been marked by the post author as the answer.
All you need to do is call <scene name>_create_window(0) right before you call the setup function and this will tell the setup to not call virtualresolution and windows size functions within the setup function.

Ex.
myscene1_create_window(0)
myscene1_setup()

This will tell the scene setup to use the current VirtualResolution and Window size. Either you can set those settings in your code or you can leave out the create_window function before the first scene to allow that scene to create the initial settings. I would probably recommend that you handle the window settings and Virtual resolution settings as that will give you more sizing control.
Zappo
Valued Member
19
Years of Service
User Offline
Joined: 27th Oct 2004
Location: In the post
Posted: 22nd Aug 2022 10:11
Thank you Dark Raven. That works perfectly. I am unsure how myscene1_create_window is normally called but this does indeed set the flag that prevents it resetting the virtual resolution and window size. Brilliant!

Login to post a reply

Server time is: 2024-04-20 00:59:09
Your offset time is: 2024-04-20 00:59:09