Views

This section deals with the functions for defining view properties.

Views are one of the most important of the display properties that you can manipulate with GameMaker: Studio. They are, basically, little windows into your game world that enable you to show the player parts of a room, either scaled or 1:1, and as such they are essential when your game room is larger than the display size. For information on how views can be set up without code directly from the room editor, please see the section More About Rooms - Views.

GameMaker: Studio permits you 8 independent views (numbered from 0 - 7), all of which can be active at any one time, and all of which can show different parts of the same room. This means that you can use views to draw HUD elements or to have split screen effects for example. Each view also has its own associated view port. If the view is a section of the room that the player can see, the port is the area of the screen on which this view is drawn, and as such you can distort and scale the view if it is a size other than the view port.

Something to note about views and view ports is that the total area of the bounding box for all active view ports in the first room of the game is what defines the background canvas size (or window size for MacOS, Ubuntu (Linux) and Windows), as illustrated by the image below: Finally, you should take care when using multiple views as the draw event for all instances is called once for each view, so if you have three views active in one room, the draw event will be run three times every step (basically doing three times the work) which can be a cause for slowdown if the game is large or complex. The view_current variable can be used to help limit these draw calls however.

The following functions exist that deal with views:

  1. view_enabled
  2. view_current
  3. view_visible
  4. view_object
  5. view_angle
  6. view_xview
  7. view_yview
  8. view_hview
  9. view_wview
  10. view_hborder
  11. view_vborder
  12. view_hspeed
  13. view_vspeed
  14. view_xport
  15. view_yport
  16. view_hport
  17. view_wport
  18. view_surface_id
  19. window_view_mouse_get_x
  20. window_view_mouse_get_y
  21. window_views_mouse_get_x
  22. window_views_mouse_get_y


Back: Windows and Views
© Copyright YoYo Games Ltd. 2018 All Rights Reserved