Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //For options menu
- global.switchWindowMode = false;
- global.changeScale = false;
- init_globals();
- //Window drag
- mX = 0;
- mY = 0;
- posX = 0;
- posY = 0;
- ///Properties
- ideal_width=0; //Doesn't matter because we are going to calculate this.
- ideal_height=264;
- if file_exists("options.ini")
- {
- ini_open("options.ini");
- savedZoom = ini_read_real("Camera", "Zoom", 1);
- fullscreen = ini_read_real("Window", "Mode", true);
- ini_close();
- show_debug_message("File Exists, zoom = " + string(savedZoom));
- }
- else
- {
- savedZoom = 1;
- fullscreen = true;
- }
- zoom = 1;
- max_zoom = 1;
- //use_sub_pixels=true;
- //Aspect ratio
- aspect_ratio = display_get_width()/display_get_height();
- //aspect_ratio = clamp(aspect_ratio, 16/10, 21/9);
- //Calculate new ideal width.
- ideal_width=round(ideal_height*aspect_ratio);
- //ideal_height=round(ideal_width/aspect_ratio);
- //Pixel Perfect Scaling
- if display_get_width() % ideal_width != 0
- {
- var _d = round(display_get_width()/ideal_width);
- ideal_width = display_get_width()/_d;
- }
- if display_get_height() % ideal_height != 0
- {
- var _d = round(display_get_height()/ideal_height);
- ideal_height = display_get_height()/_d;
- }
- //Check to make sure our ideal width and height isn't an odd number, as that's usually not good.
- if(ideal_width & 1)
- ideal_width++;
- if(ideal_height & 1)
- ideal_height++;
- max_zoom = floor(display_get_width()/ideal_width);
- //Setup all the view ports so I don't have to.
- for(var i = 1; i <= room_last; i++)
- {
- if(room_exists(i))
- {
- room_set_viewport(i,0,true,0,0,ideal_width,ideal_height);
- room_set_view_enabled(i,true);
- }
- }
- surface_resize(application_surface,ideal_width*zoom,ideal_height*zoom);
- display_set_gui_size(ideal_width*zoom,ideal_height*zoom);
- window_set_size(ideal_width*zoom,ideal_height*zoom);
- alarm[0]=1; //Center Window
- while savedZoom != zoom
- {
- show_debug_message("Zoom");
- zoom++;
- if(zoom>max_zoom)
- zoom=1;
- window_set_size(ideal_width*zoom, ideal_height*zoom);
- surface_resize(application_surface, ideal_width*zoom, ideal_height*zoom);
- alarm[0]=1;
- }
- window_set_fullscreen(fullscreen);
- if room == _display_init
- room_goto(MainMenu);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement