Rect

float x, float y, float w, float h,
float outlineWidth = 1.0,
float roundness = 0.0
float accuracy = [default] )

Creates a new rectangle with the specified position for the top-left corner, width and roundness.

Line width specifies the width of the outline of the rectangle (See DrawOutline). Accuracy parameter specifies the accuracy of the corners of a rounded rectangle.

Vec2D topleft, Vec2D size,
float lineWidth = 1.0,
float roundness = 0.0
float accuracy = [default] )

Same as above but the position and the size are specified with vectors.

Examples

// Create a new rectangle with top-left corner at x = 200.0, y = 100.0 //
// and size of 300.0 x 400.0 //
Rect myRectangle( 200.0100.0300.0400.0 );

// Render the rectangle to the drawing surface filled with white //
myRectangle.DrawRgba::WHITE );

// You can also create the rectangle and render it in a single line: //
Rect200.0100.0300.0400.0 ).DrawRgba::WHITE );

// Create a new rectangle by using vectors //
Vec2D topleft( 200.0100.0 );
Vec2D size( 300.0400.0 );

Rect myRectangle( topleft, size );

// Or the above with only a single line: //
Rect myRectangle( Vec2D200.0100.0 ), Vec2D300.0400.0 ));


Member functions
Draw
Draws a filled rectangle
DrawOutline
Draws an outline of the rectangle
SetAccuracy
Sets the accuracy of the rounded edges
SetRoundness
Sets the roundness of the corners

Parent Class


Questions about Rect? Click here.