Axmol Engine 2.4.0-258ceca
Loading...
Searching...
No Matches
Rect Class Reference

Rectangle area. More...

#include <Rect.h>

Public Member Functions

constexpr Rect ()
 Constructor an empty Rect.
 
constexpr Rect (float x, float y, float width, float height)
 Constructor a rect.
 
constexpr Rect (const Vec2 &pos, const Vec2 &dimension)
 Constructor a rect.
 
constexpr Rect (const Rect &other)
 Copy constructor.
 
Rectoperator= (const Rect &other)
 @js NA @lua NA
 
constexpr void setRect (float x, float y, float width, float height)
 Set the x, y, width and height of Rect.
 
float getMinX () const
 Get the left of the rect.
 
float getMidX () const
 Get the X coordinate of center point.
 
float getMaxX () const
 Get the right of rect.
 
float getMinY () const
 Get the bottom of rect.
 
float getMidY () const
 Get the Y coordinate of center point.
 
float getMaxY () const
 Get top of rect.
 
bool equals (const Rect &rect) const
 Compare two rects.
 
bool containsPoint (const Vec2 &point) const
 Check if the points is contained in the rect.
 
bool intersectsRect (const Rect &rect) const
 Check the intersect status of two rects.
 
bool intersectsCircle (const Vec2 &center, float radius) const
 Check the intersect status of the rect and a circle.
 
Rect unionWithRect (const Rect &rect) const
 Get the min rect which can contain this and rect.
 
void merge (const Rect &rect)
 Compute the min rect which can contain this and rect, assign it to this.
 

Public Attributes

Vec2 origin
 Low left point of rect.
 
Vec2 size
 Width and height of the rect.
 

Static Public Attributes

static const Rect ZERO
 An empty Rect.
 

Detailed Description

Rectangle area.

Constructor & Destructor Documentation

◆ Rect() [1/4]

Rect ( )
inlineconstexpr

Constructor an empty Rect.

@js NA

◆ Rect() [2/4]

Rect ( float x,
float y,
float width,
float height )
inlineconstexpr

Constructor a rect.

@js NA

◆ Rect() [3/4]

Rect ( const Vec2 & pos,
const Vec2 & dimension )
inlineconstexpr

Constructor a rect.

@js NA

◆ Rect() [4/4]

Rect ( const Rect & other)
inlineconstexpr

Copy constructor.

@js NA @lua NA

Member Function Documentation

◆ setRect()

void setRect ( float x,
float y,
float width,
float height )
inlineconstexpr

Set the x, y, width and height of Rect.

@js NA @lua NA

◆ getMinX()

float getMinX ( ) const
inline

Get the left of the rect.

@js NA return the leftmost x-value of current rect

◆ getMidX()

float getMidX ( ) const
inline

Get the X coordinate of center point.

@js NA return the midpoint x-value of current rect

◆ getMaxX()

float getMaxX ( ) const
inline

Get the right of rect.

@js NA return the rightmost x-value of current rect

◆ getMinY()

float getMinY ( ) const
inline

Get the bottom of rect.

@js NA return the bottommost y-value of current rect

◆ getMidY()

float getMidY ( ) const
inline

Get the Y coordinate of center point.

@js NA return the midpoint y-value of current rect

◆ getMaxY()

float getMaxY ( ) const
inline

Get top of rect.

@js NA return the topmost y-value of current rect

◆ equals()

bool equals ( const Rect & rect) const
inline

Compare two rects.

@js NA

◆ containsPoint()

bool containsPoint ( const Vec2 & point) const
inline

Check if the points is contained in the rect.

@js NA

◆ intersectsRect()

bool intersectsRect ( const Rect & rect) const
inline

Check the intersect status of two rects.

@js NA

◆ intersectsCircle()

bool intersectsCircle ( const Vec2 & center,
float radius ) const

Check the intersect status of the rect and a circle.

@js NA

◆ unionWithRect()

Rect unionWithRect ( const Rect & rect) const

Get the min rect which can contain this and rect.

@js NA @lua NA


The documentation for this class was generated from the following file: