The "vngen_set_scale" Function


viewinteger (0-7)The viewport to scale (optional, use keyword 'none' to disable scaling)


Enables automatically adjusting the input viewport to fill the screen at any resolution and aspect ratio, maintaining width and adding height as necessary to eliminate black bars. The input viewport must be configured in the GameMaker Studio room editor and enabled as visible before it can be used with this script.


!Important note: Setting a new viewport to scale reinitializes scaling to match the input viewport. As such, vngen_set_scale should only be run in events where it is executed once, such as Create--NOT Step or Draw!

How each on-screen element responds to changes in display scale depends on the scaling modes and coordinates set in vngen_*_create actions. With proper configuration, it is possible to create visual novels that fit appropriately on any size or shape of screen.

Note that this script provides only basic scaling support which may not be sufficient for projects which mix visual novels with other types of gameplay. Advanced users are recommended to replace this script with scaling functions tailored to their specific projects.