GM: surface exists

From GMpedia.org Wiki

Jump to: navigation, search
The correct title of this article is surface_exists(id). It appears incorrectly here because of technical restrictions.
The correct title of this article is surface_exists(). It appears incorrectly here because of technical restrictions.


Arguments

id = name of the variable which holds the ID of the surface (see surface_create).

Limitations

none.

Note: Please remove limitations and port them in the "Remarks" section at the end of the article.

This function returns whether or not does the surface with the given ID exists. It returns either a "1" or "true" if it exists, or a "0" or "false" if it does not exist.

[edit] Example

if surface_exists(surface)
{
 show_message("Surface Exists");
}
else
{
 show_message("Surface Does Not Exist!");
}

Or:

switch(surface_exists(surface)
{
 {GM|case}} 0: show_message("Surface does not exist!"); break;
 {GM|case}} 1: show_message("Surface exists!"); break;
}

[edit] See Also

This article was originally found at the Game Maker Knowledge Base, contributed by Eyas Sharaiha.
See the talk page for details
Personal tools