draw_surface_stretched

Draws the surface stretched to an indicated region.

Syntax:

GML Code Example

draw_surface_stretched(index, x, y, w, h);


Argument Description
index The index of the surface to draw.
x The x position of where to draw the surface.
y The y position of where to draw the surface.
w The width at which to draw the surface.
h The height at which to draw the surface.


Returns: N/A


Description

This function simply takes a surface and stretches it over the given width and height so that it occupies the area. As with draw_surface you can specify a surface and then the x / y position in the room for the surface to be drawn at and finally a width and a height (which must be pixel values).

NOTE: When working with surfaces there is the possibility that they can cease to exist at any time due to them being stored in texture memory. You should ALWAYS check that a surface exists using surface_exists before referencing them directly. For further information see Surfaces.


Example:

GML Code Example

draw_surface_stretched(surf, 10, 10, 100, 100);

This will draw the surface indexed in the variable "surf" with its left corner at (10,10). Its width and height are both set to 100, which is how much space it will occupy regardless of the surface's actual width and height.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here