Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. //For options menu
  2. global.switchWindowMode = false;
  3. global.changeScale = false;
  4. init_globals();
  5. //Window drag
  6. mX = 0;
  7. mY = 0;
  8. posX = 0;
  9. posY = 0;
  10. ///Properties
  11. ideal_width=0; //Doesn't matter because we are going to calculate this.
  12. ideal_height=264;
  13. if file_exists("options.ini")
  14. {
  15. ini_open("options.ini");
  16. savedZoom = ini_read_real("Camera", "Zoom", 1);
  17. fullscreen = ini_read_real("Window", "Mode", true);
  18. ini_close();
  19. show_debug_message("File Exists, zoom = " + string(savedZoom));
  20. }
  21. else
  22. {
  23. savedZoom = 1;
  24. fullscreen = true;
  25. }
  26. zoom = 1;
  27. max_zoom = 1;
  28. //use_sub_pixels=true;
  29.  
  30. //Aspect ratio
  31. aspect_ratio = display_get_width()/display_get_height();
  32. //aspect_ratio = clamp(aspect_ratio, 16/10, 21/9);
  33.  
  34. //Calculate new ideal width.
  35. ideal_width=round(ideal_height*aspect_ratio);
  36. //ideal_height=round(ideal_width/aspect_ratio);
  37.  
  38. //Pixel Perfect Scaling
  39. if display_get_width() % ideal_width != 0
  40. {
  41. var _d = round(display_get_width()/ideal_width);
  42. ideal_width = display_get_width()/_d;
  43. }
  44. if display_get_height() % ideal_height != 0
  45. {
  46. var _d = round(display_get_height()/ideal_height);
  47. ideal_height = display_get_height()/_d;
  48. }
  49.  
  50. //Check to make sure our ideal width and height isn't an odd number, as that's usually not good.
  51. if(ideal_width & 1)
  52. ideal_width++;
  53. if(ideal_height & 1)
  54. ideal_height++;
  55.  
  56.  
  57. max_zoom = floor(display_get_width()/ideal_width);
  58.  
  59. //Setup all the view ports so I don't have to.
  60. for(var i = 1; i <= room_last; i++)
  61. {
  62. if(room_exists(i))
  63. {
  64. room_set_viewport(i,0,true,0,0,ideal_width,ideal_height);
  65. room_set_view_enabled(i,true);
  66. }
  67. }
  68.  
  69. surface_resize(application_surface,ideal_width*zoom,ideal_height*zoom);
  70. display_set_gui_size(ideal_width*zoom,ideal_height*zoom);
  71. window_set_size(ideal_width*zoom,ideal_height*zoom);
  72.  
  73. alarm[0]=1; //Center Window
  74.  
  75. while savedZoom != zoom
  76. {
  77. show_debug_message("Zoom");
  78. zoom++;
  79.  
  80. if(zoom>max_zoom)
  81. zoom=1;
  82.  
  83. window_set_size(ideal_width*zoom, ideal_height*zoom);
  84. surface_resize(application_surface, ideal_width*zoom, ideal_height*zoom);
  85. alarm[0]=1;
  86. }
  87. window_set_fullscreen(fullscreen);
  88. if room == _display_init
  89. room_goto(MainMenu);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement