cocos2d-x  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Rect Class Reference

Rectangle area. More...

#include <CCGeometry.h>

Public Member Functions

 Rect ()
 Constructor an empty Rect. More...
 
 Rect (float x, float y, float width, float height)
 Constructor a rect. More...
 
 Rect ( local x, local y, local width, local height)
 Constructor a rect. More...
 
 Rect (const Rect &other)
 Copy constructor. More...
 
Rectoperator= (const Rect &other)
void setRect (float x, float y, float width, float height)
 Set the x, y, width and height of Rect. More...
 
float getMinX () const
 Get the left of the rect. More...
 
local getMinX ()
 Get the left of the rect. More...
 
float getMidX () const
 return the leftmost x-value of current rect More...
 
local getMidX ()
 return the leftmost x-value of current rect More...
 
float getMaxX () const
 return the midpoint x-value of current rect More...
 
local getMaxX ()
 return the midpoint x-value of current rect More...
 
float getMinY () const
 return the rightmost x-value of current rect More...
 
local getMinY ()
 return the rightmost x-value of current rect More...
 
float getMidY () const
 return the bottommost y-value of current rect More...
 
local getMidY ()
 return the bottommost y-value of current rect More...
 
float getMaxY () const
 return the midpoint y-value of current rect More...
 
local getMaxY ()
 return the midpoint y-value of current rect More...
 
bool equals (const Rect &rect) const
 return the topmost y-value of current rect More...
 
local equals ( local rect)
 return the topmost y-value of current rect More...
 
bool containsPoint (const Vec2 &point) const
 Check if the points is contained in the rect. More...
 
local containsPoint ( local point)
 Check if the points is contained in the rect. More...
 
bool intersectsRect (const Rect &rect) const
 Check the intersect status of two rects. More...
 
local intersectsRect ( local rect)
 Check the intersect status of two rects. More...
 
Rect unionWithRect (const Rect &rect) const
 Get the min rect which can contain this and rect. More...
 
void merge (const Rect &rect)
 Compute the min rect which can contain this and rect, assign it to this. More...
 

Public Attributes

Vec2 origin
 Low left point of rect. More...
 
var origin
 Low left point of rect. More...
 
local origin
 Low left point of rect. More...
 
Size size
 Width and height of the rect. More...
 
var size
 Width and height of the rect. More...
 
local size
 Width and height of the rect. More...
 

Static Public Attributes

static const Rect ZERO
 An empty Rect. More...
 

Detailed Description

Rectangle area.

Constructor & Destructor Documentation

Rect ( )

Constructor an empty Rect.

local Rect ( )

Constructor an empty Rect.

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

Constructor a rect.

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

Constructor a rect.

Rect ( const Rect other)

Copy constructor.

Member Function Documentation

bool containsPoint ( const Vec2 point) const

Check if the points is contained in the rect.

local containsPoint ( local  point)

Check if the points is contained in the rect.

bool equals ( const Rect rect) const

return the topmost y-value of current rect

Compare two rects.

local equals ( local  rect)

return the topmost y-value of current rect

Compare two rects.

float getMaxX ( ) const

return the midpoint x-value of current rect

Get the right of rect.

local getMaxX ( )

return the midpoint x-value of current rect

Get the right of rect.

float getMaxY ( ) const

return the midpoint y-value of current rect

Get top of rect.

local getMaxY ( )

return the midpoint y-value of current rect

Get top of rect.

float getMidX ( ) const

return the leftmost x-value of current rect

Get the X coordinate of center point.

local getMidX ( )

return the leftmost x-value of current rect

Get the X coordinate of center point.

float getMidY ( ) const

return the bottommost y-value of current rect

Get the Y coordinate of center point.

local getMidY ( )

return the bottommost y-value of current rect

Get the Y coordinate of center point.

float getMinX ( ) const

Get the left of the rect.

local getMinX ( )

Get the left of the rect.

float getMinY ( ) const

return the rightmost x-value of current rect

Get the bottom of rect.

local getMinY ( )

return the rightmost x-value of current rect

Get the bottom of rect.

bool intersectsRect ( const Rect rect) const

Check the intersect status of two rects.

local intersectsRect ( local  rect)

Check the intersect status of two rects.

void merge ( const Rect rect)

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

var merge ( var  rect)

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

local merge ( local  rect)

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

Rect& operator= ( const Rect other)
void setRect ( float  x,
float  y,
float  width,
float  height 
)

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

Rect unionWithRect ( const Rect rect) const

Get the min rect which can contain this and rect.

Member Data Documentation

Vec2 origin

Low left point of rect.

var origin

Low left point of rect.

local origin

Low left point of rect.

Size size

Width and height of the rect.

var size

Width and height of the rect.

local size

Width and height of the rect.

const Rect ZERO
static

An empty Rect.

var ZERO
static

An empty Rect.

local ZERO
static

An empty Rect.


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