-
Notifications
You must be signed in to change notification settings - Fork 5
STANNcam Manager
To start using STANNcam I recommend creating a new dedicated persistent camera object, or you can also use any Persistent manager object you have.
Initializes stanncam with different resolutions.
Argument | Type | Description |
---|---|---|
game_w | Integer |
The width of the actual game, this will be scaled up to match the resolution |
game_h | Integer |
The height of the actual game, this will be scaled up to match the resolution |
[resolution_w] | Integer |
The window resolution width Default: same as game_w
|
[resolution_h] | Integer |
The window resolution height Default: same as game_h
|
[gui_w] | Integer |
The GUI width resolution, can be independent of the game res Default: Same as game_w
|
[gui_h] | Integer |
The GUI height resolution, can be independent of the game res Default: Same as game_h
|
[window_mode] | STANNCAM_WINDOW_MODE |
The window mode can be either STANNCAM_WINDOW_MODE.WINDOWED , STANNCAM_WINDOW_MODE.FULLSCREEN , STANNCAM_WINDOW_MODE.BORDERLESS Default: STANNCAM_WINDOW_MODE.WINDOWED
|
Returns: Undefined
Example:
// GUI by default is identical to the game resolution
// So if that's what we want we can just not specify it
stanncam_init(320, 240, 1920, 1080);
It also sets these global variables which you can use throughout your game afterwards.
Global Variable | Description |
---|---|
global.stanncams | Array containing all stanncam camerasDefault: -1 |
global.game_w | Game width |
global.game_h | Game height |
global.res_w | Display resolution width, ie the final window size |
global.res_h | Display resolution height, ie the final window size |
global.gui_w | GUI width |
global.gui_h | GUI height |
global.window_mode |
STANNCAM_WINDOW_MODE.WINDOWED , STANNCAM_WINDOW_MODE.FULLSCREEN , or STANNCAM_WINDOW_MODE.BORDERLESS
|
Remove all existing stanncam instances and removes the stanncam manager object. It's essentially the opposite of stanncam_init
You can use this, if you halfway through your game for whatever reason want to stop using stanncam.
Argument | Type | Description |
---|---|---|
application_surface_draw_enable | Boolean |
stanncam_init sets application_surface_drawing to false . This determines whether to re-enable application_surface_drawing or not when destroying stanncam Default: true
|
Returns: Undefined
Example:
// Destroy stanncam. But don't re-enable application surface drawing
stanncam_destroy(false);
These methods control the global variables for STANNcam, and stuff such as resolution and setting whether the game should be fullscreened, borderless or windowed.
Changes the display resolution of the game. The game size will also scale to match the display resolution. This will keep everything looking pixel perfect!
Argument | Type | Description |
---|---|---|
resolution_w | Integer |
Display/window resolution width |
resolution_h | Integer |
Display/window resolution height |
Returns: Undefined
Sets the game's display mode.
Argument | Type | Description |
---|---|---|
window_mode | STANNCAM_WINDOW_MODE |
Possible display modes:STANNCAM_WINDOW_MODE.WINDOWED , STANNCAM_WINDOW_MODE.FULLSCREEN , or STANNCAM_WINDOW_MODE.BORDERLESS
|
Returns: Undefined
Sets the game to be displayed in a window.
Returns: Undefined
Sets the game to be displayed at full screen.
Returns: Undefined
Sets the game to be displayed in a borderless window.
Returns: Undefined
It sets whether the game should maintain it's aspect ratio. It is on by default.
If your game res is 640x480(4:3), but your display resolution is 1920x1080(16:9), then the game will be stretched out to match.
So if you don't want that you can toggle it on, this will effectively overwrite the display resolution to 1440x1080(4:3)
Argument | Type | Description |
---|---|---|
on_off | Boolean |
Whether to enable maintaining aspect ratio |
Returns: Undefined
Returns whether or not keep_aspect_ratio
is enabled.
Returns: Boolean
If keep_aspect_ratio
is turned on, and the window is wider than the resolution.
Then the game wouldn't match the display resolutions, and so when drawing the game there would be a lot of black space on the right of the screen.
This methods returns half of that empty space, so the drawing can be offset and appear in the middle of the screen.
The stanncam.draw
method already uses this by default, so it's rarely needed.
Returns: Float
Changes the GUI resolution of the game. It also updates global.gui_w
and global.gui_h
.
Argument | Type | Description |
---|---|---|
gui_w | Integer |
Width of the GUI resolution |
gui_h | Integer |
Height of the GUI resolution |
Returns: Undefined
How much bigger the GUI resolution is from the game resolution.
Returns: Float
How much bigger the Display resolution is from the game resolution.
Returns: Float
Toggles whether or not to pause the stanncam
camera.
Returns: Undefined
Sets whether or not to pause the stanncam
camera.
Argument | Type | Description |
---|---|---|
paused | Boolean |
Whether to pause or unpause all stanncam camera pause states |
Returns: Undefined
Pauses each stanncam
camera.
Returns: Undefined
Unpauses each stanncam
camera.
Returns: Undefined
Using STANNCAM_RES_PRESETS
enum to return a preset resolution. They're simply presets for common screen resolutions and certain retro consoles. You can just as easily use your own resolution when initializing stanncam or creating new cameras.
A list of all the preset resolutions can be seen here
Argument | Type | Description |
---|---|---|
_preset_index |
STANNCAM_RES_PRESETS / Integer
|
The index of the resolution preset to return |
Returns: Struct
Example:
//Initializes stanncam with a game resolution identical to a gameboy advance,
//but when drawn it's scaled up to a modern 1920 x 1080
var _gameboy_res = stanncam_get_preset_resolution(STANNCAM_RES_PRESETS.GAME_BOY_ADVANCE_160P);
stanncam_init(_gameboy_res.width, _gameboy_res.height, 1920, 1080);
Works just like stanncam_get_preset_resolution
but you instead supply start and end index, to return an array of specific resolution presets
A list of all the preset resolutions can be seen here
Argument | Type | Description |
---|---|---|
start |
STANNCAM_RES_PRESETS / Integer
|
Starting index range Default: 0
|
end |
STANNCAM_RES_PRESETS / Integer
|
Ending index range |
Returns: Array<Struct>
Example: could be used to get list of resolutions to choose between in a graphics settings menu.
//This sets resolutions to an array containing
// DESKTOP_720P,DESKTOP_1366_X_768,DESKTOP_1080P, DESKTOP_1440P,
var _resolutions = stanncam_get_preset_resolution_range(STANNCAM_RES_PRESETS.DESKTOP_720P,STANNCAM_RES_PRESETS.DESKTOP_1440P);
or
//you can append multiple ranges together to cherry pick some specific resolutions
var _resolutions = stanncam_get_preset_resolution_range(STANNCAM_RES_PRESETS.GAME_BOY_144P,STANNCAM_RES_PRESETS.GAME_BOY_ADVANCE_160P);
array_push(_resolutions, stanncam_get_preset_resolution_range(STANNCAM_RES_PRESETS.DESKTOP_720P,STANNCAM_RES_PRESETS.GAMDESKTOP_1080P));