CORE/docs/references/wmgr.gd.md

125 lines
4 KiB
Markdown
Raw Normal View History

---
hide:
- navigation
---
# Window manager (core.wmgr)
Responsible for managing the main window.
## Modes
The window can be in one of five different modes. Those are:
### `WINDOWED`
A floating window.
### `MINIMIZED`
Minimizes the window to the taskbar/application list/etc..
### `MAXIMIZED`
Maximizes the window.
### `FULLSCREEN`
Hides all decorations and sets the window size to the screen size. Has multi-window support.
### `EXCLUSIVE_FULLSCREEN`
Same as the `FULLSCREEN` mode but has way less overhead at the cost of loosing multi-window support. Has different effects on different platforms:<br/>
**Windows**: *Depending on the video driver, the screen might black out for a few seconds.*<br/>
**macOS**: *Prevents the dock and menu from showing up when hovering over the edge of the screen.*<br/>
**Linux/BSD**: *Disables compositing (transparency effects, window close animation, etc.)*
## Methods
### set_size()
- returns `void`
- description `Updates the window size.`
- argument `x`
- type `int`
- mandatory `yes`
- description `The new window size (x coordinate).`
- argument `y`
- type `int`
- mandatory `yes`
- description `The new window size (y coordinate).`
### get_size()
- returns `Vector2i`
- description `Returns the window size.`
### set_position()
- returns `void`
- description `Updates the window position.`
- argument `x`
- type `int`
- mandatory `yes`
- description `The new window position (x coordinate).`
- argument `y`
- type `int`
- mandatory `yes`
- description `The new window position (y coordinate).`
### get_position()
- returns `Vector2i`
- description `Returns the window position.`
### set_title()
- returns `void`
- description `Updates the window title.`
- argument `title`
- type `String`
- mandatory `yes`
- description `The new window title.`
### get_title()
- returns `String`
- description `Returns the window title.`
### set_mode()
- returns `void`
- description `Updates the window mode.`
- argument `mode`
- type `String`
- mandatory `yes`
- description `The new window mode.`
- format follows `wmgr modes`
### get_mode()
- returns `String`
- description `Returns the window mode.`
### get_fps()
- returns `float`
- description `Returns the current framerate, also known as FPS or frames per second.`
- format `NUMBER.NUMBER` (if argument `flat` is `false`), `NUMBER` (if argument `flat` is `true`) or `INF` if the frame rate is infinite (can be caused if the physics fps is set too high, "should" never occur)
- argument `flat`
- type `bool`
- mandatory `no, default value is false`
- description `If decimal numbers should be returned or not.`
- format `If "true" decimal numbers will be removed, if "false" not.`
### get_rendertime()
- returns `float`
- description `Returns how long the last frame took to render (render time).`
### get_delta()
- returns `float`
- description `Returns the latest delta value.`
## Internal variables
Do not touch or you will cause breakage.
### window_size_x
- type `int`
- default value `<wmgr_size_x config variable>`
- description `The window size (x coordinate). Used at startup only.`
### window_size_y
- type `int`
- default value `<wmgr_size_y config variable>`
- description `The window size (y coordinate). Used at startup only.`
### window_title
- type `String`
- default value `<wmgr_title config variable>`
- description `The window title. Used at startup only.`
### window_mode
- type `String`
- default value `<wmgr_mode config variable>`
- description `The window mode. Used at startup only.`
- format follows `wmgr modes`
### delta
- type `float`
- default value `0`
- description `The latest delta value passed by the engine.`
## Internal methods
Do not execute or you will cause breakage.
### _ready()
- returns `void`
- description `Applies config variables.`
### _process()
- returns `void`
- description `Updates the "delta" variable.`
- argument `delta`
- type `float`
- mandatory `yes`
- description `You know what it is.`