Cocos2d-x  4.0.0
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Rect Class Reference

Rectangle area. More...

Public Member Functions

 Rect ()
 Constructor an empty Rect.
 
 Rect (float x, float y, float width, float height)
 Constructor a rect.
 
 Rect (const Vec2 &pos, const Size &dimension)
 Constructor a rect.
 
 Rect (const Rect &other)
 Copy constructor.
 
Rectoperator= (const Rect &other)
 NA NA
 
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
 return the leftmost x-value of current rect
 
float getMaxX () const
 return the midpoint x-value of current rect
 
float getMinY () const
 return the rightmost x-value of current rect
 
float getMidY () const
 return the bottommost y-value of current rect
 
float getMaxY () const
 return the midpoint y-value of current rect
 
bool equals (const Rect &rect) const
 return the topmost y-value of current rect
 
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.
 
Size 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 ( )

Constructor an empty Rect.

NA

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

Constructor a rect.

NA

Rect ( const Vec2 pos,
const Size &  dimension 
)

Constructor a rect.

NA

Rect ( const Rect other)

Copy constructor.

NA NA

Member Function Documentation

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

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

NA NA

float getMinX ( ) const

Get the left of the rect.

NA

float getMidX ( ) const

return the leftmost x-value of current rect

Get the X coordinate of center point. NA

float getMaxX ( ) const

return the midpoint x-value of current rect

Get the right of rect. NA

float getMinY ( ) const

return the rightmost x-value of current rect

Get the bottom of rect. NA

float getMidY ( ) const

return the bottommost y-value of current rect

Get the Y coordinate of center point. NA

float getMaxY ( ) const

return the midpoint y-value of current rect

Get top of rect. NA

bool equals ( const Rect rect) const

return the topmost y-value of current rect

Compare two rects. NA

bool containsPoint ( const Vec2 point) const

Check if the points is contained in the rect.

NA

bool intersectsRect ( const Rect rect) const

Check the intersect status of two rects.

NA

bool intersectsCircle ( const Vec2 center,
float  radius 
) const

Check the intersect status of the rect and a circle.

NA

Rect unionWithRect ( const Rect rect) const

Get the min rect which can contain this and rect.

NA NA

void merge ( const Rect rect)

Compute the min rect which can contain this and rect, assign it to this.

Member Data Documentation

Vec2 origin

Low left point of rect.

Size size

Width and height of the rect.

const Rect ZERO
static

An empty Rect.


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