Macros & Keywords

For the sake of memorability and forwards-compatibility, Xtend provides built-in keywords and custom macros to aid in developing projects with responsive design. It is strongly recommended to always use keywords and macros when available, as their literal values may change in future updates.

Note that most macros are read-only, and should be used for reference, not for modification. For example, to change the position of the master scaling view within the room, view_x = 50; is invalid. Instead, use regular built-in GML functions for modifying view camera properties, e.g. camera_set_view_pos(view_camera[0], 50, 0);.

tip

Many macros are prefixed, meaning you don't have to memorize each one to use them. Simply begin typing the first few letters of a macro or keyword in your code editor and you'll be shown auto-complete options to choose the desired item from a list.

Viewport Properties#

Keyword/MacroValueDescription
view_xcamera_get_view_x(view_camera[xtend.scale.view])Returns the room X coordinate of the master scaling view, in pixels
view_ycamera_get_view_y(view_camera[xtend.scale.view])Returns the room Y coordinate of the master scaling view, in pixels
view_widthcamera_get_view_width(view_camera[xtend.scale.view])Returns the width of the master scaling view, in pixels
view_heightcamera_get_view_height(view_camera[xtend.scale.view])Returns the height of the master scaling view, in pixels
view_xcenter(view_width*0.5)Returns half the width of the master scaling view, in pixels (does not include room X coord)
view_ycenter(view_height*0.5)Returns half the height of the master scaling view, in pixels (does not include room Y coord)
view_xscale(view_width/xtend.win.width_base)Returns the relative horizontal scale of the master scaling view as compared to base width, as a multplier
view_yscale(view_height/xtend.win.height_base)Returns the relative vertical scale of the master scaling view as compared to base height, as a multplier
view_aspect(view_width/view_height)Returns the aspect ratio of the master scaling view, as a fraction