Hello Community
I'm currently developing a "sim city" 2D city-builder style game and I am trying to build a realiable and flexible base for the main features and functions. Of course s very important part is the resolution, (GUI) scaling and size management. The game is mainly developed for Windows.
The idea is to let the user change his favourite resolution within an options menu and toggle fullscreen on and off. Because it's a city-builder, it doesn't matter how much of the room the user can see, therefore the view should always be the same as the resolution/window size (i.e. if the player has a higher resolution, he sees more of the room, if he has widescreen, he sees more to the left and the right, etc.)
Until now I set the viewport in the room preferences to 1920x1080 and I have a camera object creating a view that manages the camera (zoom and pan), all working fine.
Now I created a second room for my options menu with a few simple buttons (example code below) that change the window size to a fixed value. And now here is the problem: Resizing the window size works perfectly, but it always streches the screen content to the new resolution, meaning it always uses the 1080p viewport set in the room properties. I tried to change this with several attempts with none of them working correctly:
What would you recommend on how to arrange this? Maybe my approach is wrong or there is a simpler solution for this kind of problem.
After this, the GUI scaling will be my next issue, since I have to do some testing on how this will best work with different aspect ratios and resolutions.
Many thanks for your help - any suggestions are appreciated!
Regards, 0biwan
I'm currently developing a "sim city" 2D city-builder style game and I am trying to build a realiable and flexible base for the main features and functions. Of course s very important part is the resolution, (GUI) scaling and size management. The game is mainly developed for Windows.
The idea is to let the user change his favourite resolution within an options menu and toggle fullscreen on and off. Because it's a city-builder, it doesn't matter how much of the room the user can see, therefore the view should always be the same as the resolution/window size (i.e. if the player has a higher resolution, he sees more of the room, if he has widescreen, he sees more to the left and the right, etc.)
Until now I set the viewport in the room preferences to 1920x1080 and I have a camera object creating a view that manages the camera (zoom and pan), all working fine.
Now I created a second room for my options menu with a few simple buttons (example code below) that change the window size to a fixed value. And now here is the problem: Resizing the window size works perfectly, but it always streches the screen content to the new resolution, meaning it always uses the 1080p viewport set in the room properties. I tried to change this with several attempts with none of them working correctly:
Code:
var new_width = 1600;
var new_height = 1200;
window_set_size(new_width, new_height);
camera_set_view_size(view_camera[0],new_width, new_height);
view_set_wport(0, new_width);
view_set_hport(0, new_height);
surface_resize(application_surface, new_width, new_height);
view_wport[0] = new_width;
view_hport[0] = new_height;
After this, the GUI scaling will be my next issue, since I have to do some testing on how this will best work with different aspect ratios and resolutions.
Many thanks for your help - any suggestions are appreciated!
Regards, 0biwan