draw_roundrect_colour

Draws a rectangle with rounded corners of a fixed radius, colouring it with a gradient of two colours.

Syntax:

draw_roundrect_colour(x1, y1, x2, y2, col1, col2, outline);


Argument Description
x1 The x coordinate of the left of the rounded rectangle.
y1 The y coordinate of the top of the rounded rectangle.
x2 The x coordinate of the right of the rounded rectangle.
y2 The y coordinate of the bottom of the rounded rectangle.
col1 The center colour.
col2 The outside edge colour.
outline Whether the rectangle is an outline (true) or filled in (false).


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. If it is filled you can define the individual colours for the centre and the edges, and if these colours are not the same, you will get a gradient effect from one to the other (the colour settings will over-ride the base colour set with the function draw_set_colour).You can define how precise the drawing of the corners is with the function draw_set_circle_precision, but the corners are always drawn with a fixed radius. Should you need to change the corner radius you should use the function draw_roundrect_colour_ext().

NOTE: If you are wanting to draw a shape using a shader, you should be aware that most shaders expect the following inputs: vertex, texture, Colour. However, when using this function, only vertex and colour data are being passed in, and so the shader may not draw anything (or draw something but not correctly). If you need to draw shapes in this way then the shader should be customised with this in mind.



Example:

draw_roundrect_colour(50, 50, 200, 200, c_black, c_white, false);

This would draw a filled-in square with rounded corners and with a smooth black/white gradient from the center to the edges.


Back: Drawing Basic Forms
Next: draw_roundrect_ext
© Copyright YoYo Games Ltd. 2018 All Rights Reserved