view_xport

Description

With this built in array you can get or set the x position of the given view port. The view port is the area on the screen where the view is drawn, and you can have up to 8 active at any one time (the array is values from 0 to 7 inclusive to give 8 ports). Now, the default for GameMaker Studio 2 is that the game window (or background canvas) is the same size as the room, however when you activate view ports and cameras, this behaviour changes and the total size of the bounding box for all view ports is used. So, if you have two different view ports at two different positions, the total area that they cover defines the size of the game window. The following image illustrates this:

If you only have one view port setting the x or y value of the port can have some interesting effects but is not normally practical (see the image below) and so it is better to maintain the x and y position as (0,0).



Syntax:

view_xport[0 .. 7];


Returns:

Real


Example:

view_xport[0] = 0;
view_yport[0] = 0;

The above code resets the position of view port[0] to the (0,0) position (top left hand corner) of the display.


Back: Cameras
Next: view_yport
© Copyright YoYo Games Ltd. 2017 All Rights Reserved