sensodyne
Member
hi everyone,
I used the tutorial and used this solution in my game to switch the game from full screen to windowed mode while keeping the aspect ratio and back again.
The author described it very nicely in his tutorial, it works very well
Remembering the display mode of the game works until I quit the game
but I have one question ... I don't know how to make the screen change state remembered also after quitting the game completely
to put it more clearly, so that it remembers the screen save when I quit the game ..
my full code looks like this
obj_display_screen - this object is perssistent and is located in the first room of the game
create
obj_menu
create
step
I used the tutorial and used this solution in my game to switch the game from full screen to windowed mode while keeping the aspect ratio and back again.
The author described it very nicely in his tutorial, it works very well
Remembering the display mode of the game works until I quit the game
but I have one question ... I don't know how to make the screen change state remembered also after quitting the game completely
to put it more clearly, so that it remembers the screen save when I quit the game ..
my full code looks like this
obj_display_screen - this object is perssistent and is located in the first room of the game
create
GML:
ideal_width = 0;
ideal_height = 480;
aspect_ratio = display_get_width()/display_get_height();
//aspect_ratio = clamp(aspect_ratio,16/9, 21/9);
ideal_width = round(ideal_height * aspect_ratio);
//Check if odd number
if (ideal_width & 1) {
ideal_width ++;
}
for (var i=2; i <= room_last; i++) {
if (room_exists(i)) {
view_wview[0] = ideal_width;
view_hview[0] = ideal_height;
view_wport[0] = ideal_width;
view_hport[0] = ideal_height;
}
}
surface_resize(application_surface, ideal_width, ideal_height);
window_set_size(ideal_width,ideal_height);
room_goto(room_next(room));
obj_menu
create
GML:
options=ds_list_create()
options[|0]=Controlls
options[|1]=Sound
options[|3]=Back
if (window_get_fullscreen()) {
options[|2]=Fullscreen
} else {
options[|2]=Windowed
}
animation_speed=room_speed/2
for(var i=0; i<ds_list_size(options); i++) {
animation[i]=0
}
selected=0
step
GML:
if(keyboard_check_pressed(vk_enter)) {
if(selected=0) {
room_goto(room_controls)
} else if(selected=1) {
room_goto(room_sounds)
} else if(selected=2) {
window_set_fullscreen(!window_get_fullscreen());
options[|2]=Fullscreen;
if (!window_get_fullscreen()) {
window_set_size(obj_display_screen.ideal_width, obj_display_screen.ideal_height);
options[|2]=Windowed;
}
} else if(selected=3) {
room_goto(roo_menu_game)
}
}
Last edited: