replace Point with Vector2

This commit is contained in:
Huabing.Xu 2014-04-15 18:08:29 +08:00
parent 917ae6e88b
commit e2a24dec84
67 changed files with 478 additions and 1165 deletions

View File

@ -277,8 +277,8 @@ protected:
bool _boundaryFullyCovered;
// fast access to the screen dimensions
Point _halfScreenSize;
Point _fullScreenSize;
Vector2 _halfScreenSize;
Vector2 _fullScreenSize;
// world boundaries
float _leftBoundary;

View File

@ -80,22 +80,22 @@ public:
/** appends a control point
* @js NA
*/
void addControlPoint(Point controlPoint);
void addControlPoint(Vector2 controlPoint);
/** inserts a controlPoint at index
* @js NA
*/
void insertControlPoint(Point &controlPoint, ssize_t index);
void insertControlPoint(Vector2 &controlPoint, ssize_t index);
/** replaces an existing controlPoint at index
* @js NA
*/
void replaceControlPoint(Point &controlPoint, ssize_t index);
void replaceControlPoint(Vector2 &controlPoint, ssize_t index);
/** get the value of a controlPoint at a given index
* @js NA
*/
Point getControlPointAtIndex(ssize_t index);
Vector2 getControlPointAtIndex(ssize_t index);
/** deletes a control point at a given index
* @js NA
@ -124,14 +124,14 @@ public:
/**
* @js NA
*/
const std::vector<Point*>* getControlPoints() const;
const std::vector<Vector2*>* getControlPoints() const;
/**
* @js NA
*/
void setControlPoints(std::vector<Point*> *controlPoints);
void setControlPoints(std::vector<Vector2*> *controlPoints);
private:
/** Array that contains the control points */
std::vector<Point*> *_controlPoints;
std::vector<Vector2*> *_controlPoints;
};
/** Cardinal Spline path.
@ -164,7 +164,7 @@ public:
/** initializes the action with a duration and an array of points */
bool initWithDuration(float duration, PointArray* points, float tension);
virtual void updatePosition(Point &newPos);
virtual void updatePosition(Vector2 &newPos);
inline PointArray* getPoints() { return _points; }
/**
@ -189,8 +189,8 @@ protected:
PointArray *_points;
float _deltaT;
float _tension;
Point _previousPosition;
Point _accumulatedDiff;
Vector2 _previousPosition;
Vector2 _accumulatedDiff;
};
/** Cardinal Spline path.
@ -214,12 +214,12 @@ public:
// Overrides
virtual void startWithTarget(Node *target) override;
virtual void updatePosition(Point &newPos) override;
virtual void updatePosition(Vector2 &newPos) override;
virtual CardinalSplineBy *clone() const override;
virtual CardinalSplineBy* reverse() const override;
protected:
Point _startPosition;
Vector2 _startPosition;
};
/** An action that moves the target with a CatmullRom curve to a destination point.
@ -275,7 +275,7 @@ public:
};
/** Returns the Cardinal Spline position for a given set of control points, tension and time */
extern CC_DLL Point ccCardinalSplineAt(Point &p0, Point &p1, Point &p2, Point &p3, float tension, float t);
extern CC_DLL Vector2 ccCardinalSplineAt(Vector2 &p0, Vector2 &p1, Vector2 &p2, Vector2 &p3, float tension, float t);
// end of actions group
/// @}

View File

@ -82,31 +82,31 @@ public:
* @js NA
* @lua NA
*/
Vector3 getVertex(const Point& position) const;
Vector3 getVertex(const Vector2& position) const;
/** @deprecated Use getVertex() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE inline Vector3 vertex(const Point& position) { return getVertex(position); }
CC_DEPRECATED_ATTRIBUTE inline Vector3 vertex(const Vector2& position) { return getVertex(position); }
/** returns the non-transformed vertex than belongs to certain position in the grid
* @js NA
* @lua NA
*/
Vector3 getOriginalVertex(const Point& position) const;
Vector3 getOriginalVertex(const Vector2& position) const;
/** @deprecated Use getOriginalVertex() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE inline Vector3 originalVertex(const Point& position) { return getOriginalVertex(position); }
CC_DEPRECATED_ATTRIBUTE inline Vector3 originalVertex(const Vector2& position) { return getOriginalVertex(position); }
/** sets a new vertex to a certain position of the grid
* @js NA
* @lua NA
*/
void setVertex(const Point& position, const Vector3& vertex);
void setVertex(const Vector2& position, const Vector3& vertex);
// Overrides
virtual Grid3DAction * clone() const override = 0;
@ -126,31 +126,31 @@ public:
* @js NA
* @lua NA
*/
Quad3 getTile(const Point& position) const;
Quad3 getTile(const Vector2& position) const;
/** @deprecated Use getTile() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE Quad3 tile(const Point& position) { return getTile(position); }
CC_DEPRECATED_ATTRIBUTE Quad3 tile(const Vector2& position) { return getTile(position); }
/** returns the non-transformed tile that belongs to a certain position of the grid
* @js NA
* @lua NA
*/
Quad3 getOriginalTile(const Point& position) const;
Quad3 getOriginalTile(const Vector2& position) const;
/** @deprecated Use getOriginalTile() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE Quad3 originalTile(const Point& position) { return getOriginalTile(position); }
CC_DEPRECATED_ATTRIBUTE Quad3 originalTile(const Vector2& position) { return getOriginalTile(position); }
/** sets a new tile to a certain position of the grid
* @js NA
* @lua NA
*/
void setTile(const Point& position, const Quad3& coords);
void setTile(const Vector2& position, const Quad3& coords);
/** returns the grid */
virtual GridBase* getGrid();

View File

