Cocos2d-x  v3.12
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
Size Class Reference

A size, which has width and height, could be used to represent the size in 2D. More...

Public Member Functions

 operator Vec2 () const
 Conversion from Vec2 to Size.
 
 Size ()
 Constructor.
 
 Size (float width, float height)
 Constructor. More...
 
 Size (const Size &other)
 Constructor.
 
 Size (const Vec2 &point)
 Constructor. More...
 
Sizeoperator= (const Size &other)
 assign another value to this.
 
Sizeoperator= (const Vec2 &point)
 assign another Vec2 value to this. More...
 
Size operator+ (const Size &right) const
 add another Size to this.
 
Size operator- (const Size &right) const
 substract another Size to this.
 
Size operator* (float a) const
 scale the size by a.
 
Size operator/ (float a) const
 shrink the size by a.
 
void setSize (float width, float height)
 Set the width and height of Size.
 
bool equals (const Size &target) const
 Check if two size is the same.
 

Public Attributes

float width
 Width of the Size.
 
float height
 Height of the Size.
 

Static Public Attributes

static const Size ZERO
 Size(0,0).
 

Detailed Description

A size, which has width and height, could be used to represent the size in 2D.

Constructor & Destructor Documentation

Size ( float  width,
float  height 
)

Constructor.

Width of the size. Height of the size.

Size ( const Vec2 point)
explicit

Constructor.

a point.

Member Function Documentation

Size& operator= ( const Vec2 point)

assign another Vec2 value to this.

A Vec2.


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