Advertisement
InsanelySpicyCrab

Untitled

Feb 22nd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. /// @description scr_initResolution initializes display properties.
  2.  
  3. // set base ideal width/height
  4. ideal_width = 0;
  5. ideal_height = 480;
  6.  
  7. zoom = 1;
  8.  
  9. // calculate display aspect ratio
  10. aspect_ratio = display_get_width()/display_get_height();
  11. aspect_ratio = clamp(aspect_ratio, 2/3, 9/16); // clamps aspect ratio of the game overall.
  12.  
  13.  
  14. ideal_width = round(ideal_height*aspect_ratio);
  15.  
  16. // PIXEL PERFECT SCALING
  17.  
  18. if (display_get_width() mod ideal_width != 0)
  19. {
  20. var _d = round(display_get_width()/ideal_width);
  21. ideal_width= display_get_width()/_d;
  22. }
  23.  
  24. if (display_get_height() mod ideal_height != 0)
  25. {
  26. var _d = round(display_get_height()/ideal_height);
  27. ideal_height = display_get_height()/_d;
  28. }
  29.  
  30.  
  31. // ELIMINATE ODD NUMBERED WIDTH AND HEIGHT VALUES
  32. if (ideal_width & 1)
  33. {
  34. ideal_width++;
  35. }
  36.  
  37. if (ideal_height & 1)
  38. {
  39. ideal_height++;
  40. }
  41.  
  42. // store maximum zoom value for windowed mode.
  43. max_zoom = floor(display_get_width()/ideal_width);
  44.  
  45. // resize application surface
  46.  
  47. surface_resize(application_surface, ideal_width, ideal_height);
  48. window_set_size(ideal_width, ideal_height);
  49.  
  50. full_screen = 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement