Guest User

Untitled

a guest
Jan 27th, 2017
693
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. event_inherited();
  2. ///Properties
  3. ideal_width=0; //Doesn't matter because we are going to calculate this.
  4. ideal_height=270;
  5. zoom=1;
  6. max_zoom=1;
  7. use_sub_pixels=false;
  8.  
  9. //Aspect ratio
  10. aspect_ratio = display_get_width()/display_get_height();
  11.  
  12. //Calculate new ideal width.
  13. ideal_width=round(ideal_height*aspect_ratio);
  14. //ideal_height=round(ideal_width/aspect_ratio);
  15.  
  16. ideal_width=round(ideal_width);
  17. ideal_height=round(ideal_height);
  18.  
  19. //Check to make sure our ideal width and height isn't an odd number, as that's usually not good.
  20.  
  21.  
  22. if(ideal_width & 1)
  23. ideal_width++;
  24.  
  25. if(ideal_height & 1)
  26. ideal_height++;
  27.  
  28.  
  29. max_zoom = floor(display_get_width()/ideal_width);
  30.  
  31. //Setup all the view ports so I don't have to.
  32. globalvar Main_Camera,Alt_Camera;
  33. Main_Camera = camera_create_view(0,0,ideal_width,ideal_height,0,noone,0,0,0,0);
  34. Alt_Camera = camera_create_view(0,0,ideal_width,ideal_height,0,noone,0,0,0,0);
  35. camera_set_view_size(Main_Camera,ideal_width,ideal_height);
  36. camera_set_view_size(Alt_Camera,ideal_width,ideal_height);
  37.  
  38. for(var i=1; i<= room_last; i++)
  39. {
  40. if(room_exists(i))
  41. {
  42. room_set_view_enabled(i,true);
  43. room_set_viewport(i,0,true,0,0,ideal_width,ideal_height);
  44. room_set_camera(i,0,Main_Camera);
  45.  
  46. room_set_viewport(i,1,false,0,0,ideal_width,ideal_height);
  47. room_set_camera(i,1,Alt_Camera);
  48.  
  49. }
  50. }
  51.  
  52. surface_resize(application_surface,ideal_width,ideal_height);
  53. display_set_gui_size(ideal_width,ideal_height);
  54. window_set_size(ideal_width*zoom,ideal_height*zoom);
  55.  
  56. alarm[0]=1; //Center Window
  57. alarm[2]=1; //Change Zoom
Add Comment
Please, Sign In to add comment