draw_roundrect

Draws a rectangle with rounded corners of a fixed radius.

Syntax:

GML Code Example

draw_roundrect(x1, y1, x2, y2, outline);


Argument Description
x1 The x coordinate of the top left corner of the rounded rectangle (as if it were a normal rectangle).
y1 The y coordinate of the top left corner of the rounded rectangle (as if it were a normal rectangle).
x2 The x coordinate of the bottom right corner of the rounded rectangle (as if it were a normal rectangle).
y2 The y coordinate of the bottom right corner of the rounded rectangle (as if it were a normal rectangle).
outline Whether the rounded rectangle is drawn filled (false) or as a one pixel wide outline (true).


Returns: N/A


Description

With this function you can draw either an outline of a rounded rectangle or a filled rounded rectangle where the (x1,y1) position is the top left corner and the (x2,y2) position is the bottom right corner. You can define how precise the drawing of the corners is with the function draw_set_circle_precision, but this function uses a fixed radius for them (should you need to change the corner radius, use the function draw_roundrect_ext()).


Example:

GML Code Example

draw_set_colour(c_lime);
 draw_roundrect(50, 100, 250, 200, 0);
 

This will draw a filled rounded rectangle, with its theoretical (before being curved) top left corner at (50,100) and its theoretical bottom right corner at (250,200).





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