GameMaker Studio 2 Desktop

GameMaker Studio 2 Desktop

mikeypro Feb 18, 2020 @ 2:27am
Fullscreen Toggle Without Scaling :)
Studio 2 has gotten a little complicated with how you resize your screen, and by that I mean they introduced handling of the application surface but for some reason forgot to resize the application surface when you switch viewport/camera view sizes, which is kind of.. dumb.

You may have noticed when you implement fullscreen that your fullscreen game screen now looks stretched, some 'pixels' are bigger than others. Well that's because your application surface is still the same size and is getting stretched over the display. Your application surface needs to be resized.

The following code is a quick example of how to properly resize your screen when switching to and from fullscreen/windowed modes. This has only been tested on Windows 10 but I hope it helps many of you who have been blighted by this lazy application surface 'feature'.

To re-use my code here, create your global.keyToggleFullscreen somewhere, create global.IsFullscreen somewhere as well, then in whatever object or script you have your user input handling in, put this there:

if(keyboard_check_released(global.keyToggleFullscreen))
{
global.IsFullscreen = !global.IsFullscreen;
window_set_fullscreen(global.IsFullscreen);

if(global.IsFullscreen)
{
camera_set_view_size(view_camera[0],display_get_width(),display_get_height());
surface_resize(application_surface,display_get_width(),display_get_height());
}
else
{
camera_set_view_size(view_camera[0],view_wport[0],view_hport[0]);
surface_resize(application_surface,view_wport[0],view_hport[0]);
}
}
Last edited by mikeypro; Feb 18, 2020 @ 2:39am
< >
Showing 1-1 of 1 comments
Mar 2, 2020 @ 3:40pm 
it fixed my scaling! thx dude!
< >
Showing 1-1 of 1 comments
Per page: 1530 50

Date Posted: Feb 18, 2020 @ 2:27am
Posts: 1