surface_save

This function will save a surface to disc using the given filename.

The surface must be saved as a *.png format file.

NOTE This function will only work with surfaces that use the surface_rgba8unorm (default) surface format.

 

Syntax:

surface_save(surface_id, fname);

ArgumentTypeDescription
surface_idSurfaceThe surface to set as the drawing target.
fnameStringThe name of the saved image file.

 

Returns:

N/A

 

Example:

if (keyboard_check_pressed(ord("S")))
{
    surface_save(surf, "test.png");
}

The above code will check to see if the user presses the "S" key on the keyboard and if they do it will save the surface indexed in the variable surf to disc.