Skip to main content

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

Android System Flags#

As of version 1.0.5, Xtend supports rendering cutout areas in Android 9+. While Android 8 and below do not support cutouts, they do handle the system UI in different ways depending on manufacturer. This can include showing or hiding different system UI elements, which cut into an app's rendering space. To explicitly set system UI behavior, GameMaker Studio includes the function display_set_ui_visibility, but does not provide the flags needed to actually use it. Xtend solves this problem by including predefined flags consistent with the Android SDK.

Keyword/MacroValueDescription
SYSTEM_UI_FLAG_VISIBLE0View has requested the system UI (status bar) to be visible (the default).
SYSTEM_UI_FLAG_LOW_PROFILE1View has requested the system UI to enter an unobtrusive "low profile" mode. Status bar and/or navigation icons may dim.
SYSTEM_UI_FLAG_HIDE_NAVIGATION2View has requested that the system navigation (Home, Back, and the like) be temporarily hidden.
SYSTEM_UI_FLAG_FULLSCREEN4View has requested to go into the normal fullscreen mode so that its content can take over the screen while still allowing the user to interact with the application.
SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR16Requests the navigation bar to draw in a mode that is compatible with light navigation bar backgrounds. For this to take effect, the window must request FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS but not FLAG_TRANSLUCENT_NAVIGATION.
SYSTEM_UI_FLAG_LAYOUT_STABLE256Requests content insets to always represent the worst case that the application can expect as a continuous state (depending on other active flags).
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION512View would like its window to be laid out as if it has requested SYSTEM_UI_FLAG_HIDE_NAVIGATION, even if it currently hasn't.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN1024View would like its window to be laid out as if it has requested SYSTEM_UI_FLAG_FULLSCREEN, even if it currently hasn't.
SYSTEM_UI_FLAG_IMMERSIVE2048View would like to remain interactive when hiding the navigation bar with SYSTEM_UI_FLAG_HIDE_NAVIGATION
SYSTEM_UI_FLAG_IMMERSIVE_STICKY4096View would like to remain interactive when hiding the status bar with SYSTEM_UI_FLAG_FULLSCREEN and/or hiding the navigation bar with SYSTEM_UI_FLAG_HIDE_NAVIGATION. Use this flag to create an immersive experience while also hiding the system bars.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR8192Requests the status bar to draw in a mode that is compatible with light status bar backgrounds. For this to take effect, the window must request FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS but not FLAG_TRANSLUCENT_STATUS.
tip

Multiple flags can be assigned in display_set_ui_visibility at once by separating values with bitwise OR, aka the pipe symbol (|)