The "camera_set_view_scale" Function
#
SyntaxArgument | Type | Description |
---|---|---|
camera | camera | The camera index to modify (typically view_camera[#] ) |
mode | constant | The scaling mode to use (same as config) |
xport | real | The horizontal position to display the camera within the master view |
yport | real | The vertical position to display the camera within the master view |
wport | real | The horizontal area to display the camera within the master view |
hport | real | The vertical area to display the camera within the master view |
[force] | boolean | Optional: Perform scaling even if a resize was not detected |
#
DescriptionWhile the master view defined in config will always fill the entire window, additional views can be created for splitscreen display within the master view. This script applies the same scaling behaviors to splitscreen views as are applied to the master view.
GameMaker currently provides 8 built-in view cameras, numbered 0-7, although custom cameras can be assigned to the view as well. To use a built-in camera, input camera
as view_camera[#]
. view_visible[#]
must be true
for the viewport to be displayed.
Note that if the master view is input in this script, it will be ignored.
It is recommended to use the built-in view_width
and view_height
macros to position and size the viewport relative to the master view. If this script is run in a Step event, inner views will respond to changes in window size with correct scaling. For other events, enabling the optional [force]
argument will trigger scaling immediately.
By default, base width/height will be determined by the size of the camera when this script is first run. This can be set with camera_set_view_size
or by defining width_base
and height_base
within a view#
section in config.