This function resizes a surface to the given dimensions (in pixels).
The "surface_id" is that of a surface you have created previously, or the application_surface, and the function will resize that surface. Note that this will neither crop nor stretch the contents of the surface, but rather it destroys the current surface and recreates it with the same handle (surface_id) with the new dimensions, meaning that it will need to be cleared and drawn to again (unless it's the application_surface in which case GameMaker will do this automatically).
NOTE If you are resizing the application surface, these changes will not be registered until the start of the next draw frame, meaning that calling the surface_get_width or surface_get_height functions in the same event or step will return the previous values.
surface_resize(surface_id, w, h);
Argument | Type | Description |
---|---|---|
surface_id | Surface | The surface to resize. |
w | Real | The new width of the surface. |
h | Real | The new height of the surface. |
N/A
if view_wport[0] != surface_get_width(application_surface) || view_hport[0] != surface_get_height(application_surface)
{
surface_resize(application_surface, view_wport[0],view_hport[0]);
}
The above code checks the view port size against that of the application_surface surface. If it is different, the surface is resized.