@ -120,7 +120,7 @@ class CC_DLL Lens3D : public Grid3DAction
{
public:
/** creates the action with center position, radius, a grid size and duration */
static Lens3D* create(float duration, const Size& gridSize, const Point& position, float radius);
static Lens3D* create(float duration, const Size& gridSize, const Vector2& position, float radius);
/** Get lens center position */
inline float getLensEffect() const { return _lensEffect; }
@ -141,7 +141,7 @@ CC_CONSTRUCTOR_ACCESS:
virtual ~Lens3D() {}
/** initializes the action with center position, radius, a grid size and duration */
bool initWithDuration(float duration, const Size& gridSize, const Point& position, float radius);
bool initWithDuration(float duration, const Size& gridSize, const Vector2& position, float radius);
protected:
/* lens center position */
@ -163,7 +163,7 @@ class CC_DLL Ripple3D : public Grid3DAction
{
public:
/** creates the action with radius, number of waves, amplitude, a grid size and duration */
static Ripple3D* create(float duration, const Size& gridSize, const Point& position, float radius, unsigned int waves, float amplitude);
static Ripple3D* create(float duration, const Size& gridSize, const Vector2& position, float radius, unsigned int waves, float amplitude);
/** get center position */
inline const Vector2& getPosition() const { return _position; }
@ -185,7 +185,7 @@ CC_CONSTRUCTOR_ACCESS:
virtual ~Ripple3D() {}
/** initializes the action with radius, number of waves, amplitude, a grid size and duration */
bool initWithDuration(float duration, const Size& gridSize, const Point& position, float radius, unsigned int waves, float amplitude);
bool initWithDuration(float duration, const Size& gridSize, const Vector2& position, float radius, unsigned int waves, float amplitude);
protected:
/* center position */
@ -298,7 +298,7 @@ class CC_DLL Twirl : public Grid3DAction
{
public:
/** creates the action with center position, number of twirls, amplitude, a grid size and duration */
static Twirl* create(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);
static Twirl* create(float duration, const Size& gridSize, Vector2 position, unsigned int twirls, float amplitude);
/** get twirl center */
inline const Vector2& getPosition() const { return _position; }
@ -321,7 +321,7 @@ CC_CONSTRUCTOR_ACCESS:
virtual ~Twirl() {}
/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
bool initWithDuration(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);
bool initWithDuration(float duration, const Size& gridSize, Vector2 position, unsigned int twirls, float amplitude);
protected:
/* twirl center */

View File

@ -228,7 +228,7 @@ class CC_DLL Place : public ActionInstant //<NSCopying>
public:
/** creates a Place action with a position */
static Place * create(const Point& pos);
static Place * create(const Vector2& pos);
//
// Overrides
@ -242,10 +242,10 @@ CC_CONSTRUCTOR_ACCESS:
virtual ~Place(){}
/** Initializes a Place action with a position */
bool initWithPosition(const Point& pos);
bool initWithPosition(const Vector2& pos);
protected:
Point _position;
Vector2 _position;
private:
CC_DISALLOW_COPY_AND_ASSIGN(Place);

View File

@ -413,7 +413,7 @@ class CC_DLL MoveBy : public ActionInterval
{
public:
/** creates the action */
static MoveBy* create(float duration, const Point& deltaPosition);
static MoveBy* create(float duration, const Vector2& deltaPosition);
//
// Overrides
@ -428,12 +428,12 @@ CC_CONSTRUCTOR_ACCESS:
virtual ~MoveBy() {}
/** initializes the action */
bool initWithDuration(float duration, const Point& deltaPosition);
bool initWithDuration(float duration, const Vector2& deltaPosition);
protected:
Point _positionDelta;
Point _startPosition;
Point _previousPosition;
Vector2 _positionDelta;
Vector2 _startPosition;
Vector2 _previousPosition;
private:
CC_DISALLOW_COPY_AND_ASSIGN(MoveBy);
@ -448,7 +448,7 @@ class CC_DLL MoveTo : public MoveBy
{
public:
/** creates the action */
static MoveTo* create(float duration, const Point& position);
static MoveTo* create(float duration, const Vector2& position);
//
// Overrides
@ -461,10 +461,10 @@ CC_CONSTRUCTOR_ACCESS:
virtual ~MoveTo() {}
/** initializes the action */
bool initWithDuration(float duration, const Point& position);
bool initWithDuration(float duration, const Vector2& position);
protected:
Point _endPosition;
Vector2 _endPosition;
private:
CC_DISALLOW_COPY_AND_ASSIGN(MoveTo);
@ -539,7 +539,7 @@ class CC_DLL JumpBy : public ActionInterval
{
public:
/** creates the action */
static JumpBy* create(float duration, const Point& position, float height, int jumps);
static JumpBy* create(float duration, const Vector2& position, float height, int jumps);
//
// Overrides
@ -554,14 +554,14 @@ CC_CONSTRUCTOR_ACCESS:
virtual ~JumpBy() {}
/** initializes the action */
bool initWithDuration(float duration, const Point& position, float height, int jumps);
bool initWithDuration(float duration, const Vector2& position, float height, int jumps);
protected:
Point _startPosition;
Point _delta;
Vector2 _startPosition;
Vector2 _delta;
float _height;
int _jumps;
Point _previousPos;
Vector2 _previousPos;
private:
CC_DISALLOW_COPY_AND_ASSIGN(JumpBy);
@ -573,7 +573,7 @@ class CC_DLL JumpTo : public JumpBy
{
public:
/** creates the action */
static JumpTo* create(float duration, const Point& position, float height, int jumps);
static JumpTo* create(float duration, const Vector2& position, float height, int jumps);
//
// Override
@ -592,11 +592,11 @@ private:
*/
typedef struct _ccBezierConfig {
//! end position of the bezier
Point endPosition;
Vector2 endPosition;
//! Bezier control point 1
Point controlPoint_1;
Vector2 controlPoint_1;
//! Bezier control point 2
Point controlPoint_2;
Vector2 controlPoint_2;
} ccBezierConfig;
/** @brief An action that moves the target with a cubic Bezier curve by a certain distance.
@ -630,8 +630,8 @@ CC_CONSTRUCTOR_ACCESS:
protected:
ccBezierConfig _config;
Point _startPosition;
Point _previousPosition;
Vector2 _startPosition;
Vector2 _previousPosition;
private:
CC_DISALLOW_COPY_AND_ASSIGN(BezierBy);

View File

@ -100,7 +100,7 @@ public:
void shuffle(unsigned int *array, unsigned int len);
Size getDelta(const Size& pos) const;
void placeTile(const Point& pos, Tile *t);
void placeTile(const Vector2& pos, Tile *t);
// Overrides
virtual void startWithTarget(Node *target) override;
@ -134,9 +134,9 @@ public:
static FadeOutTRTiles* create(float duration, const Size& gridSize);
virtual float testFunc(const Size& pos, float time);
void turnOnTile(const Point& pos);
void turnOffTile(const Point& pos);
virtual void transformTile(const Point& pos, float distance);
void turnOnTile(const Vector2& pos);
void turnOffTile(const Vector2& pos);
virtual void transformTile(const Vector2& pos, float distance);
// Overrides
virtual void update(float time) override;
@ -180,7 +180,7 @@ public:
/** creates the action with the grid size and the duration */
static FadeOutUpTiles* create(float duration, const Size& gridSize);
virtual void transformTile(const Point& pos, float distance);
virtual void transformTile(const Vector2& pos, float distance);
// Overrides
virtual FadeOutUpTiles* clone() const override;
@ -227,8 +227,8 @@ public:
static TurnOffTiles* create(float duration, const Size& gridSize, unsigned int seed);
void shuffle(unsigned int *array, unsigned int len);
void turnOnTile(const Point& pos);
void turnOffTile(const Point& pos);
void turnOnTile(const Vector2& pos);
void turnOffTile(const Vector2& pos);
// Overrides
virtual TurnOffTiles* clone() const override;

View File

@ -50,10 +50,10 @@ public:
static DrawNode* create();
/** draw a dot at a position, with a given radius and color */
void drawDot(const Point &pos, float radius, const Color4F &color);
void drawDot(const Vector2 &pos, float radius, const Color4F &color);
/** draw a segment with a radius and color */
void drawSegment(const Point &from, const Point &to, float radius, const Color4F &color);
void drawSegment(const Vector2 &from, const Vector2 &to, float radius, const Color4F &color);
/** draw a polygon with a fill color and line color
* @code
@ -62,16 +62,16 @@ public:
* In lua:local drawPolygon(local pointTable,local tableCount,local fillColor,local width,local borderColor)
* @endcode
*/
void drawPolygon(Point *verts, int count, const Color4F &fillColor, float borderWidth, const Color4F &borderColor);
void drawPolygon(Vector2 *verts, int count, const Color4F &fillColor, float borderWidth, const Color4F &borderColor);
/** draw a triangle with color */
void drawTriangle(const Point &p1, const Point &p2, const Point &p3, const Color4F &color);
void drawTriangle(const Vector2 &p1, const Vector2 &p2, const Vector2 &p3, const Color4F &color);
/** draw a cubic bezier curve with color and number of segments */
void drawCubicBezier(const Point& from, const Point& control1, const Point& control2, const Point& to, unsigned int segments, const Color4F &color);
void drawCubicBezier(const Vector2& from, const Vector2& control1, const Vector2& control2, const Vector2& to, unsigned int segments, const Color4F &color);
/** draw a quadratic bezier curve with color and number of segments */
void drawQuadraticBezier(const Point& from, const Point& control, const Point& to, unsigned int segments, const Color4F &color);
void drawQuadraticBezier(const Vector2& from, const Vector2& control, const Vector2& to, unsigned int segments, const Color4F &color);
/** Clear the geometry in the node's buffer. */
void clear();

View File

@ -63,7 +63,7 @@ THE SOFTWARE.
- ccPointSize()
- glLineWidth()
@warning These functions draws the Line, Point, Polygon, immediately. They aren't batched. If you are going to make a game that depends on these primitives, I suggest creating a batch. Instead you should use DrawNode
@warning These functions draws the Line, Vector2, Polygon, immediately. They aren't batched. If you are going to make a game that depends on these primitives, I suggest creating a batch. Instead you should use DrawNode
*/

View File

@ -38,7 +38,7 @@ class CC_DLL FontAtlasCache
{
public:
static FontAtlas * getFontAtlasTTF(const TTFConfig & config);
static FontAtlas * getFontAtlasFNT(const std::string& fontFileName, const Point& imageOffset = Point::ZERO);
static FontAtlas * getFontAtlasFNT(const std::string& fontFileName, const Vector2& imageOffset = Vector2::ZERO);
static FontAtlas * getFontAtlasCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap);
static FontAtlas * getFontAtlasCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);

View File

@ -37,7 +37,7 @@ class FontFNT : public Font
public:
static FontFNT * create(const std::string& fntFilePath, const Point& imageOffset = Point::ZERO);
static FontFNT * create(const std::string& fntFilePath, const Vector2& imageOffset = Vector2::ZERO);
/** Purges the cached data.
Removes from memory the cached configurations and the atlas name dictionary.
*/
@ -47,7 +47,7 @@ public:
protected:
FontFNT(BMFontConfiguration *theContfig, const Point& imageOffset = Point::ZERO);
FontFNT(BMFontConfiguration *theContfig, const Vector2& imageOffset = Vector2::ZERO);
/**
* @js NA
* @lua NA
@ -59,7 +59,7 @@ private:
int getHorizontalKerningForChars(unsigned short firstChar, unsigned short secondChar) const;
BMFontConfiguration * _configuration;
Point _imageOffset;
Vector2 _imageOffset;
};

View File

@ -78,8 +78,8 @@ public:
inline void setGridSize(const Size& gridSize) { _gridSize = gridSize; }
/** pixels between the grids */
inline const Point& getStep(void) const { return _step; }
inline void setStep(const Point& step) { _step = step; }
inline const Vector2& getStep(void) const { return _step; }
inline void setStep(const Vector2& step) { _step = step; }
/** is texture flipped */
inline bool isTextureFlipped(void) const { return _isTextureFlipped; }
@ -98,7 +98,7 @@ protected:
int _reuseGrid;
Size _gridSize;
Texture2D *_texture;
Point _step;
Vector2 _step;
Grabber *_grabber;
bool _isTextureFlipped;
GLProgram* _shaderProgram;
@ -132,28 +132,28 @@ public:
* @js NA
* @lua NA
*/
Vector3 getVertex(const Point& pos) const;
Vector3 getVertex(const Vector2& pos) const;
/** @deprecated Use getVertex() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE Vector3 vertex(const Point& pos) const { return getVertex(pos); }
CC_DEPRECATED_ATTRIBUTE Vector3 vertex(const Vector2& pos) const { return getVertex(pos); }
/** returns the original (non-transformed) vertex at a given position
* @js NA
* @lua NA
*/
Vector3 getOriginalVertex(const Point& pos) const;
Vector3 getOriginalVertex(const Vector2& pos) const;
/** @deprecated Use getOriginalVertex() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE Vector3 originalVertex(const Point& pos) const { return getOriginalVertex(pos); }
CC_DEPRECATED_ATTRIBUTE Vector3 originalVertex(const Vector2& pos) const { return getOriginalVertex(pos); }
/** sets a new vertex at a given position
* @js NA
* @lua NA
*/
void setVertex(const Point& pos, const Vector3& vertex);
void setVertex(const Vector2& pos, const Vector3& vertex);
// Overrides
virtual void blit() override;
@ -195,28 +195,28 @@ public:
* @js NA
* @lua NA
*/
Quad3 getTile(const Point& pos) const;
Quad3 getTile(const Vector2& pos) const;
/** returns the tile at the given position
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE Quad3 tile(const Point& pos) const { return getTile(pos); }
CC_DEPRECATED_ATTRIBUTE Quad3 tile(const Vector2& pos) const { return getTile(pos); }
/** returns the original tile (untransformed) at the given position
* @js NA
* @lua NA
*/
Quad3 getOriginalTile(const Point& pos) const;
Quad3 getOriginalTile(const Vector2& pos) const;
/** returns the original tile (untransformed) at the given position
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE Quad3 originalTile(const Point& pos) const { return getOriginalTile(pos); }
CC_DEPRECATED_ATTRIBUTE Quad3 originalTile(const Vector2& pos) const { return getOriginalTile(pos); }
/** sets a new tile
* @js NA
* @lua NA
*/
void setTile(const Point& pos, const Quad3& coords);
void setTile(const Vector2& pos, const Quad3& coords);
// Overrides
virtual void blit() override;

View File

@ -104,7 +104,7 @@ public:
/* Creates a label with an FNT file,an initial string,horizontal alignment,max line width and the offset of image*/
static Label* createWithBMFont(const std::string& bmfontFilePath, const std::string& text,
const TextHAlignment& alignment = TextHAlignment::LEFT, int maxLineWidth = 0,
const Point& imageOffset = Point::ZERO);
const Vector2& imageOffset = Vector2::ZERO);
static Label * createWithCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap);
static Label * createWithCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
@ -114,7 +114,7 @@ public:
virtual bool setTTFConfig(const TTFConfig& ttfConfig);
virtual const TTFConfig& getTTFConfig() const { return _fontConfig;}
virtual bool setBMFontFilePath(const std::string& bmfontFilePath, const Point& imageOffset = Point::ZERO);
virtual bool setBMFontFilePath(const std::string& bmfontFilePath, const Vector2& imageOffset = Vector2::ZERO);
const std::string& getBMFontFilePath() const { return _bmFontPath;}
virtual bool setCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap);
@ -254,7 +254,7 @@ protected:
{
FontLetterDefinition def;
Point position;
Vector2 position;
Size contentSize;
int atlasIndex;
};
@ -279,7 +279,7 @@ protected:
virtual void setFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled = false, bool useA8Shader = false);
bool recordLetterInfo(const cocos2d::Point& point,const FontLetterDefinition& letterDef, int spriteIndex);
bool recordLetterInfo(const cocos2d::Vector2& point,const FontLetterDefinition& letterDef, int spriteIndex);
bool recordPlaceholderInfo(int spriteIndex);
void setFontScale(float fontScale);

View File

@ -82,14 +82,14 @@ public:
virtual ~LabelBMFont();
/** creates a bitmap font atlas with an initial string and the FNT file */
static LabelBMFont * create(const std::string& str, const std::string& fntFile, float width = 0, TextHAlignment alignment = TextHAlignment::LEFT,const Point& imageOffset = Point::ZERO);
static LabelBMFont * create(const std::string& str, const std::string& fntFile, float width = 0, TextHAlignment alignment = TextHAlignment::LEFT,const Vector2& imageOffset = Vector2::ZERO);
/** Creates an label.
*/
static LabelBMFont * create();
/** init a bitmap font atlas with an initial string and the FNT file */
bool initWithString(const std::string& str, const std::string& fntFile, float width = 0, TextHAlignment alignment = TextHAlignment::LEFT,const Point& imageOffset = Point::ZERO);
bool initWithString(const std::string& str, const std::string& fntFile, float width = 0, TextHAlignment alignment = TextHAlignment::LEFT,const Vector2& imageOffset = Vector2::ZERO);
// super method
virtual void setString(const std::string& newString) override;
@ -104,7 +104,7 @@ public:
virtual bool isOpacityModifyRGB() const;
virtual void setOpacityModifyRGB(bool isOpacityModifyRGB);
void setFntFile(const std::string& fntFile, const Point& imageOffset = Point::ZERO);
void setFntFile(const std::string& fntFile, const Vector2& imageOffset = Vector2::ZERO);
const std::string& getFntFile() const;
virtual void setBlendFunc(const BlendFunc &blendFunc) override;

View File

@ -343,7 +343,7 @@ public:
static LayerGradient* create(const Color4B& start, const Color4B& end);
/** Creates a full-screen Layer with a gradient between start and end in the direction of v. */
static LayerGradient* create(const Color4B& start, const Color4B& end, const Point& v);
static LayerGradient* create(const Color4B& start, const Color4B& end, const Vector2& v);
/** Whether or not the interpolation will be compressed in order to display all the colors of the gradient both in canonical and non canonical vectors
Default: true
@ -374,9 +374,9 @@ public:
/** Sets the directional vector that will be used for the gradient.
The default value is vertical direction (0,-1).
*/
void setVector(const Point& alongVector);
void setVector(const Vector2& alongVector);
/** Returns the directional vector used for the gradient */
const Point& getVector() const;
const Vector2& getVector() const;
virtual std::string getDescription() const override;
@ -395,7 +395,7 @@ CC_CONSTRUCTOR_ACCESS:
* @js init
* @lua init
*/
bool initWithColor(const Color4B& start, const Color4B& end, const Point& v);
bool initWithColor(const Color4B& start, const Color4B& end, const Vector2& v);
protected:
virtual void updateColor() override;
@ -404,7 +404,7 @@ protected:
Color3B _endColor;
GLubyte _startOpacity;
GLubyte _endOpacity;
Point _alongVector;
Vector2 _alongVector;
bool _compressedInterpolation;
};

View File

@ -139,7 +139,7 @@ protected:
unsigned int _previousNuPoints;
/** Pointers */
Point* _pointVertexes;
Vector2* _pointVertexes;
float* _pointState;
// Opengl

View File

@ -53,7 +53,7 @@ public:
// prevents compiler warning: "Included function hides overloaded virtual functions"
using Node::addChild;
void addChild(Node * child, int z, const Point& parallaxRatio, const Point& positionOffset);
void addChild(Node * child, int z, const Vector2& parallaxRatio, const Vector2& positionOffset);
/** Sets an array of layers for the Parallax node */
void setParallaxArray( struct _ccArray *parallaxArray) { _parallaxArray = parallaxArray; }
@ -82,9 +82,9 @@ protected:
*/
virtual ~ParallaxNode();
Point absolutePosition();
Vector2 absolutePosition();
Point _lastPosition;
Vector2 _lastPosition;
struct _ccArray* _parallaxArray;
private:

View File

@ -45,8 +45,8 @@ class ParticleBatchNode;
Structure that contains the values of each particle
*/
typedef struct sParticle {
Point pos;
Point startPos;
Vector2 pos;
Vector2 startPos;
Color4F color;
Color4F deltaColor;
@ -63,7 +63,7 @@ typedef struct sParticle {
//! Mode A: gravity, direction, radial accel, tangential accel
struct {
Point dir;
Vector2 dir;
float radialAccel;
float tangentialAccel;
} modeA;
@ -78,7 +78,7 @@ typedef struct sParticle {
}tParticle;
//typedef void (*CC_UPDATE_PARTICLE_IMP)(id, SEL, tParticle*, Point);
//typedef void (*CC_UPDATE_PARTICLE_IMP)(id, SEL, tParticle*, Vector2);
class Texture2D;
@ -192,7 +192,7 @@ public:
bool isFull();
//! should be overridden by subclasses
virtual void updateQuadWithParticle(tParticle* particle, const Point& newPosition);
virtual void updateQuadWithParticle(tParticle* particle, const Vector2& newPosition);
//! should be overridden by subclasses
virtual void postStep();
@ -202,8 +202,8 @@ public:
virtual void setAutoRemoveOnFinish(bool var);
// mode A
virtual const Point& getGravity();
virtual void setGravity(const Point& g);
virtual const Vector2& getGravity();
virtual void setGravity(const Vector2& g);
virtual float getSpeed() const;
virtual void setSpeed(float speed);
virtual float getSpeedVar() const;
@ -256,12 +256,12 @@ public:
inline void setDuration(float duration) { _duration = duration; };
/** sourcePosition of the emitter */
inline const Point& getSourcePosition() const { return _sourcePosition; };
inline void setSourcePosition(const Point& pos) { _sourcePosition = pos; };
inline const Vector2& getSourcePosition() const { return _sourcePosition; };
inline void setSourcePosition(const Vector2& pos) { _sourcePosition = pos; };
/** Position variance of the emitter */
inline const Point& getPosVar() const { return _posVar; };
inline void setPosVar(const Point& pos) { _posVar = pos; };
inline const Vector2& getPosVar() const { return _posVar; };
inline void setPosVar(const Vector2& pos) { _posVar = pos; };
/** life, and life variation of each particle */
inline float getLife() const { return _life; };
@ -432,7 +432,7 @@ protected:
//! Mode A:Gravity + Tangential Accel + Radial Accel
struct {
/** Gravity value. Only available in 'Gravity' mode. */
Point gravity;
Vector2 gravity;
/** speed of each particle. Only available in 'Gravity' mode. */
float speed;
/** speed variance of each particle. Only available in 'Gravity' mode. */
@ -503,9 +503,9 @@ protected:
/** How many seconds the emitter will run. -1 means 'forever' */
float _duration;
/** sourcePosition of the emitter */
Point _sourcePosition;
Vector2 _sourcePosition;
/** Position variance of the emitter */
Point _posVar;
Vector2 _posVar;
/** life, and life variation of each particle */
float _life;
/** life variance of each particle */

View File

@ -94,7 +94,7 @@ public:
* @js NA
* @lua NA
*/
virtual void updateQuadWithParticle(tParticle* particle, const Point& newPosition) override;
virtual void updateQuadWithParticle(tParticle* particle, const Vector2& newPosition) override;
/**
* @js NA
* @lua NA

View File

@ -91,24 +91,24 @@ public:
* If you're using radials type then the midpoint changes the center point
* If you're using bar type the the midpoint changes the bar growth
* it expands from the center but clamps to the sprites edge so:
* you want a left to right then set the midpoint all the way to Point(0,y)
* you want a right to left then set the midpoint all the way to Point(1,y)
* you want a bottom to top then set the midpoint all the way to Point(x,0)
* you want a top to bottom then set the midpoint all the way to Point(x,1)
* you want a left to right then set the midpoint all the way to Vector2(0,y)
* you want a right to left then set the midpoint all the way to Vector2(1,y)
* you want a bottom to top then set the midpoint all the way to Vector2(x,0)
* you want a top to bottom then set the midpoint all the way to Vector2(x,1)
*/
void setMidpoint(const Point& point);
void setMidpoint(const Vector2& point);
/** Returns the Midpoint */
Point getMidpoint() const;
Vector2 getMidpoint() const;
/**
* This allows the bar type to move the component at a specific rate
* Set the component to 0 to make sure it stays at 100%.
* For example you want a left to right bar but not have the height stay 100%
* Set the rate to be Point(0,1); and set the midpoint to = Point(0,.5f);
* Set the rate to be Vector2(0,1); and set the midpoint to = Vector2(0,.5f);
*/
inline void setBarChangeRate(const Point& barChangeRate ) { _barChangeRate = barChangeRate; }
inline void setBarChangeRate(const Vector2& barChangeRate ) { _barChangeRate = barChangeRate; }
/** Returns the BarChangeRate */
inline Point getBarChangeRate() const { return _barChangeRate; }
inline Vector2 getBarChangeRate() const { return _barChangeRate; }
// Overrides
virtual void draw(Renderer *renderer, const Matrix &transform, bool transformUpdated) override;
@ -135,17 +135,17 @@ CC_CONSTRUCTOR_ACCESS:
protected:
void onDraw(const Matrix &transform, bool transformUpdated);
Tex2F textureCoordFromAlphaPoint(Point alpha);
Vector2 vertexFromAlphaPoint(Point alpha);
Tex2F textureCoordFromAlphaPoint(Vector2 alpha);
Vector2 vertexFromAlphaPoint(Vector2 alpha);
void updateProgress(void);
void updateBar(void);
void updateRadial(void);
virtual void updateColor(void) override;
Point boundaryTexCoord(char index);
Vector2 boundaryTexCoord(char index);
Type _type;
Point _midpoint;
Point _barChangeRate;
Vector2 _midpoint;
Vector2 _barChangeRate;
float _percentage;
Sprite *_sprite;
int _vertexDataCount;

View File

@ -164,7 +164,7 @@ public:
//fullRect: the total size of screen
//fullViewport: the total viewportSize
*/
void setVirtualViewport(const Point& rtBegin, const Rect& fullRect, const Rect& fullViewport);
void setVirtualViewport(const Vector2& rtBegin, const Rect& fullRect, const Rect& fullViewport);
public:
// XXX should be procted.

View File

@ -64,7 +64,7 @@ public:
/** Create a SpriteFrame with a texture filename, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in pixels of the frame before being trimmed.
*/
static SpriteFrame* create(const std::string& filename, const Rect& rect, bool rotated, const Point& offset, const Size& originalSize);
static SpriteFrame* create(const std::string& filename, const Rect& rect, bool rotated, const Vector2& offset, const Size& originalSize);
/** Create a SpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed.
@ -74,7 +74,7 @@ public:
/** Create a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in points of the frame before being trimmed.
*/
static SpriteFrame* createWithTexture(Texture2D* pobTexture, const Rect& rect, bool rotated, const Point& offset, const Size& originalSize);
static SpriteFrame* createWithTexture(Texture2D* pobTexture, const Rect& rect, bool rotated, const Vector2& offset, const Size& originalSize);
/**
* @js NA
* @lua NA
@ -94,14 +94,14 @@ public:
/** Initializes a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in points of the frame before being trimmed.
*/
bool initWithTexture(Texture2D* pobTexture, const Rect& rect, bool rotated, const Point& offset, const Size& originalSize);
bool initWithTexture(Texture2D* pobTexture, const Rect& rect, bool rotated, const Vector2& offset, const Size& originalSize);
/** Initializes a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in pixels of the frame before being trimmed.
@since v1.1
*/
bool initWithTextureFilename(const std::string& filename, const Rect& rect, bool rotated, const Point& offset, const Size& originalSize);
bool initWithTextureFilename(const std::string& filename, const Rect& rect, bool rotated, const Vector2& offset, const Size& originalSize);
// attributes
@ -117,9 +117,9 @@ public:
void setRect(const Rect& rect);
/** get offset of the frame */
const Point& getOffsetInPixels(void) const;
const Vector2& getOffsetInPixels(void) const;
/** set offset of the frame */
void setOffsetInPixels(const Point& offsetInPixels);
void setOffsetInPixels(const Vector2& offsetInPixels);
/** get original size of the trimmed image */
inline const Size& getOriginalSizeInPixels(void) const { return _originalSizeInPixels; }
@ -136,19 +136,19 @@ public:
/** set texture of the frame, the texture is retained */
void setTexture(Texture2D* pobTexture);
const Point& getOffset(void) const;
void setOffset(const Point& offsets);
const Vector2& getOffset(void) const;
void setOffset(const Vector2& offsets);
// Overrides
virtual SpriteFrame *clone() const override;
protected:
Point _offset;
Vector2 _offset;
Size _originalSize;
Rect _rectInPixels;
bool _rotated;
Rect _rect;
Point _offsetInPixels;
Vector2 _offsetInPixels;
Size _originalSizeInPixels;
Texture2D *_texture;
std::string _textureFilename;

View File

@ -102,16 +102,16 @@ public:
The Sprite can be treated like any other Sprite: rotated, scaled, translated, opacity, color, etc.
You can remove either by calling:
- layer->removeChild(sprite, cleanup);
- or layer->removeTileAt(Point(x,y));
- or layer->removeTileAt(Vector2(x,y));
*/
Sprite* getTileAt(const Point& tileCoordinate);
CC_DEPRECATED_ATTRIBUTE Sprite* tileAt(const Point& tileCoordinate) { return getTileAt(tileCoordinate); };
Sprite* getTileAt(const Vector2& tileCoordinate);
CC_DEPRECATED_ATTRIBUTE Sprite* tileAt(const Vector2& tileCoordinate) { return getTileAt(tileCoordinate); };
/** returns the tile gid at a given tile coordinate. It also returns the tile flags.
This method requires the the tile map has not been previously released (eg. don't call [layer releaseMap])
*/
uint32_t getTileGIDAt(const Point& tileCoordinate, TMXTileFlags* flags = nullptr);
CC_DEPRECATED_ATTRIBUTE uint32_t tileGIDAt(const Point& tileCoordinate, TMXTileFlags* flags = nullptr){
uint32_t getTileGIDAt(const Vector2& tileCoordinate, TMXTileFlags* flags = nullptr);
CC_DEPRECATED_ATTRIBUTE uint32_t tileGIDAt(const Vector2& tileCoordinate, TMXTileFlags* flags = nullptr){
return getTileGIDAt(tileCoordinate, flags);
};
@ -119,7 +119,7 @@ public:
The Tile GID can be obtained by using the method "tileGIDAt" or by using the TMX editor -> Tileset Mgr +1.
If a tile is already placed at that position, then it will be removed.
*/
void setTileGID(uint32_t gid, const Point& tileCoordinate);
void setTileGID(uint32_t gid, const Vector2& tileCoordinate);
/** sets the tile gid (gid = tile global id) at a given tile coordinate.
The Tile GID can be obtained by using the method "tileGIDAt" or by using the TMX editor -> Tileset Mgr +1.
@ -128,14 +128,14 @@ public:
Use withFlags if the tile flags need to be changed as well
*/
void setTileGID(uint32_t gid, const Point& tileCoordinate, TMXTileFlags flags);
void setTileGID(uint32_t gid, const Vector2& tileCoordinate, TMXTileFlags flags);
/** removes a tile at given tile coordinate */
void removeTileAt(const Point& tileCoordinate);
void removeTileAt(const Vector2& tileCoordinate);
/** returns the position in points of a given tile coordinate */
Point getPositionAt(const Point& tileCoordinate);
CC_DEPRECATED_ATTRIBUTE Point positionAt(const Point& tileCoordinate) { return getPositionAt(tileCoordinate); };
Vector2 getPositionAt(const Vector2& tileCoordinate);
CC_DEPRECATED_ATTRIBUTE Vector2 positionAt(const Vector2& tileCoordinate) { return getPositionAt(tileCoordinate); };
/** return the value for the specific property name */
Value getProperty(const std::string& propertyName) const;
@ -193,22 +193,22 @@ public:
virtual std::string getDescription() const override;
private:
Point getPositionForIsoAt(const Point& pos);
Point getPositionForOrthoAt(const Point& pos);
Point getPositionForHexAt(const Point& pos);
Vector2 getPositionForIsoAt(const Vector2& pos);
Vector2 getPositionForOrthoAt(const Vector2& pos);
Vector2 getPositionForHexAt(const Vector2& pos);
Point calculateLayerOffset(const Point& offset);
Vector2 calculateLayerOffset(const Vector2& offset);
/* optimization methods */
Sprite* appendTileForGID(uint32_t gid, const Point& pos);
Sprite* insertTileForGID(uint32_t gid, const Point& pos);
Sprite* updateTileForGID(uint32_t gid, const Point& pos);
Sprite* appendTileForGID(uint32_t gid, const Vector2& pos);
Sprite* insertTileForGID(uint32_t gid, const Vector2& pos);
Sprite* updateTileForGID(uint32_t gid, const Vector2& pos);
/* The layer recognizes some special properties, like cc_vertez */
void parseInternalProperties();
void setupTileSprite(Sprite* sprite, Point pos, int gid);
void setupTileSprite(Sprite* sprite, Vector2 pos, int gid);
Sprite* reusedTileWithRect(Rect rect);
int getVertexZForPos(const Point& pos);
int getVertexZForPos(const Vector2& pos);
// index
ssize_t atlasIndexForExistantZ(int z);

View File

@ -71,10 +71,10 @@ public:
CC_DEPRECATED_ATTRIBUTE ValueMap objectNamed(const std::string& objectName) const { return getObject(objectName); };
/** Gets the offset position of child objects */
inline const Point& getPositionOffset() const { return _positionOffset; };
inline const Vector2& getPositionOffset() const { return _positionOffset; };
/** Sets the offset position of child objects */
inline void setPositionOffset(const Point& offset) { _positionOffset = offset; };
inline void setPositionOffset(const Vector2& offset) { _positionOffset = offset; };
/** Gets the list of properties stored in a dictionary */
inline const ValueMap& getProperties() const { return _properties; };
@ -98,7 +98,7 @@ protected:
/** name of the group */
std::string _groupName;
/** offset position of child objects */
Point _positionOffset;
Vector2 _positionOffset;
/** list of properties stored in a dictionary */
ValueMap _properties;
/** array of the objects */

View File

@ -112,7 +112,7 @@ public:
bool _visible;
unsigned char _opacity;
bool _ownTiles;
Point _offset;
Vector2 _offset;
};
/** @brief TMXTilesetInfo contains the information about the tilesets like:

View File

@ -230,7 +230,7 @@ public:
These functions require GL_TEXTURE_2D and both GL_VERTEX_ARRAY and GL_TEXTURE_COORD_ARRAY client states to be enabled.
*/
/** draws a texture at a given point */
void drawAtPoint(const Point& point);
void drawAtPoint(const Vector2& point);
/** draws a texture inside a rect */
void drawInRect(const Rect& rect);

View File

@ -78,12 +78,12 @@ public:
/** returns a tile from position x,y.
For the moment only channel R is used
*/
Color3B getTileAt(const Point& position) const;
CC_DEPRECATED_ATTRIBUTE Color3B tileAt(const Point& position) const { return getTileAt(position); };
Color3B getTileAt(const Vector2& position) const;
CC_DEPRECATED_ATTRIBUTE Color3B tileAt(const Vector2& position) const { return getTileAt(position); };
/** sets a tile at position x,y.
For the moment only channel R is used
*/
void setTile(const Color3B& tile, const Point& position);
void setTile(const Color3B& tile, const Vector2& position);
/** dealloc the map from memory */
void releaseMap();
@ -93,7 +93,7 @@ public:
protected:
void loadTGAfile(const std::string& file);
void calculateItemsToRender();
void updateAtlasValueAt(const Point& pos, const Color3B& value, int index);
void updateAtlasValueAt(const Vector2& pos, const Color3B& value, int index);
void updateAtlasValues();

View File

@ -53,19 +53,19 @@ public:
{}
/** returns the current touch location in OpenGL coordinates */
Point getLocation() const;
Vector2 getLocation() const;
/** returns the previous touch location in OpenGL coordinates */
Point getPreviousLocation() const;
Vector2 getPreviousLocation() const;
/** returns the start touch location in OpenGL coordinates */
Point getStartLocation() const;
Vector2 getStartLocation() const;
/** returns the delta of 2 current touches locations in screen coordinates */
Point getDelta() const;
Vector2 getDelta() const;
/** returns the current touch location in screen coordinates */
Point getLocationInView() const;
Vector2 getLocationInView() const;
/** returns the previous touch location in screen coordinates */
Point getPreviousLocationInView() const;
Vector2 getPreviousLocationInView() const;
/** returns the start touch location in screen coordinates */
Point getStartLocationInView() const;
Vector2 getStartLocationInView() const;
void setTouchInfo(int id, float x, float y)
{
@ -91,9 +91,9 @@ public:
private:
int _id;
bool _startPointCaptured;
Point _startPoint;
Point _point;
Point _prevPoint;
Vector2 _startPoint;
Vector2 _point;
Vector2 _prevPoint;
};
// end of input group

View File

@ -38,7 +38,7 @@ NS_CC_BEGIN
/** @file CCVertex.h */
/** converts a line to a polygon */
void CC_DLL ccVertexLineToPolygon(Point *points, float stroke, Vector2 *vertices, unsigned int offset, unsigned int nuPoints);
void CC_DLL ccVertexLineToPolygon(Vector2 *points, float stroke, Vector2 *vertices, unsigned int offset, unsigned int nuPoints);
/** returns whether or not the line intersects */
bool CC_DLL ccVertexLineIntersect(float Ax, float Ay,

View File

@ -109,7 +109,7 @@ To enabled set it to 1. Disabled by default.
Default: 0,0 (bottom-left corner)
*/
#ifndef CC_DIRECTOR_FPS_POSITION
#define CC_DIRECTOR_FPS_POSITION Point(0,0)
#define CC_DIRECTOR_FPS_POSITION Vector2(0,0)
#endif
/** @def CC_DIRECTOR_DISPATCH_FAST_EVENTS

View File

@ -153,13 +153,13 @@ On iPhone it returns 2 if RetinaDisplay is On. Otherwise it returns 1
Converts a rect in pixels to points
*/
#define CC_POINT_PIXELS_TO_POINTS(__pixels__) \
Point( (__pixels__).x / CC_CONTENT_SCALE_FACTOR(), (__pixels__).y / CC_CONTENT_SCALE_FACTOR())
Vector2( (__pixels__).x / CC_CONTENT_SCALE_FACTOR(), (__pixels__).y / CC_CONTENT_SCALE_FACTOR())
/** @def CC_POINT_POINTS_TO_PIXELS
Converts a rect in points to pixels
*/
#define CC_POINT_POINTS_TO_PIXELS(__points__) \
Point( (__points__).x * CC_CONTENT_SCALE_FACTOR(), (__points__).y * CC_CONTENT_SCALE_FACTOR())
Vector2( (__points__).x * CC_CONTENT_SCALE_FACTOR(), (__points__).y * CC_CONTENT_SCALE_FACTOR())
/** @def CC_POINT_PIXELS_TO_POINTS
Converts a rect in pixels to points

View File

@ -194,7 +194,7 @@ struct Tex2F {
};
//! Point Sprite component
//! Vector2 Sprite component
struct PointSprite
{
Vector2 pos; // 8 bytes
@ -220,7 +220,7 @@ struct Quad3 {
Vector3 tr;
};
//! a Point with a vertex point, a tex coord point and a color 4B
//! a Vector2 with a vertex point, a tex coord point and a color 4B
struct V2F_C4B_T2F
{
//! vertices (2F)
@ -231,7 +231,7 @@ struct V2F_C4B_T2F
Tex2F texCoords;
};
//! a Point with a vertex point, a tex coord point and a color 4F
//! a Vector2 with a vertex point, a tex coord point and a color 4F
struct V2F_C4F_T2F
{
//! vertices (2F)
@ -242,7 +242,7 @@ struct V2F_C4F_T2F
Tex2F texCoords;
};
//! a Point with a vertex point, a tex coord point and a color 4B
//! a Vector2 with a vertex point, a tex coord point and a color 4B
struct V3F_C4B_T2F
{
//! vertices (3F)
@ -258,11 +258,11 @@ struct V3F_C4B_T2F
//! A Triangle of V2F_C4B_T2F
struct V2F_C4B_T2F_Triangle
{
//! Point A
//! Vector2 A
V2F_C4B_T2F a;
//! Point B
//! Vector2 B
V2F_C4B_T2F b;
//! Point B
//! Vector2 B
V2F_C4B_T2F c;
};

View File

@ -113,7 +113,7 @@ public:
/**
* Get the visible origin point of opengl viewport.
*/
virtual Point getVisibleOrigin() const;
virtual Vector2 getVisibleOrigin() const;
/**
* Get the visible rectangle of opengl viewport.

View File

@ -55,7 +55,7 @@ public:
private:
cocos2d::Point GetCCPoint(Windows::UI::Core::PointerEventArgs^ args);
cocos2d::Vector2 GetCCPoint(Windows::UI::Core::PointerEventArgs^ args);
void OnTextKeyDown(Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);
void OnTextKeyUp(Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);
@ -78,7 +78,7 @@ private:
Platform::Agile<Windows::UI::Core::CoreWindow> m_window;
Windows::Foundation::Point m_lastPoint;
Windows::Foundation::Vector2 m_lastPoint;
Windows::Foundation::EventRegistrationToken m_eventToken;
bool m_lastPointValid;
bool m_textInputEnabled;
@ -113,7 +113,7 @@ public:
private:
Windows::Foundation::EventRegistrationToken m_eventToken;
Windows::Foundation::Point m_lastPoint;
Windows::Foundation::Vector2 m_lastPoint;
bool m_lastPointValid;
public:

View File

@ -134,12 +134,12 @@ private:
void UpdateWindowSize();
void UpdateOrientationMatrix();
cocos2d::Point TransformToOrientation(Windows::Foundation::Point point);
cocos2d::Point GetPoint(Windows::UI::Core::PointerEventArgs^ args);
cocos2d::Vector2 TransformToOrientation(Windows::Foundation::Vector2 point);
cocos2d::Vector2 GetPoint(Windows::UI::Core::PointerEventArgs^ args);
Windows::Foundation::Rect m_windowBounds;
Windows::Foundation::EventRegistrationToken m_eventToken;
Windows::Foundation::Point m_lastPoint;
Windows::Foundation::Vector2 m_lastPoint;
float m_width;
float m_height;

View File

@ -24,7 +24,7 @@ public:
virtual void Present();
virtual float ConvertDipsToPixels(float dips);
virtual void ComputeOrientationMatrices();
virtual Windows::Foundation::Point TransformToOrientation(Windows::Foundation::Point point, bool dipsToPixels=true);
virtual Windows::Foundation::Vector2 TransformToOrientation(Windows::Foundation::Vector2 point, bool dipsToPixels=true);
float getOrientedWindowWidth() {return m_orientedScreenSize.Width;};
float getOrientedWindowHeight() {return m_orientedScreenSize.Height;};

View File

@ -45,7 +45,7 @@ struct AffineTransform {
CC_DLL AffineTransform __CCAffineTransformMake(float a, float b, float c, float d, float tx, float ty);
#define AffineTransformMake __CCAffineTransformMake
CC_DLL Point __CCPointApplyAffineTransform(const Point& point, const AffineTransform& t);
CC_DLL Vector2 __CCPointApplyAffineTransform(const Vector2& point, const AffineTransform& t);
#define PointApplyAffineTransform __CCPointApplyAffineTransform
CC_DLL Size __CCSizeApplyAffineTransform(const Size& size, const AffineTransform& t);
@ -55,7 +55,7 @@ CC_DLL AffineTransform AffineTransformMakeIdentity();
CC_DLL Rect RectApplyAffineTransform(const Rect& rect, const AffineTransform& anAffineTransform);
CC_DLL Rect RectApplyTransform(const Rect& rect, const Matrix& transform);
CC_DLL Point PointApplyTransform(const Point& point, const Matrix& transform);
CC_DLL Vector2 PointApplyTransform(const Vector2& point, const Matrix& transform);
CC_DLL AffineTransform AffineTransformTranslate(const AffineTransform& t, float tx, float ty);
CC_DLL AffineTransform AffineTransformRotate(const AffineTransform& aTransform, float anAngle);

View File

@ -30,281 +30,6 @@ THE SOFTWARE.
// implementation of Point
NS_CC_BEGIN
// Point::Point(void) : x(0), y(0)
// {
// }
// Point::Point(float xx, float yy) : x(xx), y(yy)
// {
// }
// Point::Point(const Point& other) : x(other.x), y(other.y)
// {
// }
// Point::Point(const Size& size) : x(size.width), y(size.height)
// {
// }
// Point& Point::operator= (const Point& other)
// {
// setPoint(other.x, other.y);
// return *this;
// }
// Point& Point::operator= (const Size& size)
// {
// setPoint(size.width, size.height);
// return *this;
// }
// Point Point::operator+(const Point& right) const
// {
// return Point(this->x + right.x, this->y + right.y);
// }
// Point& Point::operator+=(const Point& right)
// {
// this->x += right.x;
// this->y += right.y;
// return *this;
// }
// Point Point::operator-(const Point& right) const
// {
// return Point(this->x - right.x, this->y - right.y);
// }
// Point& Point::operator-=(const Point& right)
// {
// this->x -= right.x;
// this->y -= right.y;
// return *this;
// }
// Point Point::operator-() const
// {
// return Point(-x, -y);
// }
// bool Point::operator==(const Point& right)
// {
// return this->x == right.x && this->y == right.y;
// }
// bool Point::operator!=(const Point& right)
// {
// return this->x != right.x || this->y != right.y;
// }
// bool Point::operator==(const Point& right) const
// {
// return this->x == right.x && this->y == right.y;
// }
// bool Point::operator!=(const Point& right) const
// {
// return this->x != right.x || this->y != right.y;
// }
// Point Point::operator*(float a) const
// {
// return Point(this->x * a, this->y * a);
// }
// Point Point::operator/(float a) const
// {
// CCASSERT(a!=0, "CCPoint division by 0.");
// return Point(this->x / a, this->y / a);
// }
// void Point::setPoint(float xx, float yy)
// {
// this->x = xx;
// this->y = yy;
// }
// bool Point::equals(const Point& target) const
// {
// return (fabs(this->x - target.x) < FLT_EPSILON)
// && (fabs(this->y - target.y) < FLT_EPSILON);
// }
// bool Point::fuzzyEquals(const Point& b, float var) const
// {
// if(x - var <= b.x && b.x <= x + var)
// if(y - var <= b.y && b.y <= y + var)
// return true;
// return false;
// }
// float Point::getAngle(const Point& other) const
// {
// Point a2 = normalize();
// Point b2 = other.normalize();
// float angle = atan2f(a2.cross(b2), a2.dot(b2));
// if( fabs(angle) < FLT_EPSILON ) return 0.f;
// return angle;
// }
// Point Point::rotateByAngle(const Point& pivot, float angle) const
// {
// return pivot + (*this - pivot).rotate(Point::forAngle(angle));
// }
// bool Point::isOneDimensionSegmentOverlap(float A, float B, float C, float D, float *S, float *E)
// {
// float ABmin = MIN(A, B);
// float ABmax = MAX(A, B);
// float CDmin = MIN(C, D);
// float CDmax = MAX(C, D);
// if (ABmax < CDmin || CDmax < ABmin)
// {
// // ABmin->ABmax->CDmin->CDmax or CDmin->CDmax->ABmin->ABmax
// return false;
// }
// else
// {
// if (ABmin >= CDmin && ABmin <= CDmax)
// {
// // CDmin->ABmin->CDmax->ABmax or CDmin->ABmin->ABmax->CDmax
// if (S != nullptr) *S = ABmin;
// if (E != nullptr) *E = CDmax < ABmax ? CDmax : ABmax;
// }
// else if (ABmax >= CDmin && ABmax <= CDmax)
// {
// // ABmin->CDmin->ABmax->CDmax
// if (S != nullptr) *S = CDmin;
// if (E != nullptr) *E = ABmax;
// }
// else
// {
// // ABmin->CDmin->CDmax->ABmax
// if (S != nullptr) *S = CDmin;
// if (E != nullptr) *E = CDmax;
// }
// return true;
// }
// }
// bool Point::isLineIntersect(const Point& A, const Point& B,
// const Point& C, const Point& D,
// float *S, float *T)
// {
// // FAIL: Line undefined
// if ( (A.x==B.x && A.y==B.y) || (C.x==D.x && C.y==D.y) )
// {
// return false;
// }
// const float denom = crossProduct2Vector(A, B, C, D);
// if (denom == 0)
// {
// // Lines parallel or overlap
// return false;
// }
// if (S != nullptr) *S = crossProduct2Vector(C, D, C, A) / denom;
// if (T != nullptr) *T = crossProduct2Vector(A, B, C, A) / denom;
// return true;
// }
// bool Point::isLineParallel(const Point& A, const Point& B,
// const Point& C, const Point& D)
// {
// // FAIL: Line undefined
// if ( (A.x==B.x && A.y==B.y) || (C.x==D.x && C.y==D.y) )
// {
// return false;
// }
// if (crossProduct2Vector(A, B, C, D) == 0)
// {
// // line overlap
// if (crossProduct2Vector(C, D, C, A) == 0 || crossProduct2Vector(A, B, C, A) == 0)
// {
// return false;
// }
// return true;
// }
// return false;
// }
// bool Point::isLineOverlap(const Point& A, const Point& B,
// const Point& C, const Point& D)
// {
// // FAIL: Line undefined
// if ( (A.x==B.x && A.y==B.y) || (C.x==D.x && C.y==D.y) )
// {
// return false;
// }
// if (crossProduct2Vector(A, B, C, D) == 0 &&
// (crossProduct2Vector(C, D, C, A) == 0 || crossProduct2Vector(A, B, C, A) == 0))
// {
// return true;
// }
// return false;
// }
// bool Point::isSegmentOverlap(const Point& A, const Point& B, const Point& C, const Point& D, Point* S, Point* E)
// {
// if (isLineOverlap(A, B, C, D))
// {
// return isOneDimensionSegmentOverlap(A.x, B.x, C.x, D.x, &S->x, &E->x) &&
// isOneDimensionSegmentOverlap(A.y, B.y, C.y, D.y, &S->y, &E->y);
// }
// return false;
// }
// bool Point::isSegmentIntersect(const Point& A, const Point& B, const Point& C, const Point& D)
// {
// float S, T;
// if (isLineIntersect(A, B, C, D, &S, &T )&&
// (S >= 0.0f && S <= 1.0f && T >= 0.0f && T <= 1.0f))
// {
// return true;
// }
// return false;
// }
// Point Point::getIntersectPoint(const Point& A, const Point& B, const Point& C, const Point& D)
// {
// float S, T;
// if (isLineIntersect(A, B, C, D, &S, &T))
// {
// // Point of intersection
// Point P;
// P.x = A.x + S * (B.x - A.x);
// P.y = A.y + S * (B.y - A.y);
// return P;
// }
// return Point::ZERO;
// }
// const Point Point::ZERO = Point(0.0f, 0.0f);
// const Point Point::ANCHOR_MIDDLE = Point(0.5f, 0.5f);
// const Point Point::ANCHOR_BOTTOM_LEFT = Point(0.0f, 0.0f);
// const Point Point::ANCHOR_TOP_LEFT = Point(0.0f, 1.0f);
// const Point Point::ANCHOR_BOTTOM_RIGHT = Point(1.0f, 0.0f);
// const Point Point::ANCHOR_TOP_RIGHT = Point(1.0f, 1.0f);
// const Point Point::ANCHOR_MIDDLE_RIGHT = Point(1.0f, 0.5f);
// const Point Point::ANCHOR_MIDDLE_LEFT = Point(0.0f, 0.5f);
// const Point Point::ANCHOR_MIDDLE_TOP = Point(0.5f, 1.0f);
// const Point Point::ANCHOR_MIDDLE_BOTTOM = Point(0.5f, 0.0f);
// implementation of Size
Size::Size(void) : width(0), height(0)

View File

@ -42,421 +42,9 @@ USING_NS_CC_MATH;
* @{
*/
// for Point assignement operator and copy constructor
// for Vector2 assignement operator and copy constructor
class CC_DLL Size;
// class CC_DLL Point
// {
// public:
// float x;
// float y;
// //conversion to and from Vector2
// public:
// operator Vector2() const { return Vector2(x, y); }
// Point(const Vector2& v):x(v.x), y(v.y) {}
// public:
// /**
// * @js NA
// */
// Point();
// /**
// * @js NA
// */
// Point(float x, float y);
// /**
// * @js NA
// * @lua NA
// */
// Point(const Point& other);
// /**
// * @js NA
// * @lua NA
// */
// explicit Point(const Size& size);
// /**
// * @js NA
// * @lua NA
// */
// Point& operator= (const Point& other);
// /**
// * @js NA
// * @lua NA
// */
// Point& operator= (const Size& size);
// /**
// * @js NA
// * @lua NA
// */
// Point operator+(const Point& right) const;
// /**
// * @js NA
// * @lua NA
// */
// Point& operator+=(const Point& right);
// /**
// * @js NA
// * @lua NA
// */
// Point operator-(const Point& right) const;
// /**
// * @js NA
// * @lua NA
// */
// Point& operator-=(const Point& right);
// /**
// * @js NA
// * @lua NA
// */
// Point operator-() const;
// /**
// * @js NA
// * @lua NA
// */
// bool operator==(const Point& right);
// /**
// * @js NA
// * @lua NA
// */
// bool operator!=(const Point& right);
// /**
// * @js NA
// * @lua NA
// */
// bool operator==(const Point& right) const;
// /**
// * @js NA
// * @lua NA
// */
// bool operator!=(const Point& right) const;
// /**
// * @js NA
// * @lua NA
// */
// Point operator*(float a) const;
// /**
// * @js NA
// * @lua NA
// */
// Point operator/(float a) const;
// /**
// * @js NA
// * @lua NA
// */
// void setPoint(float x, float y);
// /**
// * @js NA
// */
// bool equals(const Point& target) const;
// /** @returns if points have fuzzy equality which means equal with some degree of variance.
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// bool fuzzyEquals(const Point& target, float variance) const;
// /** Calculates distance between point an origin
// @return float
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// inline float getLength() const {
// return sqrtf(x*x + y*y);
// };
// /** Calculates the square length of a Point (not calling sqrt() )
// @return float
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// inline float getLengthSq() const {
// return dot(*this); //x*x + y*y;
// };
// /** Calculates the square distance between two points (not calling sqrt() )
// @return float
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// inline float getDistanceSq(const Point& other) const {
// return (*this - other).getLengthSq();
// };
// /** Calculates the distance between two points
// @return float
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// inline float getDistance(const Point& other) const {
// return (*this - other).getLength();
// };
// /** @returns the angle in radians between this vector and the x axis
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// inline float getAngle() const {
// return atan2f(y, x);
// };
// /** @returns the angle in radians between two vector directions
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// float getAngle(const Point& other) const;
// /** Calculates dot product of two points.
// @return float
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// inline float dot(const Point& other) const {
// return x*other.x + y*other.y;
// };
// /** Calculates cross product of two points.
// @return float
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// inline float cross(const Point& other) const {
// return x*other.y - y*other.x;
// };
// /** Calculates perpendicular of v, rotated 90 degrees counter-clockwise -- cross(v, perp(v)) >= 0
// @return Point
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// inline Point getPerp() const {
// return Point(-y, x);
// };
// /** Calculates midpoint between two points.
// @return Point
// @since v3.0
// * @js NA
// * @lua NA
// */
// inline Point getMidpoint(const Point& other) const
// {
// return Point((x + other.x) / 2.0f, (y + other.y) / 2.0f);
// }
// /** Clamp a point between from and to.
// @since v3.0
// * @js NA
// * @lua NA
// */
// inline Point getClampPoint(const Point& min_inclusive, const Point& max_inclusive) const
// {
// return Point(clampf(x,min_inclusive.x,max_inclusive.x), clampf(y, min_inclusive.y, max_inclusive.y));
// }
// /** Run a math operation function on each point component
// * absf, fllorf, ceilf, roundf
// * any function that has the signature: float func(float);
// * For example: let's try to take the floor of x,y
// * p.compOp(floorf);
// @since v3.0
// * @js NA
// * @lua NA
// */
// inline Point compOp(std::function<float(float)> function) const
// {
// return Point(function(x), function(y));
// }
// /** Calculates perpendicular of v, rotated 90 degrees clockwise -- cross(v, rperp(v)) <= 0
// @return Point
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// inline Point getRPerp() const {
// return Point(y, -x);
// };
// /** Calculates the projection of this over other.
// @return Point
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// inline Point project(const Point& other) const {
// return other * (dot(other)/other.dot(other));
// };
// /** Complex multiplication of two points ("rotates" two points).
// @return Point vector with an angle of this.getAngle() + other.getAngle(),
// and a length of this.getLength() * other.getLength().
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// inline Point rotate(const Point& other) const {
// return Point(x*other.x - y*other.y, x*other.y + y*other.x);
// };
// /** Unrotates two points.
// @return Point vector with an angle of this.getAngle() - other.getAngle(),
// and a length of this.getLength() * other.getLength().
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// inline Point unrotate(const Point& other) const {
// return Point(x*other.x + y*other.y, y*other.x - x*other.y);
// };
// /** Returns point multiplied to a length of 1.
// * If the point is 0, it returns (1, 0)
// @return Point
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// inline Point normalize() const {
// float length = getLength();
// if(length == 0.) return Point(1.f, 0);
// return *this / getLength();
// };
// /** Linear Interpolation between two points a and b
// @returns
// alpha == 0 ? a
// alpha == 1 ? b
// otherwise a value between a..b
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// inline Point lerp(const Point& other, float alpha) const {
// return *this * (1.f - alpha) + other * alpha;
// };
// /** Rotates a point counter clockwise by the angle around a pivot
// @param pivot is the pivot, naturally
// @param angle is the angle of rotation ccw in radians
// @returns the rotated point
// @since v2.1.4
// * @js NA
// * @lua NA
// */
// Point rotateByAngle(const Point& pivot, float angle) const;
// /**
// * @js NA
// * @lua NA
// */
// static inline Point forAngle(const float a)
// {
// return Point(cosf(a), sinf(a));
// }
// /** A general line-line intersection test
// @param A the startpoint for the first line L1 = (A - B)
// @param B the endpoint for the first line L1 = (A - B)
// @param C the startpoint for the second line L2 = (C - D)
// @param D the endpoint for the second line L2 = (C - D)
// @param S the range for a hitpoint in L1 (p = A + S*(B - A))
// @param T the range for a hitpoint in L2 (p = C + T*(D - C))
// @returns whether these two lines interects.
// Note that to truly test intersection for segments we have to make
// sure that S & T lie within [0..1] and for rays, make sure S & T > 0
// the hit point is C + T * (D - C);
// the hit point also is A + S * (B - A);
// @since 3.0
// * @js NA
// * @lua NA
// */
// static bool isLineIntersect(const Point& A, const Point& B,
// const Point& C, const Point& D,
// float *S = nullptr, float *T = nullptr);
// /**
// returns true if Line A-B overlap with segment C-D
// @since v3.0
// * @js NA
// * @lua NA
// */
// static bool isLineOverlap(const Point& A, const Point& B,
// const Point& C, const Point& D);
// /**
// returns true if Line A-B parallel with segment C-D
// @since v3.0
// * @js NA
// * @lua NA
// */
// static bool isLineParallel(const Point& A, const Point& B,
// const Point& C, const Point& D);
// /**
// returns true if Segment A-B overlap with segment C-D
// @since v3.0
// * @js NA
// * @lua NA
// */
// static bool isSegmentOverlap(const Point& A, const Point& B,
// const Point& C, const Point& D,
// Point* S = nullptr, Point* E = nullptr);
// /**
// returns true if Segment A-B intersects with segment C-D
// @since v3.0
// * @js NA
// * @lua NA
// */
// static bool isSegmentIntersect(const Point& A, const Point& B, const Point& C, const Point& D);
// /**
// returns the intersection point of line A-B, C-D
// @since v3.0
// * @js NA
// * @lua NA
// */
// static Point getIntersectPoint(const Point& A, const Point& B, const Point& C, const Point& D);
// /** equals to Point(0,0) */
// static const Point ZERO;
// /** equals to Point(0.5, 0.5) */
// static const Point ANCHOR_MIDDLE;
// /** equals to Point(0, 0) */
// static const Point ANCHOR_BOTTOM_LEFT;
// /** equals to Point(0, 1) */
// static const Point ANCHOR_TOP_LEFT;
// /** equals to Point(1, 0) */
// static const Point ANCHOR_BOTTOM_RIGHT;
// /** equals to Point(1, 1) */
// static const Point ANCHOR_TOP_RIGHT;
// /** equals to Point(1, 0.5) */
// static const Point ANCHOR_MIDDLE_RIGHT;
// /** equals to Point(0, 0.5) */
// static const Point ANCHOR_MIDDLE_LEFT;
// /** equals to Point(0.5, 1) */
// static const Point ANCHOR_MIDDLE_TOP;
// /** equals to Point(0.5, 0) */
// static const Point ANCHOR_MIDDLE_BOTTOM;
// private:
// // returns true if segment A-B intersects with segment C-D. S->E is the ovderlap part
// static bool isOneDimensionSegmentOverlap(float A, float B, float C, float D, float *S, float * E);
// // cross procuct of 2 vector. A->B X C->D
// static float crossProduct2Vector(const Point& A, const Point& B, const Point& C, const Point& D) { return (D.y - C.y) * (B.x - A.x) - (D.x - C.x) * (B.y - A.y); }
// };
CC_DEPRECATED_ATTRIBUTE typedef Vector2 Point;
class CC_DLL Size
@ -488,7 +76,7 @@ public:
* @js NA
* @lua NA
*/
explicit Size(const Point& point);
explicit Size(const Vector2& point);
/**
* @js NA
* @lua NA
@ -498,7 +86,7 @@ public:
* @js NA
* @lua NA
*/
Size& operator= (const Point& point);
Size& operator= (const Vector2& point);
/**
* @js NA
* @lua NA
@ -535,7 +123,7 @@ public:
class CC_DLL Rect
{
public:
Point origin;
Vector2 origin;
Size size;
public:
@ -593,7 +181,7 @@ public:
/**
* @js NA
*/
bool containsPoint(const Point& point) const;
bool containsPoint(const Vector2& point) const;
/**
* @js NA
*/

View File

@ -55,9 +55,9 @@ Rect CC_DLL RectFromString(const std::string& str);
An example of a valid string is "{3.0,2.5}".
The string is not localized, so items are always separated with a comma.
@return A Core Graphics structure that represents a point.
If the string is not well-formed, the function returns Point::ZERO.
If the string is not well-formed, the function returns Vector2::ZERO.
*/
Point CC_DLL PointFromString(const std::string& str);
Vector2 CC_DLL PointFromString(const std::string& str);
/**
@brief Returns a Core Graphics size structure corresponding to the data in a given string.

View File

@ -40,66 +40,66 @@ NS_CC_BEGIN
* @{
*/
/** Helper macro that creates a Point
@return Point
/** Helper macro that creates a Vector2
@return Vector2
@since v0.7.2
*/
CC_DEPRECATED_ATTRIBUTE inline Point ccp(float x, float y)
CC_DEPRECATED_ATTRIBUTE inline Vector2 ccp(float x, float y)
{
return Point(x, y);
return Vector2(x, y);
}
/** Returns opposite of point.
@return Point
@return Vector2
@since v0.7.2
@deprecated please use Point::-, for example: -v1
@deprecated please use Vector2::-, for example: -v1
*/
CC_DEPRECATED_ATTRIBUTE static inline Point
ccpNeg(const Point& v)
CC_DEPRECATED_ATTRIBUTE static inline Vector2
ccpNeg(const Vector2& v)
{
return -v;
}
/** Calculates sum of two points.
@return Point
@return Vector2
@since v0.7.2
@deprecated please use Point::+, for example: v1 + v2
@deprecated please use Vector2::+, for example: v1 + v2
*/
CC_DEPRECATED_ATTRIBUTE static inline Point
ccpAdd(const Point& v1, const Point& v2)
CC_DEPRECATED_ATTRIBUTE static inline Vector2
ccpAdd(const Vector2& v1, const Vector2& v2)
{
return v1 + v2;
}
/** Calculates difference of two points.
@return Point
@return Vector2
@since v0.7.2
@deprecated please use Point::-, for example: v1 - v2
@deprecated please use Vector2::-, for example: v1 - v2
*/
CC_DEPRECATED_ATTRIBUTE static inline Point
ccpSub(const Point& v1, const Point& v2)
CC_DEPRECATED_ATTRIBUTE static inline Vector2
ccpSub(const Vector2& v1, const Vector2& v2)
{
return v1 - v2;
}
/** Returns point multiplied by given factor.
@return Point
@return Vector2
@since v0.7.2
@deprecated please use Point::*, for example: v1 * v2
@deprecated please use Vector2::*, for example: v1 * v2
*/
CC_DEPRECATED_ATTRIBUTE static inline Point
ccpMult(const Point& v, const float s)
CC_DEPRECATED_ATTRIBUTE static inline Vector2
ccpMult(const Vector2& v, const float s)
{
return v * s;
}
/** Calculates midpoint between two points.
@return Point
@return Vector2
@since v0.7.2
@deprecated please use it like (v1 + v2) / 2.0f
*/
CC_DEPRECATED_ATTRIBUTE static inline Point
ccpMidpoint(const Point& v1, const Point& v2)
CC_DEPRECATED_ATTRIBUTE static inline Vector2
ccpMidpoint(const Vector2& v1, const Vector2& v2)
{
return v1.getMidpoint(v2);
}
@ -109,7 +109,7 @@ ccpMidpoint(const Point& v1, const Point& v2)
@since v0.7.2
*/
CC_DEPRECATED_ATTRIBUTE static inline float
ccpDot(const Point& v1, const Point& v2)
ccpDot(const Vector2& v1, const Vector2& v2)
{
return v1.dot(v2);
}
@ -119,67 +119,67 @@ ccpDot(const Point& v1, const Point& v2)
@since v0.7.2
*/
CC_DEPRECATED_ATTRIBUTE static inline float
ccpCross(const Point& v1, const Point& v2)
ccpCross(const Vector2& v1, const Vector2& v2)
{
return v1.cross(v2);
}
/** Calculates perpendicular of v, rotated 90 degrees counter-clockwise -- cross(v, perp(v)) >= 0
@return Point
@return Vector2
@since v0.7.2
*/
CC_DEPRECATED_ATTRIBUTE static inline Point
ccpPerp(const Point& v)
CC_DEPRECATED_ATTRIBUTE static inline Vector2
ccpPerp(const Vector2& v)
{
return v.getPerp();
}
/** Calculates perpendicular of v, rotated 90 degrees clockwise -- cross(v, rperp(v)) <= 0
@return Point
@return Vector2
@since v0.7.2
*/
CC_DEPRECATED_ATTRIBUTE static inline Point
ccpRPerp(const Point& v)
CC_DEPRECATED_ATTRIBUTE static inline Vector2
ccpRPerp(const Vector2& v)
{
return v.getRPerp();
}
/** Calculates the projection of v1 over v2.
@return Point
@return Vector2
@since v0.7.2
*/
CC_DEPRECATED_ATTRIBUTE static inline Point
ccpProject(const Point& v1, const Point& v2)
CC_DEPRECATED_ATTRIBUTE static inline Vector2
ccpProject(const Vector2& v1, const Vector2& v2)
{
return v1.project(v2);
}
/** Rotates two points.
@return Point
@return Vector2
@since v0.7.2
*/
CC_DEPRECATED_ATTRIBUTE static inline Point
ccpRotate(const Point& v1, const Point& v2)
CC_DEPRECATED_ATTRIBUTE static inline Vector2
ccpRotate(const Vector2& v1, const Vector2& v2)
{
return v1.rotate(v2);
}
/** Unrotates two points.
@return Point
@return Vector2
@since v0.7.2
*/
CC_DEPRECATED_ATTRIBUTE static inline Point
ccpUnrotate(const Point& v1, const Point& v2)
CC_DEPRECATED_ATTRIBUTE static inline Vector2
ccpUnrotate(const Vector2& v1, const Vector2& v2)
{
return v1.unrotate(v2);
}
/** Calculates the square length of a Point (not calling sqrt() )
/** Calculates the square length of a Vector2 (not calling sqrt() )
@return float
@since v0.7.2
*/
CC_DEPRECATED_ATTRIBUTE static inline float
ccpLengthSQ(const Point& v)
ccpLengthSQ(const Vector2& v)
{
return v.getLengthSq();
}
@ -190,7 +190,7 @@ ccpLengthSQ(const Point& v)
@since v1.1
*/
CC_DEPRECATED_ATTRIBUTE static inline float
ccpDistanceSQ(const Point p1, const Point p2)
ccpDistanceSQ(const Vector2 p1, const Vector2 p2)
{
return (p1 - p2).getLengthSq();
}
@ -200,7 +200,7 @@ ccpDistanceSQ(const Point p1, const Point p2)
@return float
@since v0.7.2
*/
CC_DEPRECATED_ATTRIBUTE static inline float ccpLength(const Point& v)
CC_DEPRECATED_ATTRIBUTE static inline float ccpLength(const Vector2& v)
{
return v.getLength();
}
@ -209,34 +209,34 @@ CC_DEPRECATED_ATTRIBUTE static inline float ccpLength(const Point& v)
@return float
@since v0.7.2
*/
CC_DEPRECATED_ATTRIBUTE static inline float ccpDistance(const Point& v1, const Point& v2)
CC_DEPRECATED_ATTRIBUTE static inline float ccpDistance(const Vector2& v1, const Vector2& v2)
{
return v1.getDistance(v2);
}
/** Returns point multiplied to a length of 1.
@return Point
@return Vector2
@since v0.7.2
*/
CC_DEPRECATED_ATTRIBUTE static inline Point ccpNormalize(const Point& v)
CC_DEPRECATED_ATTRIBUTE static inline Vector2 ccpNormalize(const Vector2& v)
{
return v.normalize();
}
/** Converts radians to a normalized vector.
@return Point
@return Vector2
@since v0.7.2
*/
CC_DEPRECATED_ATTRIBUTE static inline Point ccpForAngle(const float a)
CC_DEPRECATED_ATTRIBUTE static inline Vector2 ccpForAngle(const float a)
{
return Point::forAngle(a);
return Vector2::forAngle(a);
}
/** Converts a vector to radians.
@return float
@since v0.7.2
*/
CC_DEPRECATED_ATTRIBUTE static inline float ccpToAngle(const Point& v)
CC_DEPRECATED_ATTRIBUTE static inline float ccpToAngle(const Vector2& v)
{
return v.getAngle();
}
@ -245,17 +245,17 @@ CC_DEPRECATED_ATTRIBUTE static inline float ccpToAngle(const Point& v)
/** Clamp a point between from and to.
@since v0.99.1
*/
CC_DEPRECATED_ATTRIBUTE static inline Point ccpClamp(const Point& p, const Point& from, const Point& to)
CC_DEPRECATED_ATTRIBUTE static inline Vector2 ccpClamp(const Vector2& p, const Vector2& from, const Vector2& to)
{
return p.getClampPoint(from, to);
}
/** Quickly convert Size to a Point
/** Quickly convert Size to a Vector2
@since v0.99.1
*/
CC_DEPRECATED_ATTRIBUTE static inline Point ccpFromSize(const Size& s)
CC_DEPRECATED_ATTRIBUTE static inline Vector2 ccpFromSize(const Size& s)
{
return Point(s);
return Vector2(s);
}
/** Run a math operation function on each point component
@ -265,7 +265,7 @@ CC_DEPRECATED_ATTRIBUTE static inline Point ccpFromSize(const Size& s)
* ccpCompOp(p,floorf);
@since v0.99.1
*/
CC_DEPRECATED_ATTRIBUTE static inline Point ccpCompOp(const Point& p, float (*opFunc)(float))
CC_DEPRECATED_ATTRIBUTE static inline Vector2 ccpCompOp(const Vector2& p, float (*opFunc)(float))
{
return p.compOp(opFunc);
}
@ -277,7 +277,7 @@ CC_DEPRECATED_ATTRIBUTE static inline Point ccpCompOp(const Point& p, float (*op
otherwise a value between a..b
@since v0.99.1
*/
CC_DEPRECATED_ATTRIBUTE static inline Point ccpLerp(const Point& a, const Point& b, float alpha)
CC_DEPRECATED_ATTRIBUTE static inline Vector2 ccpLerp(const Vector2& a, const Vector2& b, float alpha)
{
return a.lerp(b, alpha);
}
@ -286,7 +286,7 @@ CC_DEPRECATED_ATTRIBUTE static inline Point ccpLerp(const Point& a, const Point&
/** @returns if points have fuzzy equality which means equal with some degree of variance.
@since v0.99.1
*/
CC_DEPRECATED_ATTRIBUTE static inline bool ccpFuzzyEqual(const Point& a, const Point& b, float variance)
CC_DEPRECATED_ATTRIBUTE static inline bool ccpFuzzyEqual(const Vector2& a, const Vector2& b, float variance)
{
return a.fuzzyEquals(b, variance);
}
@ -296,15 +296,15 @@ CC_DEPRECATED_ATTRIBUTE static inline bool ccpFuzzyEqual(const Point& a, const P
@returns a component-wise multiplication
@since v0.99.1
*/
CC_DEPRECATED_ATTRIBUTE static inline Point ccpCompMult(const Point& a, const Point& b)
CC_DEPRECATED_ATTRIBUTE static inline Vector2 ccpCompMult(const Vector2& a, const Vector2& b)
{
return Point(a.x * b.x, a.y * b.y);
return Vector2(a.x * b.x, a.y * b.y);
}
/** @returns the signed angle in radians between two vector directions
@since v0.99.1
*/
CC_DEPRECATED_ATTRIBUTE static inline float ccpAngleSigned(const Point& a, const Point& b)
CC_DEPRECATED_ATTRIBUTE static inline float ccpAngleSigned(const Vector2& a, const Vector2& b)
{
return a.getAngle(b);
}
@ -312,7 +312,7 @@ CC_DEPRECATED_ATTRIBUTE static inline float ccpAngleSigned(const Point& a, const
/** @returns the angle in radians between two vector directions
@since v0.99.1
*/
CC_DEPRECATED_ATTRIBUTE static inline float ccpAngle(const Point& a, const Point& b)
CC_DEPRECATED_ATTRIBUTE static inline float ccpAngle(const Vector2& a, const Vector2& b)
{
return a.getAngle(b);
}
@ -324,7 +324,7 @@ CC_DEPRECATED_ATTRIBUTE static inline float ccpAngle(const Point& a, const Point
@returns the rotated point
@since v0.99.1
*/
CC_DEPRECATED_ATTRIBUTE static inline Point ccpRotateByAngle(const Point& v, const Point& pivot, float angle)
CC_DEPRECATED_ATTRIBUTE static inline Vector2 ccpRotateByAngle(const Vector2& v, const Vector2& pivot, float angle)
{
return v.rotateByAngle(pivot, angle);
}
@ -350,34 +350,34 @@ CC_DEPRECATED_ATTRIBUTE static inline Point ccpRotateByAngle(const Point& v, con
the hit point also is p1 + s * (p2 - p1);
@since v0.99.1
*/
CC_DEPRECATED_ATTRIBUTE static inline bool ccpLineIntersect(const Point& p1, const Point& p2,
const Point& p3, const Point& p4,
CC_DEPRECATED_ATTRIBUTE static inline bool ccpLineIntersect(const Vector2& p1, const Vector2& p2,
const Vector2& p3, const Vector2& p4,
float *s, float *t)
{
return Point::isLineIntersect(p1, p2, p3, p4, s, t);
return Vector2::isLineIntersect(p1, p2, p3, p4, s, t);
}
/*
ccpSegmentIntersect returns true if Segment A-B intersects with segment C-D
@since v1.0.0
*/
CC_DEPRECATED_ATTRIBUTE static inline bool ccpSegmentIntersect(const Point& A, const Point& B, const Point& C, const Point& D)
CC_DEPRECATED_ATTRIBUTE static inline bool ccpSegmentIntersect(const Vector2& A, const Vector2& B, const Vector2& C, const Vector2& D)
{
return Point::isSegmentIntersect(A, B, C, D);
return Vector2::isSegmentIntersect(A, B, C, D);
}
/*
ccpIntersectPoint returns the intersection point of line A-B, C-D
@since v1.0.0
*/
CC_DEPRECATED_ATTRIBUTE static inline Point ccpIntersectPoint(const Point& A, const Point& B, const Point& C, const Point& D)
CC_DEPRECATED_ATTRIBUTE static inline Vector2 ccpIntersectPoint(const Vector2& A, const Vector2& B, const Vector2& C, const Vector2& D)
{
return Point::getIntersectPoint(A, B, C, D);
return Vector2::getIntersectPoint(A, B, C, D);
}
CC_DEPRECATED_ATTRIBUTE inline Point CCPointMake(float x, float y)
CC_DEPRECATED_ATTRIBUTE inline Vector2 CCPointMake(float x, float y)
{
return Point(x, y);
return Vector2(x, y);
}
CC_DEPRECATED_ATTRIBUTE inline Size CCSizeMake(float width, float height)
@ -391,7 +391,7 @@ CC_DEPRECATED_ATTRIBUTE inline Rect CCRectMake(float x, float y, float width, fl
}
CC_DEPRECATED_ATTRIBUTE extern const Point CCPointZero;
CC_DEPRECATED_ATTRIBUTE extern const Vector2 CCPointZero;
/* The "zero" size -- equivalent to Size(0, 0). */
CC_DEPRECATED_ATTRIBUTE extern const Size CCSizeZero;
@ -477,7 +477,7 @@ CC_DEPRECATED_ATTRIBUTE static inline AffineTransform CCAffineTransformMake(floa
return AffineTransformMake(a, b, c, d, tx, ty);
}
CC_DEPRECATED_ATTRIBUTE static inline Point CCPointApplyAffineTransform(const Point& point, const AffineTransform& t)
CC_DEPRECATED_ATTRIBUTE static inline Vector2 CCPointApplyAffineTransform(const Vector2& point, const AffineTransform& t)
{
return PointApplyAffineTransform(point, t);
}
@ -769,7 +769,7 @@ CC_DEPRECATED_ATTRIBUTE typedef GLView CCEGLView;
CC_DEPRECATED_ATTRIBUTE typedef Component CCComponent;
CC_DEPRECATED_ATTRIBUTE typedef AffineTransform CCAffineTransform;
CC_DEPRECATED_ATTRIBUTE typedef Point CCPoint;
CC_DEPRECATED_ATTRIBUTE typedef Vector2 CCPoint;
CC_DEPRECATED_ATTRIBUTE typedef Size CCSize;
CC_DEPRECATED_ATTRIBUTE typedef Rect CCRect;
CC_DEPRECATED_ATTRIBUTE typedef Color3B ccColor3B;
@ -989,19 +989,19 @@ CC_DEPRECATED_ATTRIBUTE void CC_DLL CCLog(const char * pszFormat, ...) CC_FORMAT
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawInit();
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawFree();
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawPoint( const Point& point );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawPoints( const Point *points, unsigned int numberOfPoints );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawLine( const Point& origin, const Point& destination );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawRect( Point origin, Point destination );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawSolidRect( Point origin, Point destination, Color4F color );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawPoly( const Point *vertices, unsigned int numOfVertices, bool closePolygon );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawSolidPoly( const Point *poli, unsigned int numberOfPoints, Color4F color );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawCircle( const Point& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY);
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawCircle( const Point& center, float radius, float angle, unsigned int segments, bool drawLineToCenter);
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawSolidCircle( const Point& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY);
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawSolidCircle( const Point& center, float radius, float angle, unsigned int segments);
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawQuadBezier(const Point& origin, const Point& control, const Point& destination, unsigned int segments);
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawCubicBezier(const Point& origin, const Point& control1, const Point& control2, const Point& destination, unsigned int segments);
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawPoint( const Vector2& point );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawPoints( const Vector2 *points, unsigned int numberOfPoints );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawLine( const Vector2& origin, const Vector2& destination );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawRect( Vector2 origin, Vector2 destination );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawSolidRect( Vector2 origin, Vector2 destination, Color4F color );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawPoly( const Vector2 *vertices, unsigned int numOfVertices, bool closePolygon );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawSolidPoly( const Vector2 *poli, unsigned int numberOfPoints, Color4F color );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawCircle( const Vector2& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY);
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawCircle( const Vector2& center, float radius, float angle, unsigned int segments, bool drawLineToCenter);
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawSolidCircle( const Vector2& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY);
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawSolidCircle( const Vector2& center, float radius, float angle, unsigned int segments);
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawQuadBezier(const Vector2& origin, const Vector2& control, const Vector2& destination, unsigned int segments);
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawCubicBezier(const Vector2& origin, const Vector2& control1, const Vector2& control2, const Vector2& destination, unsigned int segments);
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawCatmullRom( PointArray *arrayOfControlPoints, unsigned int segments );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawCardinalSpline( PointArray *config, float tension, unsigned int segments );
CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawColor4B( GLubyte r, GLubyte g, GLubyte b, GLubyte a );

View File

@ -29,7 +29,7 @@ class ControlButtonLoader : public ControlLoader {
virtual void onHandlePropTypeString(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const char * pString, CCBReader * ccbReader);
virtual void onHandlePropTypeFontTTF(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * ccbReader);
virtual void onHandlePropTypeFloatScale(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, float pFloatScale, CCBReader * ccbReader);
virtual void onHandlePropTypePoint(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::Point pPoint, CCBReader * ccbReader);
virtual void onHandlePropTypePoint(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::Vector2 pPoint, CCBReader * ccbReader);
virtual void onHandlePropTypeSize(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::Size pSize, CCBReader * ccbReader);
virtual void onHandlePropTypeSpriteFrame(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::SpriteFrame * pSpriteFrame, CCBReader * ccbReader);
virtual void onHandlePropTypeColor3(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::Color3B pColor3B, CCBReader * ccbReader);

View File

@ -22,7 +22,7 @@ protected:
virtual void onHandlePropTypeColor3(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::Color3B pColor3B, CCBReader * ccbReader);
virtual void onHandlePropTypeByte(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader);
virtual void onHandlePropTypePoint(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::Point pPoint, CCBReader * ccbReader);
virtual void onHandlePropTypePoint(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::Vector2 pPoint, CCBReader * ccbReader);
virtual void onHandlePropTypeBlendFunc(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::BlendFunc pBlendFunc, CCBReader * ccbReader);
};

View File

@ -5,7 +5,7 @@
namespace cocosbuilder {
extern cocos2d::Point getAbsolutePosition(const cocos2d::Point &pt, CCBReader::PositionType type, const cocos2d::Size &containerSize, const std::string&propName);
extern cocos2d::Vector2 getAbsolutePosition(const cocos2d::Vector2 &pt, CCBReader::PositionType type, const cocos2d::Size &containerSize, const std::string&propName);
extern void setRelativeScale(cocos2d::Node *node, float scaleX, float scaleY, CCBReader::ScaleType type, const std::string& propName);

View File

@ -78,9 +78,9 @@ class NodeLoader : public cocos2d::Ref {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::Node);
virtual cocos2d::Point parsePropTypePosition(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual cocos2d::Point parsePropTypePoint(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual cocos2d::Point parsePropTypePointLock(cocos2d::Node * pNode,cocos2d:: Node * pParent, CCBReader * ccbReader);
virtual cocos2d::Vector2 parsePropTypePosition(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual cocos2d::Vector2 parsePropTypePoint(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual cocos2d::Vector2 parsePropTypePointLock(cocos2d::Node * pNode,cocos2d:: Node * pParent, CCBReader * ccbReader);
virtual cocos2d::Size parsePropTypeSize(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual float * parsePropTypeScaleLock(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual float parsePropTypeFloat(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
@ -108,9 +108,9 @@ class NodeLoader : public cocos2d::Ref {
virtual float * parsePropTypeFloatXY(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual void onHandlePropTypePosition(cocos2d::Node * pNode,cocos2d:: Node * pParent, const char* pPropertyName, cocos2d::Point pPosition, CCBReader * ccbReader);
virtual void onHandlePropTypePoint(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, cocos2d::Point pPoint, CCBReader * ccbReader);
virtual void onHandlePropTypePointLock(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, cocos2d::Point pPointLock, CCBReader * ccbReader);
virtual void onHandlePropTypePosition(cocos2d::Node * pNode,cocos2d:: Node * pParent, const char* pPropertyName, cocos2d::Vector2 pPosition, CCBReader * ccbReader);
virtual void onHandlePropTypePoint(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, cocos2d::Vector2 pPoint, CCBReader * ccbReader);
virtual void onHandlePropTypePointLock(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, cocos2d::Vector2 pPointLock, CCBReader * ccbReader);
virtual void onHandlePropTypeSize(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, cocos2d::Size pSize, CCBReader * ccbReader);
virtual void onHandlePropTypeScaleLock(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, float * pScaleLock, CCBReader * ccbReader);
virtual void onHandlePropTypeFloat(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, float pFloat, CCBReader * ccbReader);

View File

@ -39,7 +39,7 @@ protected:
* @js NA
* @lua NA
*/
virtual void onHandlePropTypePoint(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::Point pPoint, CCBReader * ccbReader);
virtual void onHandlePropTypePoint(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::Vector2 pPoint, CCBReader * ccbReader);
/**
* @js NA
* @lua NA

View File

@ -271,7 +271,7 @@ protected:
cocos2d::BlendFunc _blendFunc; //! It's required for CCTextureProtocol inheritance
cocos2d::Point _offsetPoint;
cocos2d::Vector2 _offsetPoint;
Vector2 _realAnchorPointInPoints;
ArmatureAnimation *_animation;

View File

@ -107,7 +107,7 @@ public:
virtual void setShape(cpShape *shape) { _shape = shape; }
virtual cpShape *getShape() const { return _shape; }
#elif ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX
virtual const std::vector<cocos2d::Point> &getCalculatedVertexList() const { return _calculatedVertexList; }
virtual const std::vector<cocos2d::Vector2> &getCalculatedVertexList() const { return _calculatedVertexList; }
#endif
private:
@ -119,7 +119,7 @@ private:
cpShape *_shape;
ColliderFilter *_filter;
#elif ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX
std::vector<cocos2d::Point> _calculatedVertexList;
std::vector<cocos2d::Vector2> _calculatedVertexList;
#endif
ContourData *_contourData;

View File

@ -502,9 +502,9 @@ public:
~ContourData(void);
virtual bool init();
virtual void addVertex(cocos2d::Point &vertex);
virtual void addVertex(cocos2d::Vector2 &vertex);
public:
std::vector<cocos2d::Point> vertexList; //! Save contour vertex info, vertex saved in a Point
std::vector<cocos2d::Vector2> vertexList; //! Save contour vertex info, vertex saved in a Vector2
};

View File

@ -125,7 +125,7 @@ public:
/**
* Check if the position is inside the bone.
*/
virtual bool containPoint(cocos2d::Point &_point);
virtual bool containPoint(cocos2d::Vector2 &_point);
/**
* Check if the position is inside the bone.

View File

@ -59,8 +59,8 @@ public:
static cocos2d::AffineTransform helpMatrix1;
static cocos2d::AffineTransform helpMatrix2;
static cocos2d::Point helpPoint1;
static cocos2d::Point helpPoint2;
static cocos2d::Vector2 helpPoint1;
static cocos2d::Vector2 helpPoint2;
};
}

View File

@ -37,18 +37,18 @@ namespace cocostudio {
//! hit test function
bool isSpriteContainPoint(cocos2d::Sprite *sprite, cocos2d::Point point);
bool isSpriteContainPoint(cocos2d::Sprite *sprite, cocos2d::Point point, cocos2d::Point &outPoint);
bool isSpriteContainPoint(cocos2d::Sprite *sprite, cocos2d::Vector2 point);
bool isSpriteContainPoint(cocos2d::Sprite *sprite, cocos2d::Vector2 point, cocos2d::Vector2 &outPoint);
#define CC_SPRITE_CONTAIN_POINT(sprite, point) isSpriteContainPoint((sprite), (point))
#define CC_SPRITE_CONTAIN_POINT_WITH_RETURN(sprite, point, outPoint) isSpriteContainPoint((sprite), (point), outPoint)
//! motion curve function
cocos2d::Point bezierTo(float t, cocos2d::Point &point1, cocos2d::Point &point2, cocos2d::Point &point3);
cocos2d::Point bezierTo(float t, cocos2d::Point &point1, cocos2d::Point &point2, cocos2d::Point &point3, cocos2d::Point &point4);
cocos2d::Vector2 bezierTo(float t, cocos2d::Vector2 &point1, cocos2d::Vector2 &point2, cocos2d::Vector2 &point3);
cocos2d::Vector2 bezierTo(float t, cocos2d::Vector2 &point1, cocos2d::Vector2 &point2, cocos2d::Vector2 &point3, cocos2d::Vector2 &point4);
cocos2d::Point circleTo(float t, cocos2d::Point &center, float radius, float fromRadian, float radianDif);
cocos2d::Vector2 circleTo(float t, cocos2d::Vector2 &center, float radius, float fromRadian, float radianDif);
}

View File

@ -41,7 +41,7 @@ class PhysicsWorld;
class PhysicsJoint;
class PhysicsBodyInfo;
typedef Point Vect;
typedef Vector2 Vect;
const PhysicsMaterial PHYSICSBODY_MATERIAL_DEFAULT(0.1f, 0.5f, 0.5f);
@ -63,23 +63,23 @@ public:
/** create a body with mass and moment. */
static PhysicsBody* create(float mass, float moment);
/** Create a body contains a circle shape. */
static PhysicsBody* createCircle(float radius, const PhysicsMaterial& material = PHYSICSBODY_MATERIAL_DEFAULT, const Point& offset = Point::ZERO);
static PhysicsBody* createCircle(float radius, const PhysicsMaterial& material = PHYSICSBODY_MATERIAL_DEFAULT, const Vector2& offset = Vector2::ZERO);
/** Create a body contains a box shape. */
static PhysicsBody* createBox(const Size& size, const PhysicsMaterial& material = PHYSICSBODY_MATERIAL_DEFAULT, const Point& offset = Point::ZERO);
static PhysicsBody* createBox(const Size& size, const PhysicsMaterial& material = PHYSICSBODY_MATERIAL_DEFAULT, const Vector2& offset = Vector2::ZERO);
/**
* @brief Create a body contains a polygon shape.
* points is an array of Point structs defining a convex hull with a clockwise winding.
* points is an array of Vector2 structs defining a convex hull with a clockwise winding.
*/
static PhysicsBody* createPolygon(const Point* points, int count, const PhysicsMaterial& material = PHYSICSBODY_MATERIAL_DEFAULT, const Point& offset = Point::ZERO);
static PhysicsBody* createPolygon(const Vector2* points, int count, const PhysicsMaterial& material = PHYSICSBODY_MATERIAL_DEFAULT, const Vector2& offset = Vector2::ZERO);
/** Create a body contains a EdgeSegment shape. */
static PhysicsBody* createEdgeSegment(const Point& a, const Point& b, const PhysicsMaterial& material = PHYSICSBODY_MATERIAL_DEFAULT, float border = 1);
static PhysicsBody* createEdgeSegment(const Vector2& a, const Vector2& b, const PhysicsMaterial& material = PHYSICSBODY_MATERIAL_DEFAULT, float border = 1);
/** Create a body contains a EdgeBox shape. */
static PhysicsBody* createEdgeBox(const Size& size, const PhysicsMaterial& material = PHYSICSBODY_MATERIAL_DEFAULT, float border = 1, const Point& offset = Point::ZERO);
static PhysicsBody* createEdgeBox(const Size& size, const PhysicsMaterial& material = PHYSICSBODY_MATERIAL_DEFAULT, float border = 1, const Vector2& offset = Vector2::ZERO);
/** Create a body contains a EdgePolygon shape. */
static PhysicsBody* createEdgePolygon(const Point* points, int count, const PhysicsMaterial& material = PHYSICSBODY_MATERIAL_DEFAULT, float border = 1);
static PhysicsBody* createEdgePolygon(const Vector2* points, int count, const PhysicsMaterial& material = PHYSICSBODY_MATERIAL_DEFAULT, float border = 1);
/** Create a body contains a EdgeChain shape. */
static PhysicsBody* createEdgeChain(const Point* points, int count, const PhysicsMaterial& material = PHYSICSBODY_MATERIAL_DEFAULT, float border = 1);
static PhysicsBody* createEdgeChain(const Vector2* points, int count, const PhysicsMaterial& material = PHYSICSBODY_MATERIAL_DEFAULT, float border = 1);
/*
* @brief add a shape to body
@ -111,26 +111,26 @@ public:
/** Applies a immediate force to body. */
virtual void applyForce(const Vect& force);
/** Applies a immediate force to body. */
virtual void applyForce(const Vect& force, const Point& offset);
virtual void applyForce(const Vect& force, const Vector2& offset);
/** reset all the force applied to body. */
virtual void resetForces();
/** Applies a continuous force to body. */
virtual void applyImpulse(const Vect& impulse);
/** Applies a continuous force to body. */
virtual void applyImpulse(const Vect& impulse, const Point& offset);
virtual void applyImpulse(const Vect& impulse, const Vector2& offset);
/** Applies a torque force to body. */
virtual void applyTorque(float torque);
/** set the velocity of a body */
virtual void setVelocity(const Vect& velocity);
/** get the velocity of a body */
virtual Point getVelocity();
virtual Vector2 getVelocity();
/** set the angular velocity of a body */
virtual void setAngularVelocity(float velocity);
/** get the angular velocity of a body at a local point */
virtual Point getVelocityAtLocalPoint(const Point& point);
virtual Vector2 getVelocityAtLocalPoint(const Vector2& point);
/** get the angular velocity of a body at a world point */
virtual Point getVelocityAtWorldPoint(const Point& point);
virtual Vector2 getVelocityAtWorldPoint(const Vector2& point);
/** get the angular velocity of a body */
virtual float getAngularVelocity();
/** set the max of velocity */
@ -193,9 +193,9 @@ public:
float getRotation() const;
/** set body position offset, it's the position witch relative to node */
void setPositionOffset(const Point& position);
void setPositionOffset(const Vector2& position);
/** get body position offset. */
Point getPositionOffset() const;
Vector2 getPositionOffset() const;
/** set body rotation offset, it's the rotation witch relative to node */
void setRotationOffset(float rotation);
/** set the body rotation offset */
@ -293,9 +293,9 @@ public:
inline void setTag(int tag) { _tag = tag; }
/** convert the world point to local */
Point world2Local(const Point& point);
Vector2 world2Local(const Vector2& point);
/** convert the local point to world */
Point local2World(const Point& point);
Vector2 local2World(const Vector2& point);
protected:
@ -342,7 +342,7 @@ protected:
bool _positionResetTag; /// To avoid reset the body position when body invoke Node::setPosition().
bool _rotationResetTag; /// To avoid reset the body rotation when body invoke Node::setRotation().
Point _positionOffset;
Vector2 _positionOffset;
float _rotationOffset;
friend class PhysicsWorld;

View File

@ -42,14 +42,14 @@ class PhysicsWorld;
class PhysicsContactInfo;
typedef Point Vect;
typedef Vector2 Vect;
typedef struct PhysicsContactData
{
static const int POINT_MAX = 4;
Point points[POINT_MAX];
Vector2 points[POINT_MAX];
int count;
Point normal;
Vector2 normal;
PhysicsContactData()
: count(0)
@ -137,7 +137,7 @@ public:
/** get friction between two bodies*/
float getFriction() const;
/** get surface velocity between two bodies*/
Point getSurfaceVelocity() const;
Vector2 getSurfaceVelocity() const;
/** set the restitution*/
void setRestitution(float restitution);
/** set the friction*/
@ -168,7 +168,7 @@ public:
/** get friction between two bodies*/
float getFriction() const;
/** get surface velocity between two bodies*/
Point getSurfaceVelocity() const;
Vector2 getSurfaceVelocity() const;
private:
PhysicsContactPostSolve(void* contactInfo);

View File

@ -100,10 +100,10 @@ protected:
class PhysicsJointFixed : public PhysicsJoint
{
public:
static PhysicsJointFixed* construct(PhysicsBody* a, PhysicsBody* b, const Point& anchr);
static PhysicsJointFixed* construct(PhysicsBody* a, PhysicsBody* b, const Vector2& anchr);
protected:
bool init(PhysicsBody* a, PhysicsBody* b, const Point& anchr);
bool init(PhysicsBody* a, PhysicsBody* b, const Vector2& anchr);
protected:
PhysicsJointFixed() {}
@ -116,20 +116,20 @@ protected:
class PhysicsJointLimit : public PhysicsJoint
{
public:
static PhysicsJointLimit* construct(PhysicsBody* a, PhysicsBody* b, const Point& anchr1, const Point& anchr2);
static PhysicsJointLimit* construct(PhysicsBody* a, PhysicsBody* b, const Point& anchr1, const Point& anchr2, float min, float max);
static PhysicsJointLimit* construct(PhysicsBody* a, PhysicsBody* b, const Vector2& anchr1, const Vector2& anchr2);
static PhysicsJointLimit* construct(PhysicsBody* a, PhysicsBody* b, const Vector2& anchr1, const Vector2& anchr2, float min, float max);
Point getAnchr1() const;
void setAnchr1(const Point& anchr1);
Point getAnchr2() const;
void setAnchr2(const Point& anchr2);
Vector2 getAnchr1() const;
void setAnchr1(const Vector2& anchr1);
Vector2 getAnchr2() const;
void setAnchr2(const Vector2& anchr2);
float getMin() const;
void setMin(float min);
float getMax() const;
void setMax(float max);
protected:
bool init(PhysicsBody* a, PhysicsBody* b, const Point& anchr1, const Point& anchr2, float min, float max);
bool init(PhysicsBody* a, PhysicsBody* b, const Vector2& anchr1, const Vector2& anchr2, float min, float max);
protected:
PhysicsJointLimit() {}
@ -142,10 +142,10 @@ protected:
class PhysicsJointPin : public PhysicsJoint
{
public:
static PhysicsJointPin* construct(PhysicsBody* a, PhysicsBody* b, const Point& anchr);
static PhysicsJointPin* construct(PhysicsBody* a, PhysicsBody* b, const Vector2& anchr);
protected:
bool init(PhysicsBody* a, PhysicsBody* b, const Point& anchr);
bool init(PhysicsBody* a, PhysicsBody* b, const Vector2& anchr);
protected:
PhysicsJointPin() {}
@ -156,13 +156,13 @@ protected:
class PhysicsJointDistance : public PhysicsJoint
{
public:
static PhysicsJointDistance* construct(PhysicsBody* a, PhysicsBody* b, const Point& anchr1, const Point& anchr2);
static PhysicsJointDistance* construct(PhysicsBody* a, PhysicsBody* b, const Vector2& anchr1, const Vector2& anchr2);
float getDistance() const;
void setDistance(float distance);
protected:
bool init(PhysicsBody* a, PhysicsBody* b, const Point& anchr1, const Point& anchr2);
bool init(PhysicsBody* a, PhysicsBody* b, const Vector2& anchr1, const Vector2& anchr2);
protected:
PhysicsJointDistance() {}
@ -173,11 +173,11 @@ protected:
class PhysicsJointSpring : public PhysicsJoint
{
public:
static PhysicsJointSpring* construct(PhysicsBody* a, PhysicsBody* b, const Point& anchr1, const Point& anchr2, float stiffness, float damping);
Point getAnchr1() const;
void setAnchr1(const Point& anchr1);
Point getAnchr2() const;
void setAnchr2(const Point& anchr2);
static PhysicsJointSpring* construct(PhysicsBody* a, PhysicsBody* b, const Vector2& anchr1, const Vector2& anchr2, float stiffness, float damping);
Vector2 getAnchr1() const;
void setAnchr1(const Vector2& anchr1);
Vector2 getAnchr2() const;
void setAnchr2(const Vector2& anchr2);
float getRestLength() const;
void setRestLength(float restLength);
float getStiffness() const;
@ -186,7 +186,7 @@ public:
void setDamping(float damping);
protected:
bool init(PhysicsBody* a, PhysicsBody* b, const Point& anchr1, const Point& anchr2, float stiffness, float damping);
bool init(PhysicsBody* a, PhysicsBody* b, const Vector2& anchr1, const Vector2& anchr2, float stiffness, float damping);
protected:
PhysicsJointSpring() {}
@ -197,17 +197,17 @@ protected:
class PhysicsJointGroove : public PhysicsJoint
{
public:
static PhysicsJointGroove* construct(PhysicsBody* a, PhysicsBody* b, const Point& grooveA, const Point& grooveB, const Point& anchr2);
static PhysicsJointGroove* construct(PhysicsBody* a, PhysicsBody* b, const Vector2& grooveA, const Vector2& grooveB, const Vector2& anchr2);
Point getGrooveA() const;
void setGrooveA(const Point& grooveA);
Point getGrooveB() const;
void setGrooveB(const Point& grooveB);
Point getAnchr2() const;
void setAnchr2(const Point& anchr2);
Vector2 getGrooveA() const;
void setGrooveA(const Vector2& grooveA);
Vector2 getGrooveB() const;
void setGrooveB(const Vector2& grooveB);
Vector2 getAnchr2() const;
void setAnchr2(const Vector2& anchr2);
protected:
bool init(PhysicsBody* a, PhysicsBody* b, const Point& grooveA, const Point& grooveB, const Point& anchr);
bool init(PhysicsBody* a, PhysicsBody* b, const Vector2& grooveA, const Vector2& grooveB, const Vector2& anchr);
protected:
PhysicsJointGroove() {}

View File

@ -107,16 +107,16 @@ public:
/** Calculate the default moment value */
virtual float calculateDefaultMoment() { return 0.0f; }
/** Get offset */
virtual Point getOffset() { return Point::ZERO; }
virtual Vector2 getOffset() { return Vector2::ZERO; }
/** Get center of this shape */
virtual Point getCenter() { return getOffset(); }
virtual Vector2 getCenter() { return getOffset(); }
/** Test point is in shape or not */
bool containsPoint(const Point& point) const;
bool containsPoint(const Vector2& point) const;
/** move the points to the center */
static void recenterPoints(Point* points, int count, const Point& center = Point::ZERO);
static void recenterPoints(Vector2* points, int count, const Vector2& center = Vector2::ZERO);
/** get center of the polyon points */
static Point getPolyonCenter(const Point* points, int count);
static Vector2 getPolyonCenter(const Vector2* points, int count);
/**
* A mask that defines which categories this physics body belongs to.
@ -184,16 +184,16 @@ protected:
class PhysicsShapeCircle : public PhysicsShape
{
public:
static PhysicsShapeCircle* create(float radius, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Point& offset = Point(0, 0));
static PhysicsShapeCircle* create(float radius, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Vector2& offset = Vector2(0, 0));
static float calculateArea(float radius);
static float calculateMoment(float mass, float radius, const Point& offset = Point::ZERO);
static float calculateMoment(float mass, float radius, const Vector2& offset = Vector2::ZERO);
virtual float calculateDefaultMoment() override;
float getRadius() const;
virtual Point getOffset() override;
virtual Vector2 getOffset() override;
protected:
bool init(float radius, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Point& offset = Point::ZERO);
bool init(float radius, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Vector2& offset = Vector2::ZERO);
virtual float calculateArea() override;
protected:
@ -205,19 +205,19 @@ protected:
class PhysicsShapeBox : public PhysicsShape
{
public:
static PhysicsShapeBox* create(const Size& size, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Point& offset = Point::ZERO);
static PhysicsShapeBox* create(const Size& size, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Vector2& offset = Vector2::ZERO);
static float calculateArea(const Size& size);
static float calculateMoment(float mass, const Size& size, const Point& offset = Point::ZERO);
static float calculateMoment(float mass, const Size& size, const Vector2& offset = Vector2::ZERO);
virtual float calculateDefaultMoment() override;
void getPoints(Point* outPoints) const;
void getPoints(Vector2* outPoints) const;
int getPointsCount() const { return 4; }
Size getSize() const;
virtual Point getOffset() override { return _offset; }
virtual Vector2 getOffset() override { return _offset; }
protected:
bool init(const Size& size, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Point& offset = Point::ZERO);
bool init(const Size& size, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Vector2& offset = Vector2::ZERO);
virtual float calculateArea() override;
protected:
@ -225,25 +225,25 @@ protected:
virtual ~PhysicsShapeBox();
protected:
Point _offset;
Vector2 _offset;
};
/** A polygon shape */
class PhysicsShapePolygon : public PhysicsShape
{
public:
static PhysicsShapePolygon* create(const Point* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Point& offset = Point::ZERO);
static float calculateArea(const Point* points, int count);
static float calculateMoment(float mass, const Point* points, int count, const Point& offset = Point::ZERO);
static PhysicsShapePolygon* create(const Vector2* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Vector2& offset = Vector2::ZERO);
static float calculateArea(const Vector2* points, int count);
static float calculateMoment(float mass, const Vector2* points, int count, const Vector2& offset = Vector2::ZERO);
float calculateDefaultMoment() override;
Point getPoint(int i) const;
void getPoints(Point* outPoints) const;
Vector2 getPoint(int i) const;
void getPoints(Vector2* outPoints) const;
int getPointsCount() const;
virtual Point getCenter() override;
virtual Vector2 getCenter() override;
protected:
bool init(const Point* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Point& offset = Point::ZERO);
bool init(const Vector2* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Vector2& offset = Vector2::ZERO);
float calculateArea() override;
protected:
@ -251,28 +251,28 @@ protected:
virtual ~PhysicsShapePolygon();
protected:
Point _center;
Vector2 _center;
};
/** A segment shape */
class PhysicsShapeEdgeSegment : public PhysicsShape
{
public:
static PhysicsShapeEdgeSegment* create(const Point& a, const Point& b, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
static PhysicsShapeEdgeSegment* create(const Vector2& a, const Vector2& b, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
Point getPointA() const;
Point getPointB() const;
virtual Point getCenter() override;
Vector2 getPointA() const;
Vector2 getPointB() const;
virtual Vector2 getCenter() override;
protected:
bool init(const Point& a, const Point& b, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
bool init(const Vector2& a, const Vector2& b, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
protected:
PhysicsShapeEdgeSegment();
virtual ~PhysicsShapeEdgeSegment();
protected:
Point _center;
Vector2 _center;
friend class PhysicsBody;
};
@ -281,20 +281,20 @@ protected:
class PhysicsShapeEdgeBox : public PhysicsShape
{
public:
static PhysicsShapeEdgeBox* create(const Size& size, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 0, const Point& offset = Point::ZERO);
virtual Point getOffset() override { return _offset; }
void getPoints(Point* outPoints) const;
static PhysicsShapeEdgeBox* create(const Size& size, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 0, const Vector2& offset = Vector2::ZERO);
virtual Vector2 getOffset() override { return _offset; }
void getPoints(Vector2* outPoints) const;
int getPointsCount() const { return 4; }
protected:
bool init(const Size& size, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1, const Point& offset = Point::ZERO);
bool init(const Size& size, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1, const Vector2& offset = Vector2::ZERO);
protected:
PhysicsShapeEdgeBox();
virtual ~PhysicsShapeEdgeBox();
protected:
Point _offset;
Vector2 _offset;
friend class PhysicsBody;
};
@ -303,13 +303,13 @@ protected:
class PhysicsShapeEdgePolygon : public PhysicsShape
{
public:
static PhysicsShapeEdgePolygon* create(const Point* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
virtual Point getCenter() override;
void getPoints(Point* outPoints) const;
static PhysicsShapeEdgePolygon* create(const Vector2* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
virtual Vector2 getCenter() override;
void getPoints(Vector2* outPoints) const;
int getPointsCount() const;
protected:
bool init(const Point* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
bool init(const Vector2* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
protected:
PhysicsShapeEdgePolygon();
@ -318,27 +318,27 @@ protected:
friend class PhysicsBody;
protected:
Point _center;
Vector2 _center;
};
/** a chain shape */
class PhysicsShapeEdgeChain : public PhysicsShape
{
public:
static PhysicsShapeEdgeChain* create(const Point* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
virtual Point getCenter() override;
void getPoints(Point* outPoints) const;
static PhysicsShapeEdgeChain* create(const Vector2* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
virtual Vector2 getCenter() override;
void getPoints(Vector2* outPoints) const;
int getPointsCount() const;
protected:
bool init(const Point* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
bool init(const Vector2* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
protected:
PhysicsShapeEdgeChain();
virtual ~PhysicsShapeEdgeChain();
protected:
Point _center;
Vector2 _center;
friend class PhysicsBody;
};

View File

@ -42,7 +42,7 @@ class PhysicsWorldInfo;
class PhysicsShape;
class PhysicsContact;
typedef Point Vect;
typedef Vector2 Vect;
class Node;
class Sprite;
@ -55,9 +55,9 @@ class PhysicsWorld;
typedef struct PhysicsRayCastInfo
{
PhysicsShape* shape;
Point start;
Point end; //< in lua, it's name is "ended"
Point contact;
Vector2 start;
Vector2 end; //< in lua, it's name is "ended"
Vector2 contact;
Vect normal;
float fraction;
void* data;
@ -105,15 +105,15 @@ public:
virtual void removeAllBodies();
/** Searches for physics shapes that intersects the ray. */
void rayCast(PhysicsRayCastCallbackFunc func, const Point& start, const Point& end, void* data);
void rayCast(PhysicsRayCastCallbackFunc func, const Vector2& start, const Vector2& end, void* data);
/** Searches for physics shapes that contains in the rect. */
void queryRect(PhysicsQueryRectCallbackFunc func, const Rect& rect, void* data);
/** Searches for physics shapes that contains the point. */
void queryPoint(PhysicsQueryPointCallbackFunc func, const Point& point, void* data);
void queryPoint(PhysicsQueryPointCallbackFunc func, const Vector2& point, void* data);
/** Get phsyics shapes that contains the point. */
Vector<PhysicsShape*> getShapes(const Point& point) const;
Vector<PhysicsShape*> getShapes(const Vector2& point) const;
/** return physics shape that contains the point. */
PhysicsShape* getShape(const Point& point) const;
PhysicsShape* getShape(const Vector2& point) const;
/** Get all the bodys that in the physics world. */
const Vector<PhysicsBody*>& getAllBodies() const;
/** Get body by tag */

View File

@ -37,8 +37,8 @@ NS_CC_BEGIN
class PhysicsHelper
{
public:
static Point cpv2point(const cpVect& vec) { return Point(vec.x, vec.y); }
static cpVect point2cpv(const Point& point) { return cpv(point.x, point.y); }
static Vector2 cpv2point(const cpVect& vec) { return Vector2(vec.x, vec.y); }
static cpVect point2cpv(const Vector2& point) { return cpv(point.x, point.y); }
static Size cpv2size(const cpVect& vec) { return Size(vec.x, vec.y); }
static cpVect size2cpv(const Size& size) { return cpv(size.width, size.height); }
static float cpfloat2float(cpFloat f) { return f; }
@ -46,7 +46,7 @@ public:
static cpBB rect2cpbb(const Rect& rect) { return cpBBNew(rect.origin.x, rect.origin.y, rect.origin.x + rect.size.width, rect.origin.y + rect.size.height); }
static Rect cpbb2rect(const cpBB& bb) { return Rect(bb.l, bb.b, bb.r - bb.l, bb.t - bb.b); }
static Point* cpvs2points(const cpVect* cpvs, Point* out, int count)
static Vector2* cpvs2points(const cpVect* cpvs, Vector2* out, int count)
{
for (int i = 0; i < count; ++i)
{
@ -56,7 +56,7 @@ public:
return out;
}
static cpVect* points2cpvs(const Point* points, cpVect* out, int count)
static cpVect* points2cpvs(const Vector2* points, cpVect* out, int count)
{
for (int i = 0; i < count; ++i)
{

View File

@ -33,7 +33,7 @@
#include "CCPlatformMacros.h"
#include "CCGeometry.h"
NS_CC_BEGIN
typedef Point Vect;
typedef Vector2 Vect;
class PhysicsBodyInfo;
class PhysicsJointInfo;
class PhysicsShapeInfo;

View File

@ -152,9 +152,9 @@ public:
*
* @param vector
*/
void setBackGroundColorVector(const Point &vector);
void setBackGroundColorVector(const Vector2 &vector);
const Point& getBackGroundColorVector();
const Vector2& getBackGroundColorVector();
void setBackGroundImageColor(const Color3B& color);
@ -266,7 +266,7 @@ public:
virtual void onEnter() override;
virtual void onExit() override;
virtual bool hitTest(const Point &pt);
virtual bool hitTest(const Vector2 &pt);
CC_CONSTRUCTOR_ACCESS:
//override "init" method of widget.
@ -317,7 +317,7 @@ protected:
Color3B _cColor;
Color3B _gStartColor;
Color3B _gEndColor;
Point _alongVector;
Vector2 _alongVector;
GLubyte _cOpacity;
Size _backGroundImageTextureSize;
LayoutType _layoutType;

View File

@ -198,7 +198,7 @@ protected:
virtual void copySpecialProperties(Widget* model) override;
virtual void copyClonedWidgetChildren(Widget* model) override;
void selectedItemEvent(int state);
virtual void interceptTouchEvent(int handleState,Widget* sender,const Point &touchPoint) override;
virtual void interceptTouchEvent(int handleState,Widget* sender,const Vector2 &touchPoint) override;
protected:
Widget* _model;

View File

@ -181,11 +181,11 @@ protected:
Layout* createPage();
float getPositionXByIndex(ssize_t idx);
void updateBoundaryPages();
virtual void handlePressLogic(const Point &touchPoint) override;
virtual void handleMoveLogic(const Point &touchPoint) override;
virtual void handleReleaseLogic(const Point &touchPoint) override;
virtual void interceptTouchEvent(int handleState, Widget* sender, const Point &touchPoint) override;
virtual void checkChildInfo(int handleState, Widget* sender, const Point &touchPoint) override;
virtual void handlePressLogic(const Vector2 &touchPoint) override;
virtual void handleMoveLogic(const Vector2 &touchPoint) override;
virtual void handleReleaseLogic(const Vector2 &touchPoint) override;
virtual void interceptTouchEvent(int handleState, Widget* sender, const Vector2 &touchPoint) override;
virtual void checkChildInfo(int handleState, Widget* sender, const Vector2 &touchPoint) override;
virtual bool scrollPages(float touchOffset);
void movePages(float offset);
void pageTurningEvent();
@ -203,7 +203,7 @@ protected:
PVTouchDir _touchMoveDir;
float _touchStartLocation;
float _touchMoveStartLocation;
Point _movePagePoint;
Vector2 _movePagePoint;
Widget* _leftChild;
Widget* _rightChild;
float _leftBoundary;

View File

@ -37,10 +37,10 @@ public:
virtual ~UIScrollInterface() {}
protected:
virtual void handlePressLogic(const Point &touchPoint) = 0;
virtual void handleMoveLogic(const Point &touchPoint) = 0;
virtual void handleReleaseLogic(const Point &touchPoint) = 0;
virtual void interceptTouchEvent(int handleState, Widget* sender, const Point &touchPoint) = 0;
virtual void handlePressLogic(const Vector2 &touchPoint) = 0;
virtual void handleMoveLogic(const Vector2 &touchPoint) = 0;
virtual void handleReleaseLogic(const Vector2 &touchPoint) = 0;
virtual void interceptTouchEvent(int handleState, Widget* sender, const Vector2 &touchPoint) = 0;
};
}

View File

@ -167,7 +167,7 @@ public:
/**
* Scroll inner container to both direction percent position of scrollview.
*/
void scrollToPercentBothDirection(const Point& percent, float time, bool attenuated);
void scrollToPercentBothDirection(const Vector2& percent, float time, bool attenuated);
/**
* Move inner container to bottom boundary of scrollview.
@ -222,7 +222,7 @@ public:
/**
* Move inner container to both direction percent position of scrollview.
*/
void jumpToPercentBothDirection(const Point& percent);
void jumpToPercentBothDirection(const Vector2& percent);
/**
* Changes inner container size of scrollview.
@ -336,9 +336,9 @@ protected:
void bounceChildren(float dt);
void checkBounceBoundary();
bool checkNeedBounce();
void startAutoScrollChildrenWithOriginalSpeed(const Point& dir, float v, bool attenuated, float acceleration);
void startAutoScrollChildrenWithDestination(const Point& des, float time, bool attenuated);
void jumpToDestination(const Point& des);
void startAutoScrollChildrenWithOriginalSpeed(const Vector2& dir, float v, bool attenuated, float acceleration);
void startAutoScrollChildrenWithDestination(const Vector2& des, float time, bool attenuated);
void jumpToDestination(const Vector2& des);
void stopAutoScrollChildren();
void startBounceChildren(float v);
void stopBounceChildren();
@ -347,11 +347,11 @@ protected:
bool bounceScrollChildren(float touchOffsetX, float touchOffsetY);
void startRecordSlidAction();
virtual void endRecordSlidAction();
virtual void handlePressLogic(const Point &touchPoint) override;
virtual void handleMoveLogic(const Point &touchPoint) override;
virtual void handleReleaseLogic(const Point &touchPoint) override;
virtual void interceptTouchEvent(int handleState,Widget* sender,const Point &touchPoint) override;
virtual void checkChildInfo(int handleState,Widget* sender,const Point &touchPoint) override;
virtual void handlePressLogic(const Vector2 &touchPoint) override;
virtual void handleMoveLogic(const Vector2 &touchPoint) override;
virtual void handleReleaseLogic(const Vector2 &touchPoint) override;
virtual void interceptTouchEvent(int handleState,Widget* sender,const Vector2 &touchPoint) override;
virtual void checkChildInfo(int handleState,Widget* sender,const Vector2 &touchPoint) override;
void recordSlidTime(float dt);
void scrollToTopEvent();
void scrollToBottomEvent();
@ -373,11 +373,11 @@ protected:
SCROLLVIEW_DIR _direction;
Point _touchBeganPoint;
Point _touchMovedPoint;
Point _touchEndedPoint;
Point _touchMovingPoint;
Point _autoScrollDir;
Vector2 _touchBeganPoint;
Vector2 _touchMovedPoint;
Vector2 _touchEndedPoint;
Vector2 _touchMovingPoint;
Vector2 _autoScrollDir;
float _topBoundary;
float _bottomBoundary;
@ -397,11 +397,11 @@ protected:
float _autoScrollAcceleration;
bool _isAutoScrollSpeedAttenuated;
bool _needCheckAutoScrollDestination;
Point _autoScrollDestination;
Vector2 _autoScrollDestination;
bool _bePressed;
float _slidTime;
Point _moveChildPoint;
Vector2 _moveChildPoint;
float _childFocusCancelOffset;
bool _leftBounceNeeded;
@ -411,7 +411,7 @@ protected:
bool _bounceEnabled;
bool _bouncing;
Point _bounceDir;
Vector2 _bounceDir;
float _bounceOriginalSpeed;
bool _inertiaScrollEnabled;

View File

@ -193,7 +193,7 @@ public:
virtual void ignoreContentAdaptWithSize(bool ignore) override;
//override the widget's hitTest function to perfom its own
virtual bool hitTest(const Point &pt) override;
virtual bool hitTest(const Vector2 &pt) override;
/**
* Returns the "class name" of widget.
*/

View File

@ -116,7 +116,7 @@ public:
void setTouchSize(const Size &size);
Size getTouchSize();
void setTouchAreaEnabled(bool enable);
virtual bool hitTest(const Point &pt);
virtual bool hitTest(const Vector2 &pt);
void setText(const std::string& text);
void setPlaceHolder(const std::string& value);
const std::string& getPlaceHolder();

View File

@ -221,7 +221,7 @@ public:
/**
* Changes the position (x,y) of the widget in OpenGL coordinates
*
* Usually we use p(x,y) to compose Point object.
* Usually we use p(x,y) to compose Vector2 object.
* The original point (0,0) is at the left-bottom corner of screen.
*
* @param position The position (x,y) of the widget in OpenGL coordinates
@ -231,12 +231,12 @@ public:
/**
* Changes the position (x,y) of the widget in OpenGL coordinates
*
* Usually we use p(x,y) to compose Point object.
* Usually we use p(x,y) to compose Vector2 object.
* The original point (0,0) is at the left-bottom corner of screen.
*
* @param percent The percent (x,y) of the widget in OpenGL coordinates
*/
void setPositionPercent(const Point &percent);
void setPositionPercent(const Vector2 &percent);
/**
* Gets the percent (x,y) of the widget in OpenGL coordinates
@ -245,7 +245,7 @@ public:
*
* @return The percent (x,y) of the widget in OpenGL coordinates
*/
const Point& getPositionPercent();
const Vector2& getPositionPercent();
/**
* Changes the position type of the widget
@ -332,33 +332,33 @@ public:
*
* @return true if the point is in parent's area, flase otherwise.
*/
bool clippingParentAreaContainPoint(const Point &pt);
bool clippingParentAreaContainPoint(const Vector2 &pt);
/*
* Sends the touch event to widget's parent
*/
virtual void checkChildInfo(int handleState,Widget* sender,const Point &touchPoint);
virtual void checkChildInfo(int handleState,Widget* sender,const Vector2 &touchPoint);
/*
* Gets the touch began point of widget when widget is selected.
*
* @return the touch began point.
*/
const Point& getTouchStartPos();
const Vector2& getTouchStartPos();
/*
* Gets the touch move point of widget when widget is selected.
*
* @return the touch move point.
*/
const Point& getTouchMovePos();
const Vector2& getTouchMovePos();
/*
* Gets the touch end point of widget when widget is selected.
*
* @return the touch end point.
*/
const Point& getTouchEndPos();
const Vector2& getTouchEndPos();
/**
* Changes the name that is used to identify the widget easily.
@ -397,7 +397,7 @@ public:
*
* @param percent that is widget's percent size
*/
virtual void setSizePercent(const Point &percent);
virtual void setSizePercent(const Vector2 &percent);
/**
* Changes the size type of widget.
@ -433,7 +433,7 @@ public:
*
* @return size percent
*/
const Point& getSizePercent() const;
const Vector2& getSizePercent() const;
/**
* Checks a point if is in widget's space
@ -442,7 +442,7 @@ public:
*
* @return true if the point is in widget's space, flase otherwise.
*/
virtual bool hitTest(const Point &pt);
virtual bool hitTest(const Vector2 &pt);
virtual bool onTouchBegan(Touch *touch, Event *unusedEvent);
virtual void onTouchMoved(Touch *touch, Event *unusedEvent);
@ -490,7 +490,7 @@ public:
*
* @return world position of widget.
*/
Point getWorldPosition();
Vector2 getWorldPosition();
/**
* Gets the Virtual Renderer of widget.
@ -570,9 +570,9 @@ protected:
bool _touchPassedEnabled; ///< is the touch event should be passed
bool _focus; ///< is the widget on focus
BrightStyle _brightStyle; ///< bright style
Point _touchStartPos; ///< touch began point
Point _touchMovePos; ///< touch moved point
Point _touchEndPos; ///< touch ended point
Vector2 _touchStartPos; ///< touch began point
Vector2 _touchMovePos; ///< touch moved point
Vector2 _touchEndPos; ///< touch ended point
Ref* _touchEventListener;
SEL_TouchEvent _touchEventSelector;
std::string _name;
@ -583,9 +583,9 @@ protected:
bool _ignoreSize;
bool _affectByClipping;
SizeType _sizeType;
Point _sizePercent;
Vector2 _sizePercent;
PositionType _positionType;
Point _positionPercent;
Vector2 _positionPercent;
bool _reorderWidgetChildDirty;
bool _hitted;
EventListenerTouchOneByOne* _touchListener;