-
Notifications
You must be signed in to change notification settings - Fork 2
Surface
| Jump To | Go Back |
Arguments | Methods | Variables |
|---|
A wrapper for the built-in GML surface type. Provides several quality of life improvements such as automatic recreation of the surface should it goes missing, as well as reduced syntax verbosity. The surface can also be made to only update when requested by the user by using the update function to check if it should be redrawn. The example demonstrates this feature.
if ( surface.update() ) {
draw_clear( c_white );
}
surface.draw( 0, 0 );
Output: The surface will be cached as white, and drawn
| Name | Type | Purpose |
|---|---|---|
| width | int |
The width of the surface |
| height | int |
The height of the surface |
| Jump To | top |
resize | update | redraw | draw | get | set | reset | free |
|---|
Returns: self
| Name | Type | Purpose |
|---|---|---|
| width | int |
The width of the surface |
| height | int |
The height of the surface |
Resizes the internal surface, will also trigger a redraw of the surface. If the provided arguments are not integers, InvalidArgumentType will be thrown.
Returns: bool
| Name | Type | Purpose |
|---|---|---|
| *forced | bool |
optional: Whether to force an update |
Returns whether or not this surface needs to be updated. This will return true if the internal surface has not been created, has been freed, redraw is flagged, or forced is set to true.
Returns: self
| Name | Type | Purpose |
|---|---|---|
| None |
Flags the surface to be redrawn next time update is checked.
Returns: self
| Name | Type | Purpose |
|---|---|---|
| x | real |
A x position |
| y | real |
A y position |
Draws the surface at the given coordinates.
Returns: undefined or int
| Name | Type | Purpose |
|---|---|---|
| None |
If the internal surface exists, returns the id to it. Otherwise, undefined is returned.
Returns: self
| Name | Type | Purpose |
|---|---|---|
| None |
The same as calling surface_set_target( surface.get() )
Returns: self
| Name | Type | Purpose |
|---|---|---|
| None |
The same as calling surface_reset_target()
Returns: self
| Name | Type | Purpose |
|---|---|---|
| None |
Frees the internal surface. Note, if you attempt to use the surface again it will be recreated.
| Jump To | top |
|---|
| Name | Type | Initial | Purpose |
|---|---|---|---|
| __Surface | int |
-1 | A pointer to the internal surface |
| __Redraw | bool |
false | when set to true, will trigger a surface redraw on the next frame |
| width | int |
_width | The width of the surface. Changing this will not resize the surface, use resize() instead. |
| height | int |
_height | The height of the surface. Changing this will not resize the surface, use resize() instead. |
Devon Mullane 2020