mirror of https://github.com/axmolengine/axmol.git
issue #2404:created CCDprecated.h and move all global functions and variables into it
This commit is contained in:
parent
c937824051
commit
eada29ee40
|
@ -1 +1 @@
|
|||
3f4cd506dc44d54f375a2c759a90db69d845b75b
|
||||
16f9fcf29ae0c1b3a14728f0a11518f50355fb18
|
|
@ -113,7 +113,6 @@ sprite_nodes/CCSpriteFrameCache.cpp \
|
|||
support/ccUTF8.cpp \
|
||||
support/CCNotificationCenter.cpp \
|
||||
support/CCProfiling.cpp \
|
||||
support/CCPointExtension.cpp \
|
||||
support/TransformUtils.cpp \
|
||||
support/user_default/CCUserDefaultAndroid.cpp \
|
||||
support/base64.cpp \
|
||||
|
|
|
@ -38,7 +38,6 @@ THE SOFTWARE.
|
|||
#include "CCScheduler.h"
|
||||
#include "ccMacros.h"
|
||||
#include "touch_dispatcher/CCTouchDispatcher.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "support/CCNotificationCenter.h"
|
||||
#include "layers_scenes_transitions_nodes/CCTransition.h"
|
||||
#include "textures/CCTextureCache.h"
|
||||
|
|
|
@ -27,7 +27,6 @@ THE SOFTWARE.
|
|||
#include "CCAction.h"
|
||||
#include "CCActionInterval.h"
|
||||
#include "base_nodes/CCNode.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
* Adapted from cocos2d-x to cocos2d-iphone by Ricardo Quesada
|
||||
*/
|
||||
#include "ccMacros.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "CCActionCatmullRom.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -23,7 +23,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "CCActionGrid3D.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "CCDirector.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ THE SOFTWARE.
|
|||
#include "CCActionInterval.h"
|
||||
#include "sprite_nodes/CCSprite.h"
|
||||
#include "base_nodes/CCNode.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "CCStdC.h"
|
||||
#include "CCActionInstant.h"
|
||||
#include <stdarg.h>
|
||||
|
|
|
@ -23,7 +23,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "CCActionPageTurn3D.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ THE SOFTWARE.
|
|||
#include "CCActionTiledGrid.h"
|
||||
#include "CCDirector.h"
|
||||
#include "ccMacros.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "effects/CCGrid.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ THE SOFTWARE.
|
|||
****************************************************************************/
|
||||
#include "cocoa/CCString.h"
|
||||
#include "CCNode.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "support/TransformUtils.h"
|
||||
#include "CCCamera.h"
|
||||
#include "effects/CCGrid.h"
|
||||
|
|
|
@ -334,31 +334,6 @@ public:
|
|||
static const Rect ZERO;
|
||||
};
|
||||
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE inline Point CCPointMake(float x, float y)
|
||||
{
|
||||
return Point(x, y);
|
||||
}
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE inline Size CCSizeMake(float width, float height)
|
||||
{
|
||||
return Size(width, height);
|
||||
}
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE inline Rect CCRectMake(float x, float y, float width, float height)
|
||||
{
|
||||
return Rect(x, y, width, height);
|
||||
}
|
||||
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE const Point PointZero = Point::ZERO;
|
||||
|
||||
/* The "zero" size -- equivalent to Size(0, 0). */
|
||||
CC_DEPRECATED_ATTRIBUTE const Size SizeZero = Size::ZERO;
|
||||
|
||||
/* The "zero" rectangle -- equivalent to Rect(0, 0, 0, 0). */
|
||||
CC_DEPRECATED_ATTRIBUTE const Rect RectZero = Rect::ZERO;
|
||||
|
||||
// end of data_structure group
|
||||
/// @}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
|
||||
#include "CCDrawNode.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "shaders/CCShaderCache.h"
|
||||
#include "CCGL.h"
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ THE SOFTWARE.
|
|||
#include "shaders/CCShaderCache.h"
|
||||
#include "shaders/CCGLProgram.h"
|
||||
#include "actions/CCActionCatmullRom.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include <string.h>
|
||||
#include <cmath>
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ THE SOFTWARE.
|
|||
#include "shaders/CCShaderCache.h"
|
||||
#include "shaders/ccGLStateCache.h"
|
||||
#include "CCGL.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "support/TransformUtils.h"
|
||||
#include "kazmath/kazmath.h"
|
||||
#include "kazmath/GL/matrix.h"
|
||||
|
|
|
@ -0,0 +1,407 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/** Add deprecated global functions and variables here
|
||||
*/
|
||||
|
||||
#ifndef __COCOS2D_CCDEPRECATED_H__
|
||||
#define __COCOS2D_CCDEPRECATED_H__
|
||||
|
||||
#include "cocoa/CCGeometry.h"
|
||||
#include <math.h>
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup data_structures
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Helper macro that creates a Point
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE inline Point ccp(float x, float y)
|
||||
{
|
||||
return Point(x, y);
|
||||
}
|
||||
|
||||
/** Returns opposite of point.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
@deprecated please use Point::-, for example: -v1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point
|
||||
ccpNeg(const Point& v)
|
||||
{
|
||||
return -v;
|
||||
}
|
||||
|
||||
/** Calculates sum of two points.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
@deprecated please use Point::+, for example: v1 + v2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point
|
||||
ccpAdd(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1 + v2;
|
||||
}
|
||||
|
||||
/** Calculates difference of two points.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
@deprecated please use Point::-, for example: v1 - v2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point
|
||||
ccpSub(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1 - v2;
|
||||
}
|
||||
|
||||
/** Returns point multiplied by given factor.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
@deprecated please use Point::*, for example: v1 * v2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point
|
||||
ccpMult(const Point& v, const float s)
|
||||
{
|
||||
return v * s;
|
||||
}
|
||||
|
||||
/** Calculates midpoint between two points.
|
||||
@return Point
|
||||
@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)
|
||||
{
|
||||
return v1.getMidpoint(v2);
|
||||
}
|
||||
|
||||
/** Calculates dot product of two points.
|
||||
@return float
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline float
|
||||
ccpDot(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1.dot(v2);
|
||||
}
|
||||
|
||||
/** Calculates cross product of two points.
|
||||
@return float
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline float
|
||||
ccpCross(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1.cross(v2);
|
||||
}
|
||||
|
||||
/** Calculates perpendicular of v, rotated 90 degrees counter-clockwise -- cross(v, perp(v)) >= 0
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point
|
||||
ccpPerp(const Point& v)
|
||||
{
|
||||
return v.getPerp();
|
||||
}
|
||||
|
||||
/** Calculates perpendicular of v, rotated 90 degrees clockwise -- cross(v, rperp(v)) <= 0
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point
|
||||
ccpRPerp(const Point& v)
|
||||
{
|
||||
return v.getRPerp();
|
||||
}
|
||||
|
||||
/** Calculates the projection of v1 over v2.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point
|
||||
ccpProject(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1.project(v2);
|
||||
}
|
||||
|
||||
/** Rotates two points.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point
|
||||
ccpRotate(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1.rotate(v2);
|
||||
}
|
||||
|
||||
/** Unrotates two points.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point
|
||||
ccpUnrotate(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1.unrotate(v2);
|
||||
}
|
||||
|
||||
/** Calculates the square length of a Point (not calling sqrt() )
|
||||
@return float
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline float
|
||||
ccpLengthSQ(const Point& v)
|
||||
{
|
||||
return v.getLengthSq();
|
||||
}
|
||||
|
||||
|
||||
/** Calculates the square distance between two points (not calling sqrt() )
|
||||
@return float
|
||||
@since v1.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline float
|
||||
ccpDistanceSQ(const Point p1, const Point p2)
|
||||
{
|
||||
return (p1 - p2).getLengthSq();
|
||||
}
|
||||
|
||||
|
||||
/** Calculates distance between point an origin
|
||||
@return float
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline float CC_DLL ccpLength(const Point& v)
|
||||
{
|
||||
return v.getLength();
|
||||
}
|
||||
|
||||
/** Calculates the distance between two points
|
||||
@return float
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline float CC_DLL ccpDistance(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1.getDistance(v2);
|
||||
}
|
||||
|
||||
/** Returns point multiplied to a length of 1.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpNormalize(const Point& v)
|
||||
{
|
||||
return v.normalize();
|
||||
}
|
||||
|
||||
/** Converts radians to a normalized vector.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpForAngle(const float a)
|
||||
{
|
||||
return Point::forAngle(a);
|
||||
}
|
||||
|
||||
/** Converts a vector to radians.
|
||||
@return float
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline float CC_DLL ccpToAngle(const Point& v)
|
||||
{
|
||||
return v.getAngle();
|
||||
}
|
||||
|
||||
|
||||
/** Clamp a point between from and to.
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpClamp(const Point& p, const Point& from, const Point& to)
|
||||
{
|
||||
return p.getClampPoint(from, to);
|
||||
}
|
||||
|
||||
/** Quickly convert Size to a Point
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpFromSize(const Size& s)
|
||||
{
|
||||
return Point(s);
|
||||
}
|
||||
|
||||
/** 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
|
||||
* ccpCompOp(p,floorf);
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpCompOp(const Point& p, float (*opFunc)(float))
|
||||
{
|
||||
return p.compOp(opFunc);
|
||||
}
|
||||
|
||||
/** Linear Interpolation between two points a and b
|
||||
@returns
|
||||
alpha == 0 ? a
|
||||
alpha == 1 ? b
|
||||
otherwise a value between a..b
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpLerp(const Point& a, const Point& b, float alpha)
|
||||
{
|
||||
return a.lerp(b, alpha);
|
||||
}
|
||||
|
||||
|
||||
/** @returns if points have fuzzy equality which means equal with some degree of variance.
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline bool CC_DLL ccpFuzzyEqual(const Point& a, const Point& b, float variance)
|
||||
{
|
||||
return a.fuzzyEquals(b, variance);
|
||||
}
|
||||
|
||||
|
||||
/** Multiplies a and b components, a.x*b.x, a.y*b.y
|
||||
@returns a component-wise multiplication
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpCompMult(const Point& a, const Point& b)
|
||||
{
|
||||
return Point(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 CC_DLL ccpAngleSigned(const Point& a, const Point& b)
|
||||
{
|
||||
return a.getAngle(b);
|
||||
}
|
||||
|
||||
/** @returns the angle in radians between two vector directions
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline float CC_DLL ccpAngle(const Point& a, const Point& b)
|
||||
{
|
||||
return a.getAngle(b);
|
||||
}
|
||||
|
||||
/** Rotates a point counter clockwise by the angle around a pivot
|
||||
@param v is the point to rotate
|
||||
@param pivot is the pivot, naturally
|
||||
@param angle is the angle of rotation cw in radians
|
||||
@returns the rotated point
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpRotateByAngle(const Point& v, const Point& pivot, float angle)
|
||||
{
|
||||
return v.rotateByAngle(pivot, angle);
|
||||
}
|
||||
|
||||
/** A general line-line intersection test
|
||||
@param p1
|
||||
is the startpoint for the first line P1 = (p1 - p2)
|
||||
@param p2
|
||||
is the endpoint for the first line P1 = (p1 - p2)
|
||||
@param p3
|
||||
is the startpoint for the second line P2 = (p3 - p4)
|
||||
@param p4
|
||||
is the endpoint for the second line P2 = (p3 - p4)
|
||||
@param s
|
||||
is the range for a hitpoint in P1 (pa = p1 + s*(p2 - p1))
|
||||
@param t
|
||||
is the range for a hitpoint in P3 (pa = p2 + t*(p4 - p3))
|
||||
@return bool
|
||||
indicating successful intersection of a line
|
||||
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 p3 + t * (p4 - p3);
|
||||
the hit point also is p1 + s * (p2 - p1);
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline bool CC_DLL ccpLineIntersect(const Point& p1, const Point& p2,
|
||||
const Point& p3, const Point& p4,
|
||||
float *s, float *t)
|
||||
{
|
||||
return Point::isLineIntersect(p1, p2, p3, p4, s, t);
|
||||
}
|
||||
|
||||
/*
|
||||
ccpSegmentIntersect returns YES if Segment A-B intersects with segment C-D
|
||||
@since v1.0.0
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline bool CC_DLL ccpSegmentIntersect(const Point& A, const Point& B, const Point& C, const Point& D)
|
||||
{
|
||||
return Point::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 CC_DLL ccpIntersectPoint(const Point& A, const Point& B, const Point& C, const Point& D)
|
||||
{
|
||||
return Point::getIntersectPoint(A, B, C, D);
|
||||
}
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE inline Point CCPointMake(float x, float y)
|
||||
{
|
||||
return Point(x, y);
|
||||
}
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE inline Size CCSizeMake(float width, float height)
|
||||
{
|
||||
return Size(width, height);
|
||||
}
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE inline Rect CCRectMake(float x, float y, float width, float height)
|
||||
{
|
||||
return Rect(x, y, width, height);
|
||||
}
|
||||
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE const Point PointZero = Point::ZERO;
|
||||
|
||||
/* The "zero" size -- equivalent to Size(0, 0). */
|
||||
CC_DEPRECATED_ATTRIBUTE const Size SizeZero = Size::ZERO;
|
||||
|
||||
/* The "zero" rectangle -- equivalent to Rect(0, 0, 0, 0). */
|
||||
CC_DEPRECATED_ATTRIBUTE const Rect RectZero = Rect::ZERO;
|
||||
|
||||
|
||||
// end of data_structures group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
|
||||
#endif // __COCOS2D_CCDEPRECATED_H__
|
|
@ -235,7 +235,6 @@ THE SOFTWARE.
|
|||
// support
|
||||
#include "support/ccUTF8.h"
|
||||
#include "support/CCNotificationCenter.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "support/CCProfiling.h"
|
||||
#include "support/user_default/CCUserDefault.h"
|
||||
#include "support/CCVertex.h"
|
||||
|
|
|
@ -26,7 +26,6 @@ THE SOFTWARE.
|
|||
#include "CCLabelAtlas.h"
|
||||
#include "textures/CCTextureAtlas.h"
|
||||
#include "textures/CCTextureCache.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "draw_nodes/CCDrawingPrimitives.h"
|
||||
#include "ccConfig.h"
|
||||
#include "shaders/CCShaderCache.h"
|
||||
|
|
|
@ -37,7 +37,6 @@ http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
|||
#include "CCConfiguration.h"
|
||||
#include "draw_nodes/CCDrawingPrimitives.h"
|
||||
#include "sprite_nodes/CCSprite.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "CCDirector.h"
|
||||
#include "textures/CCTextureCache.h"
|
||||
|
|
|
@ -30,7 +30,6 @@ THE SOFTWARE.
|
|||
#include "keypad_dispatcher/CCKeypadDispatcher.h"
|
||||
#include "CCAccelerometer.h"
|
||||
#include "CCDirector.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "script_support/CCScriptSupport.h"
|
||||
#include "shaders/CCShaderCache.h"
|
||||
#include "shaders/CCGLProgram.h"
|
||||
|
|
|
@ -25,7 +25,6 @@ THE SOFTWARE.
|
|||
****************************************************************************/
|
||||
|
||||
#include "CCScene.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
|
|
@ -26,7 +26,6 @@ THE SOFTWARE.
|
|||
|
||||
#include "CCTransition.h"
|
||||
#include "CCCamera.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "CCDirector.h"
|
||||
#include "touch_dispatcher/CCTouchDispatcher.h"
|
||||
#include "actions/CCActionInterval.h"
|
||||
|
|
|
@ -32,7 +32,6 @@ THE SOFTWARE.
|
|||
#include "CCLayer.h"
|
||||
#include "actions/CCActionInstant.h"
|
||||
#include "actions/CCActionProgressTimer.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ THE SOFTWARE.
|
|||
#include "CCMenu.h"
|
||||
#include "CCDirector.h"
|
||||
#include "CCApplication.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "touch_dispatcher/CCTouchDispatcher.h"
|
||||
#include "touch_dispatcher/CCTouch.h"
|
||||
#include "CCStdC.h"
|
||||
|
|
|
@ -25,7 +25,6 @@ THE SOFTWARE.
|
|||
****************************************************************************/
|
||||
|
||||
#include "CCMenuItem.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "actions/CCActionInterval.h"
|
||||
#include "sprite_nodes/CCSprite.h"
|
||||
#include "label_nodes/CCLabelAtlas.h"
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "shaders/CCGLProgram.h"
|
||||
#include "shaders/CCShaderCache.h"
|
||||
#include "CCDirector.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "draw_nodes/CCDrawingPrimitives.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
|
|
@ -30,7 +30,6 @@ THE SOFTWARE.
|
|||
#include "ccMacros.h"
|
||||
|
||||
#include "support/CCVertex.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ THE SOFTWARE.
|
|||
|
||||
#include "ccMacros.h"
|
||||
#include "textures/CCTextureCache.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "shaders/CCGLProgram.h"
|
||||
#include "shaders/CCShaderCache.h"
|
||||
#include "shaders/ccGLStateCache.h"
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "ccConfig.h"
|
||||
#include "ccMacros.h"
|
||||
#include "effects/CCGrid.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "CCParticleSystem.h"
|
||||
#include "shaders/CCShaderCache.h"
|
||||
#include "shaders/CCGLProgram.h"
|
||||
|
|
|
@ -26,7 +26,6 @@ THE SOFTWARE.
|
|||
#include "CCParticleExamples.h"
|
||||
#include "CCDirector.h"
|
||||
#include "textures/CCTextureCache.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "firePngData.h"
|
||||
#include "platform/CCImage.h"
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ THE SOFTWARE.
|
|||
#include "textures/CCTextureCache.h"
|
||||
#include "textures/CCTextureAtlas.h"
|
||||
#include "support/base64.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "platform/CCImage.h"
|
||||
#include "platform/platform.h"
|
||||
|
|
|
@ -82,7 +82,6 @@ SOURCES = ../actions/CCAction.cpp \
|
|||
../sprite_nodes/CCSpriteFrame.cpp \
|
||||
../sprite_nodes/CCSpriteFrameCache.cpp \
|
||||
../support/ccUTF8.cpp \
|
||||
../support/CCPointExtension.cpp \
|
||||
../support/CCProfiling.cpp \
|
||||
../support/user_default/CCUserDefault.cpp \
|
||||
../support/TransformUtils.cpp \
|
||||
|
|
|
@ -76,7 +76,6 @@ SOURCES = ../actions/CCAction.cpp \
|
|||
../sprite_nodes/CCSpriteFrame.cpp \
|
||||
../sprite_nodes/CCSpriteFrameCache.cpp \
|
||||
../support/tinyxml2/tinyxml2.cpp \
|
||||
../support/CCPointExtension.cpp \
|
||||
../support/CCProfiling.cpp \
|
||||
../support/user_default/CCUserDefault.cpp \
|
||||
../support/TransformUtils.cpp \
|
||||
|
|
|
@ -37,7 +37,6 @@ THE SOFTWARE.
|
|||
#include "shaders/ccGLStateCache.h"
|
||||
#include "shaders/CCGLProgram.h"
|
||||
#include "CCDirector.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "cocoa/CCGeometry.h"
|
||||
#include "textures/CCTexture2D.h"
|
||||
#include "cocoa/CCAffineTransform.h"
|
||||
|
|
|
@ -30,7 +30,6 @@ THE SOFTWARE.
|
|||
#include "effects/CCGrid.h"
|
||||
#include "draw_nodes/CCDrawingPrimitives.h"
|
||||
#include "textures/CCTextureCache.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "shaders/CCShaderCache.h"
|
||||
#include "shaders/CCGLProgram.h"
|
||||
#include "shaders/ccGLStateCache.h"
|
||||
|
|
|
@ -1,128 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2007 Scott Lembcke
|
||||
Copyright (c) 2010 Lam Pham
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCPointExtension.h"
|
||||
#include "ccMacros.h" // FLT_EPSILON
|
||||
#include <stdio.h>
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
#define kPointEpsilon FLT_EPSILON
|
||||
|
||||
float
|
||||
ccpLength(const Point& v)
|
||||
{
|
||||
return v.getLength();
|
||||
}
|
||||
|
||||
float
|
||||
ccpDistance(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1.getDistance(v2);
|
||||
}
|
||||
|
||||
Point
|
||||
ccpNormalize(const Point& v)
|
||||
{
|
||||
return v.normalize();
|
||||
}
|
||||
|
||||
Point
|
||||
ccpForAngle(const float a)
|
||||
{
|
||||
return Point::forAngle(a);
|
||||
}
|
||||
|
||||
float
|
||||
ccpToAngle(const Point& v)
|
||||
{
|
||||
return v.getAngle();
|
||||
}
|
||||
|
||||
Point ccpLerp(const Point& a, const Point& b, float alpha)
|
||||
{
|
||||
return a.lerp(b, alpha);
|
||||
}
|
||||
|
||||
Point ccpClamp(const Point& p, const Point& min_inclusive, const Point& max_inclusive)
|
||||
{
|
||||
return p.getClampPoint(min_inclusive, max_inclusive);
|
||||
}
|
||||
|
||||
Point ccpFromSize(const Size& s)
|
||||
{
|
||||
return Point(s);
|
||||
}
|
||||
|
||||
Point ccpCompOp(const Point& p, float (*opFunc)(float))
|
||||
{
|
||||
return p.compOp(opFunc);
|
||||
}
|
||||
|
||||
bool ccpFuzzyEqual(const Point& a, const Point& b, float var)
|
||||
{
|
||||
return a.fuzzyEquals(b, var);
|
||||
}
|
||||
|
||||
Point ccpCompMult(const Point& a, const Point& b)
|
||||
{
|
||||
return Point(a.x * b.x, a.y * b.y);
|
||||
}
|
||||
|
||||
float ccpAngleSigned(const Point& a, const Point& b)
|
||||
{
|
||||
return a.getAngle(b);
|
||||
}
|
||||
|
||||
Point ccpRotateByAngle(const Point& v, const Point& pivot, float angle)
|
||||
{
|
||||
return v.rotateByAngle(pivot, angle);
|
||||
}
|
||||
|
||||
|
||||
bool ccpSegmentIntersect(const Point& A, const Point& B, const Point& C, const Point& D)
|
||||
{
|
||||
return Point::isSegmentIntersect(A, B, C, D);
|
||||
}
|
||||
|
||||
Point ccpIntersectPoint(const Point& A, const Point& B, const Point& C, const Point& D)
|
||||
{
|
||||
return Point::getIntersectPoint(A, B, C, D);
|
||||
}
|
||||
|
||||
bool ccpLineIntersect(const Point& A, const Point& B,
|
||||
const Point& C, const Point& D,
|
||||
float *S, float *T)
|
||||
{
|
||||
return Point::isLineIntersect(A, B, C, D, S, T);
|
||||
}
|
||||
|
||||
float ccpAngle(const Point& a, const Point& b)
|
||||
{
|
||||
return a.getAngle(b);
|
||||
}
|
||||
|
||||
NS_CC_END
|
|
@ -1,346 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2007 Scott Lembcke
|
||||
Copyright (c) 2010 Lam Pham
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __SUPPORT_CGPOINTEXTENSION_H__
|
||||
#define __SUPPORT_CGPOINTEXTENSION_H__
|
||||
|
||||
/**
|
||||
@file
|
||||
Point extensions based on Chipmunk's cpVect file.
|
||||
These extensions work both with Point and cpVect.
|
||||
|
||||
The "ccp" prefix means: "CoCos2d Point"
|
||||
|
||||
Examples:
|
||||
- ccpAdd( Point(1,1), Point(2,2) ); // preferred cocos2d way
|
||||
- ccpAdd( Point(1,1), Point(2,2) ); // also ok but more verbose
|
||||
|
||||
- cpvadd( cpv(1,1), cpv(2,2) ); // way of the chipmunk
|
||||
- ccpAdd( cpv(1,1), cpv(2,2) ); // mixing chipmunk and cocos2d (avoid)
|
||||
- cpvadd( Point(1,1), Point(2,2) ); // mixing chipmunk and CG (avoid)
|
||||
*/
|
||||
|
||||
#include "cocoa/CCGeometry.h"
|
||||
#include <math.h>
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup data_structures
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Helper macro that creates a Point
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE inline Point ccp(float x, float y)
|
||||
{
|
||||
return Point(x, y);
|
||||
}
|
||||
|
||||
/** Returns opposite of point.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
@deprecated please use Point::-, for example: -v1
|
||||
*/
|
||||
static inline CC_DEPRECATED_ATTRIBUTE Point
|
||||
ccpNeg(const Point& v)
|
||||
{
|
||||
return -v;
|
||||
}
|
||||
|
||||
/** Calculates sum of two points.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
@deprecated please use Point::+, for example: v1 + v2
|
||||
*/
|
||||
static inline CC_DEPRECATED_ATTRIBUTE Point
|
||||
ccpAdd(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1 + v2;
|
||||
}
|
||||
|
||||
/** Calculates difference of two points.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
@deprecated please use Point::-, for example: v1 - v2
|
||||
*/
|
||||
static inline CC_DEPRECATED_ATTRIBUTE Point
|
||||
ccpSub(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1 - v2;
|
||||
}
|
||||
|
||||
/** Returns point multiplied by given factor.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
@deprecated please use Point::*, for example: v1 * v2
|
||||
*/
|
||||
static inline CC_DEPRECATED_ATTRIBUTE Point
|
||||
ccpMult(const Point& v, const float s)
|
||||
{
|
||||
return v * s;
|
||||
}
|
||||
|
||||
/** Calculates midpoint between two points.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
@deprecated please use it like (v1 + v2) / 2.0f
|
||||
*/
|
||||
static inline CC_DEPRECATED_ATTRIBUTE Point
|
||||
ccpMidpoint(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1.getMidpoint(v2);
|
||||
}
|
||||
|
||||
/** Calculates dot product of two points.
|
||||
@return float
|
||||
@since v0.7.2
|
||||
*/
|
||||
static inline CC_DEPRECATED_ATTRIBUTE float
|
||||
ccpDot(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1.dot(v2);
|
||||
}
|
||||
|
||||
/** Calculates cross product of two points.
|
||||
@return float
|
||||
@since v0.7.2
|
||||
*/
|
||||
static inline CC_DEPRECATED_ATTRIBUTE float
|
||||
ccpCross(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1.cross(v2);
|
||||
}
|
||||
|
||||
/** Calculates perpendicular of v, rotated 90 degrees counter-clockwise -- cross(v, perp(v)) >= 0
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
static inline CC_DEPRECATED_ATTRIBUTE Point
|
||||
ccpPerp(const Point& v)
|
||||
{
|
||||
return v.getPerp();
|
||||
}
|
||||
|
||||
/** Calculates perpendicular of v, rotated 90 degrees clockwise -- cross(v, rperp(v)) <= 0
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
static inline CC_DEPRECATED_ATTRIBUTE Point
|
||||
ccpRPerp(const Point& v)
|
||||
{
|
||||
return v.getRPerp();
|
||||
}
|
||||
|
||||
/** Calculates the projection of v1 over v2.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
static inline CC_DEPRECATED_ATTRIBUTE Point
|
||||
ccpProject(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1.project(v2);
|
||||
}
|
||||
|
||||
/** Rotates two points.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
static inline CC_DEPRECATED_ATTRIBUTE Point
|
||||
ccpRotate(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1.rotate(v2);
|
||||
}
|
||||
|
||||
/** Unrotates two points.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
static inline CC_DEPRECATED_ATTRIBUTE Point
|
||||
ccpUnrotate(const Point& v1, const Point& v2)
|
||||
{
|
||||
return v1.unrotate(v2);
|
||||
}
|
||||
|
||||
/** Calculates the square length of a Point (not calling sqrt() )
|
||||
@return float
|
||||
@since v0.7.2
|
||||
*/
|
||||
static inline CC_DEPRECATED_ATTRIBUTE float
|
||||
ccpLengthSQ(const Point& v)
|
||||
{
|
||||
return v.getLengthSq();
|
||||
}
|
||||
|
||||
|
||||
/** Calculates the square distance between two points (not calling sqrt() )
|
||||
@return float
|
||||
@since v1.1
|
||||
*/
|
||||
static inline CC_DEPRECATED_ATTRIBUTE float
|
||||
ccpDistanceSQ(const Point p1, const Point p2)
|
||||
{
|
||||
return (p1 - p2).getLengthSq();
|
||||
}
|
||||
|
||||
|
||||
/** Calculates distance between point an origin
|
||||
@return float
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE float CC_DLL ccpLength(const Point& v);
|
||||
|
||||
/** Calculates the distance between two points
|
||||
@return float
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE float CC_DLL ccpDistance(const Point& v1, const Point& v2);
|
||||
|
||||
/** Returns point multiplied to a length of 1.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Point CC_DLL ccpNormalize(const Point& v);
|
||||
|
||||
/** Converts radians to a normalized vector.
|
||||
@return Point
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Point CC_DLL ccpForAngle(const float a);
|
||||
|
||||
/** Converts a vector to radians.
|
||||
@return float
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE float CC_DLL ccpToAngle(const Point& v);
|
||||
|
||||
|
||||
/** Clamp a point between from and to.
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Point CC_DLL ccpClamp(const Point& p, const Point& from, const Point& to);
|
||||
|
||||
/** Quickly convert Size to a Point
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Point CC_DLL ccpFromSize(const Size& s);
|
||||
|
||||
/** 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
|
||||
* ccpCompOp(p,floorf);
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Point CC_DLL ccpCompOp(const Point& p, float (*opFunc)(float));
|
||||
|
||||
/** Linear Interpolation between two points a and b
|
||||
@returns
|
||||
alpha == 0 ? a
|
||||
alpha == 1 ? b
|
||||
otherwise a value between a..b
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Point CC_DLL ccpLerp(const Point& a, const Point& b, float alpha);
|
||||
|
||||
|
||||
/** @returns if points have fuzzy equality which means equal with some degree of variance.
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE bool CC_DLL ccpFuzzyEqual(const Point& a, const Point& b, float variance);
|
||||
|
||||
|
||||
/** Multiplies a and b components, a.x*b.x, a.y*b.y
|
||||
@returns a component-wise multiplication
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Point CC_DLL ccpCompMult(const Point& a, const Point& b);
|
||||
|
||||
/** @returns the signed angle in radians between two vector directions
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE float CC_DLL ccpAngleSigned(const Point& a, const Point& b);
|
||||
|
||||
/** @returns the angle in radians between two vector directions
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE float CC_DLL ccpAngle(const Point& a, const Point& b);
|
||||
|
||||
/** Rotates a point counter clockwise by the angle around a pivot
|
||||
@param v is the point to rotate
|
||||
@param pivot is the pivot, naturally
|
||||
@param angle is the angle of rotation cw in radians
|
||||
@returns the rotated point
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Point CC_DLL ccpRotateByAngle(const Point& v, const Point& pivot, float angle);
|
||||
|
||||
/** A general line-line intersection test
|
||||
@param p1
|
||||
is the startpoint for the first line P1 = (p1 - p2)
|
||||
@param p2
|
||||
is the endpoint for the first line P1 = (p1 - p2)
|
||||
@param p3
|
||||
is the startpoint for the second line P2 = (p3 - p4)
|
||||
@param p4
|
||||
is the endpoint for the second line P2 = (p3 - p4)
|
||||
@param s
|
||||
is the range for a hitpoint in P1 (pa = p1 + s*(p2 - p1))
|
||||
@param t
|
||||
is the range for a hitpoint in P3 (pa = p2 + t*(p4 - p3))
|
||||
@return bool
|
||||
indicating successful intersection of a line
|
||||
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 p3 + t * (p4 - p3);
|
||||
the hit point also is p1 + s * (p2 - p1);
|
||||
@since v0.99.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE bool CC_DLL ccpLineIntersect(const Point& p1, const Point& p2,
|
||||
const Point& p3, const Point& p4,
|
||||
float *s, float *t);
|
||||
|
||||
/*
|
||||
ccpSegmentIntersect returns YES if Segment A-B intersects with segment C-D
|
||||
@since v1.0.0
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE bool CC_DLL ccpSegmentIntersect(const Point& A, const Point& B, const Point& C, const Point& D);
|
||||
|
||||
/*
|
||||
ccpIntersectPoint returns the intersection point of line A-B, C-D
|
||||
@since v1.0.0
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Point CC_DLL ccpIntersectPoint(const Point& A, const Point& B, const Point& C, const Point& D);
|
||||
|
||||
// end of data_structures group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __SUPPORT_CGPOINTEXTENSION_H__
|
||||
|
|
@ -24,7 +24,6 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "CCVertex.h"
|
||||
#include "CCPointExtension.h"
|
||||
#include "ccMacros.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
|
|
@ -24,7 +24,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "CCParallaxNode.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "support/data_support/ccCArray.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
|
|
@ -30,7 +30,6 @@ THE SOFTWARE.
|
|||
#include "textures/CCTextureCache.h"
|
||||
#include "shaders/CCShaderCache.h"
|
||||
#include "shaders/CCGLProgram.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "support/data_support/ccCArray.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ THE SOFTWARE.
|
|||
#include "CCTMXXMLParser.h"
|
||||
#include "CCTMXLayer.h"
|
||||
#include "sprite_nodes/CCSprite.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ THE SOFTWARE.
|
|||
#include "ccMacros.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "support/zip_support/ZipUtils.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "support/base64.h"
|
||||
#include "platform/platform.h"
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ THE SOFTWARE.
|
|||
#include "cocoa/CCDictionary.h"
|
||||
#include "cocoa/CCInteger.h"
|
||||
#include "CCDirector.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "CCTouch.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
#include "CCControlButton.h"
|
||||
#include "CCScale9Sprite.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "label_nodes/CCLabelTTF.h"
|
||||
#include "label_nodes/CCLabelBMFont.h"
|
||||
#include "actions/CCAction.h"
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
*/
|
||||
|
||||
#include "CCControlColourPicker.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "sprite_nodes/CCSpriteFrameCache.h"
|
||||
#include "sprite_nodes/CCSpriteBatchNode.h"
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
*/
|
||||
|
||||
#include "CCControlHuePicker.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
*/
|
||||
|
||||
#include "CCControlSaturationBrightnessPicker.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
*/
|
||||
|
||||
#include "CCControlSlider.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "touch_dispatcher/CCTouch.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ THE SOFTWARE.
|
|||
****************************************************************************/
|
||||
|
||||
#include "CCControlUtils.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
|
|
|
@ -349,7 +349,7 @@ NSPoint EditBoxImplMac::convertDesignCoordToScreenCoord(const Point& designCoord
|
|||
EGLViewProtocol* eglView = EGLView::getInstance();
|
||||
|
||||
Point visiblePos = Point(designCoord.x * eglView->getScaleX(), designCoord.y * eglView->getScaleY());
|
||||
Point screenGLPos = ccpAdd(visiblePos, eglView->getViewPortRect().origin);
|
||||
Point screenGLPos = visiblePos + eglView->getViewPortRect().origin;
|
||||
|
||||
//TODO: I don't know why here needs to substract `height`.
|
||||
NSPoint screenPos = NSMakePoint(screenGLPos.x, screenGLPos.y-height);
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "CCTableView.h"
|
||||
#include "CCTableViewCell.h"
|
||||
#include "menu_nodes/CCMenu.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "CCSorting.h"
|
||||
#include "layers_scenes_transitions_nodes/CCLayer.h"
|
||||
|
||||
|
|
|
@ -377,7 +377,7 @@ void SIOClientImpl::onOpen(cocos2d::extension::WebSocket* ws) {
|
|||
|
||||
}
|
||||
|
||||
Director::sharedDirector()->getScheduler()->scheduleSelector(schedule_selector(SIOClientImpl::heartbeat), this, (_heartbeat * .9), false);
|
||||
Director::getInstance()->getScheduler()->scheduleSelector(schedule_selector(SIOClientImpl::heartbeat), this, (_heartbeat * .9), false);
|
||||
|
||||
CCLog("SIOClientImpl::onOpen socket connected!");
|
||||
|
||||
|
@ -632,7 +632,8 @@ SocketIO* SocketIO::instance() {
|
|||
SIOClient* SocketIO::connect(SocketIO::SIODelegate& delegate, const std::string& uri) {
|
||||
|
||||
std::string host = uri;
|
||||
int port, pos;
|
||||
int port = 0;
|
||||
int pos = 0;
|
||||
|
||||
pos = host.find("//");
|
||||
if(pos >= 0) {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
|
||||
#include "CCPhysicsSprite.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
|
||||
#if defined(CC_ENABLE_CHIPMUNK_INTEGRATION) && defined(CC_ENABLE_BOX2D_INTEGRATION)
|
||||
#error "Either Chipmunk or Box2d should be enabled, but not both at the same time"
|
||||
|
|
|
@ -25,72 +25,72 @@ SocketIOTestLayer::SocketIOTestLayer(void)
|
|||
const int SPACE = 35;
|
||||
|
||||
LabelTTF *label = LabelTTF::create("SocketIO Extension Test", "Arial", 28);
|
||||
label->setPosition(ccp(winSize.width / 2, winSize.height - MARGIN));
|
||||
label->setPosition(Point(winSize.width / 2, winSize.height - MARGIN));
|
||||
addChild(label, 0);
|
||||
|
||||
Menu *menuRequest = Menu::create();
|
||||
menuRequest->setPosition(PointZero);
|
||||
menuRequest->setPosition(Point::ZERO);
|
||||
addChild(menuRequest);
|
||||
|
||||
// Test to create basic client in the default namespace
|
||||
LabelTTF *labelSIOClient = LabelTTF::create("Open SocketIO Client", "Arial", 22);
|
||||
MenuItemLabel *itemSIOClient = MenuItemLabel::create(labelSIOClient, CC_CALLBACK_1(SocketIOTestLayer::onMenuSIOClientClicked, this));
|
||||
itemSIOClient->setPosition(ccp(VisibleRect::left().x + labelSIOClient->getContentSize().width / 2 + 5, winSize.height - MARGIN - SPACE));
|
||||
itemSIOClient->setPosition(Point(VisibleRect::left().x + labelSIOClient->getContentSize().width / 2 + 5, winSize.height - MARGIN - SPACE));
|
||||
menuRequest->addChild(itemSIOClient);
|
||||
|
||||
// Test to create a client at the endpoint '/testpoint'
|
||||
LabelTTF *labelSIOEndpoint = LabelTTF::create("Open SocketIO Endpoint", "Arial", 22);
|
||||
MenuItemLabel *itemSIOEndpoint = MenuItemLabel::create(labelSIOEndpoint, CC_CALLBACK_1(SocketIOTestLayer::onMenuSIOEndpointClicked, this));
|
||||
itemSIOEndpoint->setPosition(ccp(VisibleRect::right().x - labelSIOEndpoint->getContentSize().width / 2 - 5, winSize.height - MARGIN - SPACE));
|
||||
itemSIOEndpoint->setPosition(Point(VisibleRect::right().x - labelSIOEndpoint->getContentSize().width / 2 - 5, winSize.height - MARGIN - SPACE));
|
||||
menuRequest->addChild(itemSIOEndpoint);
|
||||
|
||||
// Test sending message to default namespace
|
||||
LabelTTF *labelTestMessage = LabelTTF::create("Send Test Message", "Arial", 22);
|
||||
MenuItemLabel *itemTestMessage = MenuItemLabel::create(labelTestMessage, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestMessageClicked, this));
|
||||
itemTestMessage->setPosition(ccp(VisibleRect::left().x + labelTestMessage->getContentSize().width / 2 + 5, winSize.height - MARGIN - 2 * SPACE));
|
||||
itemTestMessage->setPosition(Point(VisibleRect::left().x + labelTestMessage->getContentSize().width / 2 + 5, winSize.height - MARGIN - 2 * SPACE));
|
||||
menuRequest->addChild(itemTestMessage);
|
||||
|
||||
// Test sending message to the endpoint '/testpoint'
|
||||
LabelTTF *labelTestMessageEndpoint = LabelTTF::create("Test Endpoint Message", "Arial", 22);
|
||||
MenuItemLabel *itemTestMessageEndpoint = MenuItemLabel::create(labelTestMessageEndpoint, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestMessageEndpointClicked, this));
|
||||
itemTestMessageEndpoint->setPosition(ccp(VisibleRect::right().x - labelTestMessageEndpoint->getContentSize().width / 2 - 5, winSize.height - MARGIN - 2 * SPACE));
|
||||
itemTestMessageEndpoint->setPosition(Point(VisibleRect::right().x - labelTestMessageEndpoint->getContentSize().width / 2 - 5, winSize.height - MARGIN - 2 * SPACE));
|
||||
menuRequest->addChild(itemTestMessageEndpoint);
|
||||
|
||||
// Test sending event 'echotest' to default namespace
|
||||
LabelTTF *labelTestEvent = LabelTTF::create("Send Test Event", "Arial", 22);
|
||||
MenuItemLabel *itemTestEvent = MenuItemLabel::create(labelTestEvent, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestEventClicked, this));
|
||||
itemTestEvent->setPosition(ccp(VisibleRect::left().x + labelTestEvent->getContentSize().width / 2 + 5, winSize.height - MARGIN - 3 * SPACE));
|
||||
itemTestEvent->setPosition(Point(VisibleRect::left().x + labelTestEvent->getContentSize().width / 2 + 5, winSize.height - MARGIN - 3 * SPACE));
|
||||
menuRequest->addChild(itemTestEvent);
|
||||
|
||||
// Test sending event 'echotest' to the endpoint '/testpoint'
|
||||
LabelTTF *labelTestEventEndpoint = LabelTTF::create("Test Endpoint Event", "Arial", 22);
|
||||
MenuItemLabel *itemTestEventEndpoint = MenuItemLabel::create(labelTestEventEndpoint, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestEventEndpointClicked, this));
|
||||
itemTestEventEndpoint->setPosition(ccp(VisibleRect::right().x - labelTestEventEndpoint->getContentSize().width / 2 - 5, winSize.height - MARGIN - 3 * SPACE));
|
||||
itemTestEventEndpoint->setPosition(Point(VisibleRect::right().x - labelTestEventEndpoint->getContentSize().width / 2 - 5, winSize.height - MARGIN - 3 * SPACE));
|
||||
menuRequest->addChild(itemTestEventEndpoint);
|
||||
|
||||
// Test disconnecting basic client
|
||||
LabelTTF *labelTestClientDisconnect = LabelTTF::create("Disconnect Socket", "Arial", 22);
|
||||
MenuItemLabel *itemClientDisconnect = MenuItemLabel::create(labelTestClientDisconnect, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestClientDisconnectClicked, this));
|
||||
itemClientDisconnect->setPosition(ccp(VisibleRect::left().x + labelTestClientDisconnect->getContentSize().width / 2 + 5, winSize.height - MARGIN - 4 * SPACE));
|
||||
itemClientDisconnect->setPosition(Point(VisibleRect::left().x + labelTestClientDisconnect->getContentSize().width / 2 + 5, winSize.height - MARGIN - 4 * SPACE));
|
||||
menuRequest->addChild(itemClientDisconnect);
|
||||
|
||||
// Test disconnecting the endpoint '/testpoint'
|
||||
LabelTTF *labelTestEndpointDisconnect = LabelTTF::create("Disconnect Endpoint", "Arial", 22);
|
||||
MenuItemLabel *itemTestEndpointDisconnect = MenuItemLabel::create(labelTestEndpointDisconnect, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestEndpointDisconnectClicked, this));
|
||||
itemTestEndpointDisconnect->setPosition(ccp(VisibleRect::right().x - labelTestEndpointDisconnect->getContentSize().width / 2 - 5, winSize.height - MARGIN - 4 * SPACE));
|
||||
itemTestEndpointDisconnect->setPosition(Point(VisibleRect::right().x - labelTestEndpointDisconnect->getContentSize().width / 2 - 5, winSize.height - MARGIN - 4 * SPACE));
|
||||
menuRequest->addChild(itemTestEndpointDisconnect);
|
||||
|
||||
// Sahred Status Label
|
||||
_sioClientStatus = LabelTTF::create("Not connected...", "Arial", 14, CCSizeMake(320, 100), kTextAlignmentLeft);
|
||||
_sioClientStatus->setAnchorPoint(ccp(0, 0));
|
||||
_sioClientStatus->setPosition(ccp(VisibleRect::left().x, VisibleRect::rightBottom().y));
|
||||
_sioClientStatus = LabelTTF::create("Not connected...", "Arial", 14, Size(320, 100), kTextAlignmentLeft);
|
||||
_sioClientStatus->setAnchorPoint(Point(0, 0));
|
||||
_sioClientStatus->setPosition(Point(VisibleRect::left().x, VisibleRect::rightBottom().y));
|
||||
this->addChild(_sioClientStatus);
|
||||
|
||||
// Back Menu
|
||||
MenuItemFont *itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(SocketIOTestLayer::toExtensionsMainLayer, this));
|
||||
itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
itemBack->setPosition(Point(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
Menu *menuBack = Menu::create(itemBack, NULL);
|
||||
menuBack->setPosition(PointZero);
|
||||
menuBack->setPosition(Point::ZERO);
|
||||
addChild(menuBack);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue