mirror of https://github.com/axmolengine/axmol.git
82 lines
1.9 KiB
Plaintext
82 lines
1.9 KiB
Plaintext
|
|
#include "CCCommon.h"
|
|
|
|
namespace cocos2d {
|
|
|
|
typedef float CGFloat;
|
|
|
|
class CCPoint
|
|
{
|
|
public:
|
|
float x;
|
|
float y;
|
|
public:
|
|
CCPoint();
|
|
CCPoint(float x, float y);
|
|
static bool CCPointEqualToPoint(const CCPoint& point1, const CCPoint& point2);
|
|
};
|
|
|
|
class CCSize
|
|
{
|
|
public:
|
|
float width;
|
|
float height;
|
|
|
|
public:
|
|
CCSize();
|
|
CCSize(float width, float height);
|
|
static bool CCSizeEqualToSize(const CCSize& size1, const CCSize& size2);
|
|
};
|
|
|
|
class CCRect
|
|
{
|
|
public:
|
|
CCPoint origin;
|
|
CCSize size;
|
|
|
|
public:
|
|
CCRect();
|
|
CCRect(float x, float y, float width, float height);
|
|
|
|
public:
|
|
//! return the leftmost x-value of 'rect'
|
|
static CGFloat CCRectGetMinX(const CCRect& rect);
|
|
|
|
//! return the rightmost x-value of 'rect'
|
|
static CGFloat CCRectGetMaxX(const CCRect& rect);
|
|
|
|
//! return the midpoint x-value of 'rect'
|
|
static CGFloat CCRectGetMidX(const CCRect& rect);
|
|
|
|
//! Return the bottommost y-value of `rect'
|
|
static CGFloat CCRectGetMinY(const CCRect& rect);
|
|
|
|
//! Return the topmost y-value of `rect'
|
|
static CGFloat CCRectGetMaxY(const CCRect& rect);
|
|
|
|
//! Return the midpoint y-value of `rect'
|
|
static CGFloat CCRectGetMidY(const CCRect& rect);
|
|
|
|
static bool CCRectEqualToRect(const CCRect& rect1, const CCRect& rect2);
|
|
|
|
static bool CCRectContainsPoint(const CCRect& rect, const CCPoint& point);
|
|
|
|
static bool CCRectIntersectsRect(const CCRect& rectA, const CCRect& rectB);
|
|
};
|
|
|
|
/*
|
|
#define CCPointMake(x, y) CCPoint((x), (y))
|
|
#define CCSizeMake(width, height) CCSize((width), (height))
|
|
#define CCRectMake(x, y, width, height) CCRect((x), (y), (width), (height))
|
|
*/
|
|
CCPoint CCPointMake(float x, float y);
|
|
CCSize CCSizeMake(float width, float height);
|
|
CCRect CCRectMake(float x, float y, float width,float height);
|
|
/*
|
|
const CCPoint CCPointZero;
|
|
const CCSize CCSizeZero;
|
|
const CCRect CCRectZero;
|
|
*/
|
|
}//namespace cocos2d
|
|
|