I am making a game in GameMaker: Studio. I am attempting to automatically set the view size of the game to the computer's current screen resolution.
I have an initialisation room called room_init. It contains the following code at the start of the game:
///Initialisation Room
//Get size of screen and set size and view of room_main
global.display_w = display_get_width();
global.display_h = display_get_height();
room_set_width(room_main,global.display_w);
room_set_height(room_main,global.display_h);
room_set_view(room_main,0,true,0,0,global.display_w,global.display_h,0,0,global.display_w,global.display_h,0,0,0,0,noone);
window_set_size(global.display_w,global.display_h);
//Go to next room
room_goto_next();
The next room is room_main where the game is played. room_main has the default size of 1024x768, but its room size is changed by the above code.
When I set the room size of room_init to 1366x768 (my screen resolution) the game played in room_main looks like this:
The numbers at the top left show the size of room_main (1366x768).
When I set the room size of room_init to 200x100, the game played in room_main looks like this:
The numbers at the top left still read 1366x768.
I have checked display_get_width() and display_get_height() also and they return 1366 and 768 respectively, regardless of the room size of room_init.
I have looked through the GM: Studio user manual and browsed online for similar questions. I can't find anything that seems to work. Any help would be greatly appreciated.