room_set_viewport

This function sets the view port properties for any room in your game except the current one.

You supply the room index to set the view port in, the view port index (from 0 to 7) and then whether the view port should be visible at the start of the room or not (set to true to make the port visible, and false otherwise). After that you set the x and y coordinate (corresponding to the top left position of the view port) and then the width and height in pixels.

 

Syntax:

room_set_viewport(rm, vind, vis, xport, yport, wport, hport);

ArgumentTypeDescription
rmRoom AssetThe room to set
vindRealThe index of the view port to set
visBooleanThe visibility of the view port (true is visible, false is invisible)
xportRealThe x position of the view port in the room
yportRealThe y position of the view port in the room
wportRealThe width (in pixels) of the view port
hportRealThe height (in pixels) of the view port

 

Returns:

N/A

 

Example:

global.myroom = room_add();
room_set_width(global.myroom, 640);
room_set_height(global.myroom, 480);
room_set_viewport(global.myroom, 0, true, 0, 0, 640, 480);

This will set the view port [0] properties in the room indexed in the variable global.myroom.