https://github.com/robotoskunk/gms2_safezone
A script that adds multi-resolution support for Game Maker Studio 2
https://github.com/robotoskunk/gms2_safezone
gms2 multi-resolution multiresolution script
Last synced: 5 months ago
JSON representation
A script that adds multi-resolution support for Game Maker Studio 2
- Host: GitHub
- URL: https://github.com/robotoskunk/gms2_safezone
- Owner: RobotoSkunk
- License: gpl-3.0
- Created: 2021-03-20T03:38:49.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-20T04:09:27.000Z (about 5 years ago)
- Last Synced: 2025-01-25T16:44:45.082Z (over 1 year ago)
- Topics: gms2, multi-resolution, multiresolution, script
- Language: Game Maker Language
- Homepage: https://robotoskunk.com
- Size: 262 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GMS2 - RobotoSkunk's Safezone
A script that adds multi-resolution support in Game Maker Studio 2.
The script adjusts the GUI surface and the application_surface to suit the resolution you have set.
## Installation
[Go to the folder where the script is located](https://github.com/RobotoSkunk/gms2_safezone/blob/main/src/scripts/rs_safezone/rs_safezone.gml) and add it to your project, then configure the project to support window resizes and keep the aspect ratio (important).
## How to use
Just call the script inside a single object in the step event to start working.
The function returns the aspect ratio of the current resolution.
Additionally, it automatically generates four read-only global variables to use:
* **rs_ideal_width** - The new width given by the script.
* **rs_ideal_height** - The new height given by the script.
* **rs_actual_width** - The current width of the game window.
* **rs_actual_height** - The current height of the game window.
The arguments that the function takes are the following
```gml
rs_safezone(width, height, [quality])
```
Where...
* **width** - Width of the safe zone.
* **height** - Height of the safe zone.
* **\[quality]** - The quality of the application_surface.
### Example
```gml
//Inside a step event
rs_safezone(1280, 720);
camera_set_view_size(view_camera[0], rs_ideal_width, rs_ideal_height);
```
## Bugs
Use sensible aspect ratios because Game Maker will return a surface error if you use dimensions that Game Maker doesn't support.
These errors are very random and there is no concrete way to know when one will come out.