draw_surface_part

Draws part of a surface.

Syntax:

GML Code Example

draw_surface_part( index, left, top, w, h, x, y );


Argument Description
index The index of the surface to draw.
left The left position in the surface of the part to be drawn.
top The top position in the surface of the part to be drawn.
width The width of the part to be draw, from left.
height The height of the part to be drawn, from top.
x The x position of where to draw the surface.
y The y position of where to draw the surface.


Returns: N/A


Description

With this function you can draw part of any surface at a given position within the room. As with draw_surface you can specify a surface, but you then need to specify the relative coordinates within the surface of an area to select for drawing. This means that a left position of 0 and a top position of 0 would be the top left corner of the surface and all further coordinates should be taken from that position.

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_part(surf, 8, 8, 32, 32, x, y);

This will draw a 32x32 area 8px by 8px in from the top left of the surface indexed in "surf", at the instances (x,y) position.





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