surface_get_target
This function gets the surface that's currently set as the drawing target.
A couple of values can be returned:
- If you created that surface using surface_create, then that surface will be returned.
- If no custom surface is set, but the default application surface is still enabled, then the function will return the application surface. However, if you've been manipulating the application surface previously you might wish to if this still matches the current value of the application_surface variable.
- If no custom surface is set and the default application surface has also been disabled, then the function will return -1.
Syntax:
surface_get_target();
Returns:
Surface or -1 (if no target surface is set)
Example:
if surface_get_target() != -1
{
surface_reset_target();
}
draw_surface(surf, 0, 0);
The above code checks to see if the current render target is a surface or not, resetting the drawing target if it is. The surface stored in the variable surf is then drawn.