From eada29ee400af59356a5237205b19b0d469e8441 Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 15 Jul 2013 16:14:26 +0800 Subject: [PATCH 1/5] issue #2404:created CCDprecated.h and move all global functions and variables into it --- .../project.pbxproj.REMOVED.git-id | 2 +- cocos2dx/Android.mk | 1 - cocos2dx/CCDirector.cpp | 1 - cocos2dx/actions/CCAction.cpp | 1 - cocos2dx/actions/CCActionCatmullRom.cpp | 1 - cocos2dx/actions/CCActionGrid3D.cpp | 1 - cocos2dx/actions/CCActionInterval.cpp | 1 - cocos2dx/actions/CCActionPageTurn3D.cpp | 1 - cocos2dx/actions/CCActionTiledGrid.cpp | 1 - cocos2dx/base_nodes/CCNode.cpp | 1 - cocos2dx/cocoa/CCGeometry.h | 25 -- cocos2dx/draw_nodes/CCDrawNode.cpp | 1 - cocos2dx/draw_nodes/CCDrawingPrimitives.cpp | 1 - cocos2dx/effects/CCGrid.cpp | 1 - cocos2dx/include/CCDeprecated.h | 407 ++++++++++++++++++ cocos2dx/include/cocos2d.h | 1 - cocos2dx/label_nodes/CCLabelAtlas.cpp | 1 - cocos2dx/label_nodes/CCLabelBMFont.cpp | 1 - .../CCLayer.cpp | 1 - .../CCScene.cpp | 1 - .../CCTransition.cpp | 1 - .../CCTransitionProgress.cpp | 1 - cocos2dx/menu_nodes/CCMenu.cpp | 1 - cocos2dx/menu_nodes/CCMenuItem.cpp | 1 - cocos2dx/misc_nodes/CCClippingNode.cpp | 1 - cocos2dx/misc_nodes/CCMotionStreak.cpp | 1 - cocos2dx/misc_nodes/CCProgressTimer.cpp | 1 - .../particle_nodes/CCParticleBatchNode.cpp | 1 - .../particle_nodes/CCParticleExamples.cpp | 1 - cocos2dx/particle_nodes/CCParticleSystem.cpp | 1 - cocos2dx/proj.linux/Makefile | 1 - cocos2dx/proj.nacl/Makefile | 1 - cocos2dx/sprite_nodes/CCSprite.cpp | 1 - cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp | 1 - cocos2dx/support/CCPointExtension.cpp | 128 ------ cocos2dx/support/CCPointExtension.h | 346 --------------- cocos2dx/support/CCVertex.cpp | 1 - .../tilemap_parallax_nodes/CCParallaxNode.cpp | 1 - .../tilemap_parallax_nodes/CCTMXLayer.cpp | 1 - .../tilemap_parallax_nodes/CCTMXTiledMap.cpp | 1 - .../tilemap_parallax_nodes/CCTMXXMLParser.cpp | 1 - .../tilemap_parallax_nodes/CCTileMapAtlas.cpp | 1 - cocos2dx/touch_dispatcher/CCTouch.cpp | 1 - .../CCControlExtension/CCControlButton.cpp | 1 - .../CCControlColourPicker.cpp | 1 - .../CCControlExtension/CCControlHuePicker.cpp | 1 - .../CCControlSaturationBrightnessPicker.cpp | 1 - .../CCControlExtension/CCControlSlider.cpp | 1 - .../GUI/CCControlExtension/CCControlUtils.cpp | 1 - extensions/GUI/CCEditBox/CCEditBoxImplMac.mm | 2 +- extensions/GUI/CCScrollView/CCTableView.cpp | 1 - extensions/network/SocketIO.cpp | 5 +- extensions/physics_nodes/CCPhysicsSprite.cpp | 1 - .../NetworkTest/SocketIOTest.cpp | 30 +- 54 files changed, 427 insertions(+), 564 deletions(-) create mode 100644 cocos2dx/include/CCDeprecated.h delete mode 100644 cocos2dx/support/CCPointExtension.cpp delete mode 100644 cocos2dx/support/CCPointExtension.h diff --git a/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id b/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id index 2775f5f479..c9f2ecce27 100644 --- a/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -3f4cd506dc44d54f375a2c759a90db69d845b75b \ No newline at end of file +16f9fcf29ae0c1b3a14728f0a11518f50355fb18 \ No newline at end of file diff --git a/cocos2dx/Android.mk b/cocos2dx/Android.mk index a301517306..915a53087a 100644 --- a/cocos2dx/Android.mk +++ b/cocos2dx/Android.mk @@ -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 \ diff --git a/cocos2dx/CCDirector.cpp b/cocos2dx/CCDirector.cpp index 3c0a4a8fe4..27541a2ee7 100644 --- a/cocos2dx/CCDirector.cpp +++ b/cocos2dx/CCDirector.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" diff --git a/cocos2dx/actions/CCAction.cpp b/cocos2dx/actions/CCAction.cpp index 46f38d6dc1..8a80cf92a4 100644 --- a/cocos2dx/actions/CCAction.cpp +++ b/cocos2dx/actions/CCAction.cpp @@ -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 diff --git a/cocos2dx/actions/CCActionCatmullRom.cpp b/cocos2dx/actions/CCActionCatmullRom.cpp index 35dbceff1a..b669334c44 100644 --- a/cocos2dx/actions/CCActionCatmullRom.cpp +++ b/cocos2dx/actions/CCActionCatmullRom.cpp @@ -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; diff --git a/cocos2dx/actions/CCActionGrid3D.cpp b/cocos2dx/actions/CCActionGrid3D.cpp index d2aebbca29..a290128f70 100644 --- a/cocos2dx/actions/CCActionGrid3D.cpp +++ b/cocos2dx/actions/CCActionGrid3D.cpp @@ -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 diff --git a/cocos2dx/actions/CCActionInterval.cpp b/cocos2dx/actions/CCActionInterval.cpp index d2e061aad1..15c0e14240 100644 --- a/cocos2dx/actions/CCActionInterval.cpp +++ b/cocos2dx/actions/CCActionInterval.cpp @@ -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 diff --git a/cocos2dx/actions/CCActionPageTurn3D.cpp b/cocos2dx/actions/CCActionPageTurn3D.cpp index a8117e9057..90ea5f6f28 100644 --- a/cocos2dx/actions/CCActionPageTurn3D.cpp +++ b/cocos2dx/actions/CCActionPageTurn3D.cpp @@ -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 diff --git a/cocos2dx/actions/CCActionTiledGrid.cpp b/cocos2dx/actions/CCActionTiledGrid.cpp index 3e3ce3a2c2..f9b9660e18 100644 --- a/cocos2dx/actions/CCActionTiledGrid.cpp +++ b/cocos2dx/actions/CCActionTiledGrid.cpp @@ -25,7 +25,6 @@ THE SOFTWARE. #include "CCActionTiledGrid.h" #include "CCDirector.h" #include "ccMacros.h" -#include "support/CCPointExtension.h" #include "effects/CCGrid.h" #include diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index d4e2aff686..f2ccf8a59b 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -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" diff --git a/cocos2dx/cocoa/CCGeometry.h b/cocos2dx/cocoa/CCGeometry.h index 7a0415debd..d734f2a22c 100644 --- a/cocos2dx/cocoa/CCGeometry.h +++ b/cocos2dx/cocoa/CCGeometry.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 /// @} diff --git a/cocos2dx/draw_nodes/CCDrawNode.cpp b/cocos2dx/draw_nodes/CCDrawNode.cpp index a054e77c60..50a99ad086 100644 --- a/cocos2dx/draw_nodes/CCDrawNode.cpp +++ b/cocos2dx/draw_nodes/CCDrawNode.cpp @@ -21,7 +21,6 @@ */ #include "CCDrawNode.h" -#include "support/CCPointExtension.h" #include "shaders/CCShaderCache.h" #include "CCGL.h" diff --git a/cocos2dx/draw_nodes/CCDrawingPrimitives.cpp b/cocos2dx/draw_nodes/CCDrawingPrimitives.cpp index 2932877e00..494fe2d86d 100644 --- a/cocos2dx/draw_nodes/CCDrawingPrimitives.cpp +++ b/cocos2dx/draw_nodes/CCDrawingPrimitives.cpp @@ -44,7 +44,6 @@ THE SOFTWARE. #include "shaders/CCShaderCache.h" #include "shaders/CCGLProgram.h" #include "actions/CCActionCatmullRom.h" -#include "support/CCPointExtension.h" #include #include diff --git a/cocos2dx/effects/CCGrid.cpp b/cocos2dx/effects/CCGrid.cpp index efcc387b27..63229be994 100644 --- a/cocos2dx/effects/CCGrid.cpp +++ b/cocos2dx/effects/CCGrid.cpp @@ -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" diff --git a/cocos2dx/include/CCDeprecated.h b/cocos2dx/include/CCDeprecated.h new file mode 100644 index 0000000000..4f19153aed --- /dev/null +++ b/cocos2dx/include/CCDeprecated.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 + +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__ diff --git a/cocos2dx/include/cocos2d.h b/cocos2dx/include/cocos2d.h index 70521287cc..a921b02859 100755 --- a/cocos2dx/include/cocos2d.h +++ b/cocos2dx/include/cocos2d.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" diff --git a/cocos2dx/label_nodes/CCLabelAtlas.cpp b/cocos2dx/label_nodes/CCLabelAtlas.cpp index f95142c56d..7faf3c0f4a 100644 --- a/cocos2dx/label_nodes/CCLabelAtlas.cpp +++ b/cocos2dx/label_nodes/CCLabelAtlas.cpp @@ -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" diff --git a/cocos2dx/label_nodes/CCLabelBMFont.cpp b/cocos2dx/label_nodes/CCLabelBMFont.cpp index 6432ed7fc9..dda4ac645b 100644 --- a/cocos2dx/label_nodes/CCLabelBMFont.cpp +++ b/cocos2dx/label_nodes/CCLabelBMFont.cpp @@ -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" diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp index b4e5313ec7..3b7746ffb4 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp @@ -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" diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCScene.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCScene.cpp index 49cc28a794..4a144f9b80 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCScene.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCScene.cpp @@ -25,7 +25,6 @@ THE SOFTWARE. ****************************************************************************/ #include "CCScene.h" -#include "support/CCPointExtension.h" #include "CCDirector.h" NS_CC_BEGIN diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp index 3f94fb7b4b..022af3186e 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp @@ -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" diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp index 0fc2f043e9..d17ab33d0a 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp @@ -32,7 +32,6 @@ THE SOFTWARE. #include "CCLayer.h" #include "actions/CCActionInstant.h" #include "actions/CCActionProgressTimer.h" -#include "support/CCPointExtension.h" NS_CC_BEGIN diff --git a/cocos2dx/menu_nodes/CCMenu.cpp b/cocos2dx/menu_nodes/CCMenu.cpp index 29a3a70ab0..abcbb59338 100644 --- a/cocos2dx/menu_nodes/CCMenu.cpp +++ b/cocos2dx/menu_nodes/CCMenu.cpp @@ -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" diff --git a/cocos2dx/menu_nodes/CCMenuItem.cpp b/cocos2dx/menu_nodes/CCMenuItem.cpp index 4a9d4adaf5..c433c17e1b 100644 --- a/cocos2dx/menu_nodes/CCMenuItem.cpp +++ b/cocos2dx/menu_nodes/CCMenuItem.cpp @@ -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" diff --git a/cocos2dx/misc_nodes/CCClippingNode.cpp b/cocos2dx/misc_nodes/CCClippingNode.cpp index 7436f1d430..d26ab5fe11 100644 --- a/cocos2dx/misc_nodes/CCClippingNode.cpp +++ b/cocos2dx/misc_nodes/CCClippingNode.cpp @@ -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 diff --git a/cocos2dx/misc_nodes/CCMotionStreak.cpp b/cocos2dx/misc_nodes/CCMotionStreak.cpp index ced9aa9077..e22627c7fd 100644 --- a/cocos2dx/misc_nodes/CCMotionStreak.cpp +++ b/cocos2dx/misc_nodes/CCMotionStreak.cpp @@ -30,7 +30,6 @@ THE SOFTWARE. #include "ccMacros.h" #include "support/CCVertex.h" -#include "support/CCPointExtension.h" NS_CC_BEGIN diff --git a/cocos2dx/misc_nodes/CCProgressTimer.cpp b/cocos2dx/misc_nodes/CCProgressTimer.cpp index 84caf804fc..7154c4839c 100644 --- a/cocos2dx/misc_nodes/CCProgressTimer.cpp +++ b/cocos2dx/misc_nodes/CCProgressTimer.cpp @@ -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" diff --git a/cocos2dx/particle_nodes/CCParticleBatchNode.cpp b/cocos2dx/particle_nodes/CCParticleBatchNode.cpp index 808edfc94e..908e52efdd 100644 --- a/cocos2dx/particle_nodes/CCParticleBatchNode.cpp +++ b/cocos2dx/particle_nodes/CCParticleBatchNode.cpp @@ -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" diff --git a/cocos2dx/particle_nodes/CCParticleExamples.cpp b/cocos2dx/particle_nodes/CCParticleExamples.cpp index f228433789..56332ec05c 100644 --- a/cocos2dx/particle_nodes/CCParticleExamples.cpp +++ b/cocos2dx/particle_nodes/CCParticleExamples.cpp @@ -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" diff --git a/cocos2dx/particle_nodes/CCParticleSystem.cpp b/cocos2dx/particle_nodes/CCParticleSystem.cpp index 651fdf1288..96754b381b 100644 --- a/cocos2dx/particle_nodes/CCParticleSystem.cpp +++ b/cocos2dx/particle_nodes/CCParticleSystem.cpp @@ -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" diff --git a/cocos2dx/proj.linux/Makefile b/cocos2dx/proj.linux/Makefile index d823d2aa74..6659f2ac69 100644 --- a/cocos2dx/proj.linux/Makefile +++ b/cocos2dx/proj.linux/Makefile @@ -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 \ diff --git a/cocos2dx/proj.nacl/Makefile b/cocos2dx/proj.nacl/Makefile index 2af3be460d..d44de4199c 100644 --- a/cocos2dx/proj.nacl/Makefile +++ b/cocos2dx/proj.nacl/Makefile @@ -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 \ diff --git a/cocos2dx/sprite_nodes/CCSprite.cpp b/cocos2dx/sprite_nodes/CCSprite.cpp index 38fefd32a9..36f741e5e0 100644 --- a/cocos2dx/sprite_nodes/CCSprite.cpp +++ b/cocos2dx/sprite_nodes/CCSprite.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" diff --git a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp index f68e33d607..3c99517126 100644 --- a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp +++ b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp @@ -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" diff --git a/cocos2dx/support/CCPointExtension.cpp b/cocos2dx/support/CCPointExtension.cpp deleted file mode 100644 index 452a27bd79..0000000000 --- a/cocos2dx/support/CCPointExtension.cpp +++ /dev/null @@ -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 - -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 diff --git a/cocos2dx/support/CCPointExtension.h b/cocos2dx/support/CCPointExtension.h deleted file mode 100644 index 9d35b5d71b..0000000000 --- a/cocos2dx/support/CCPointExtension.h +++ /dev/null @@ -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 - -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__ - diff --git a/cocos2dx/support/CCVertex.cpp b/cocos2dx/support/CCVertex.cpp index f0b2e88bf5..27844248c3 100644 --- a/cocos2dx/support/CCVertex.cpp +++ b/cocos2dx/support/CCVertex.cpp @@ -24,7 +24,6 @@ ****************************************************************************/ #include "CCVertex.h" -#include "CCPointExtension.h" #include "ccMacros.h" NS_CC_BEGIN diff --git a/cocos2dx/tilemap_parallax_nodes/CCParallaxNode.cpp b/cocos2dx/tilemap_parallax_nodes/CCParallaxNode.cpp index 9872c09fe5..ec24fd74d8 100644 --- a/cocos2dx/tilemap_parallax_nodes/CCParallaxNode.cpp +++ b/cocos2dx/tilemap_parallax_nodes/CCParallaxNode.cpp @@ -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 diff --git a/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp b/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp index 63a1ce0f3f..34d65dfe50 100644 --- a/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp +++ b/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp @@ -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" diff --git a/cocos2dx/tilemap_parallax_nodes/CCTMXTiledMap.cpp b/cocos2dx/tilemap_parallax_nodes/CCTMXTiledMap.cpp index 1d60183c52..56ae0a6c93 100644 --- a/cocos2dx/tilemap_parallax_nodes/CCTMXTiledMap.cpp +++ b/cocos2dx/tilemap_parallax_nodes/CCTMXTiledMap.cpp @@ -27,7 +27,6 @@ THE SOFTWARE. #include "CCTMXXMLParser.h" #include "CCTMXLayer.h" #include "sprite_nodes/CCSprite.h" -#include "support/CCPointExtension.h" NS_CC_BEGIN diff --git a/cocos2dx/tilemap_parallax_nodes/CCTMXXMLParser.cpp b/cocos2dx/tilemap_parallax_nodes/CCTMXXMLParser.cpp index 9962a3b29c..9927f411de 100644 --- a/cocos2dx/tilemap_parallax_nodes/CCTMXXMLParser.cpp +++ b/cocos2dx/tilemap_parallax_nodes/CCTMXXMLParser.cpp @@ -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" diff --git a/cocos2dx/tilemap_parallax_nodes/CCTileMapAtlas.cpp b/cocos2dx/tilemap_parallax_nodes/CCTileMapAtlas.cpp index 9dd1001368..35a57c20f1 100644 --- a/cocos2dx/tilemap_parallax_nodes/CCTileMapAtlas.cpp +++ b/cocos2dx/tilemap_parallax_nodes/CCTileMapAtlas.cpp @@ -31,7 +31,6 @@ THE SOFTWARE. #include "cocoa/CCDictionary.h" #include "cocoa/CCInteger.h" #include "CCDirector.h" -#include "support/CCPointExtension.h" NS_CC_BEGIN diff --git a/cocos2dx/touch_dispatcher/CCTouch.cpp b/cocos2dx/touch_dispatcher/CCTouch.cpp index a4344778ab..c7743d7e75 100644 --- a/cocos2dx/touch_dispatcher/CCTouch.cpp +++ b/cocos2dx/touch_dispatcher/CCTouch.cpp @@ -22,7 +22,6 @@ THE SOFTWARE. ****************************************************************************/ -#include "support/CCPointExtension.h" #include "CCTouch.h" #include "CCDirector.h" diff --git a/extensions/GUI/CCControlExtension/CCControlButton.cpp b/extensions/GUI/CCControlExtension/CCControlButton.cpp index 21710d0421..328008c8cc 100644 --- a/extensions/GUI/CCControlExtension/CCControlButton.cpp +++ b/extensions/GUI/CCControlExtension/CCControlButton.cpp @@ -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" diff --git a/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp b/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp index e3e19457af..75258f1809 100644 --- a/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp +++ b/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp @@ -30,7 +30,6 @@ */ #include "CCControlColourPicker.h" -#include "support/CCPointExtension.h" #include "sprite_nodes/CCSpriteFrameCache.h" #include "sprite_nodes/CCSpriteBatchNode.h" diff --git a/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp b/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp index 8809dcc9be..f171b1557d 100644 --- a/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp +++ b/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp @@ -30,7 +30,6 @@ */ #include "CCControlHuePicker.h" -#include "support/CCPointExtension.h" NS_CC_EXT_BEGIN diff --git a/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp b/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp index 05ee90fd51..4f5668a500 100644 --- a/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp +++ b/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp @@ -30,7 +30,6 @@ */ #include "CCControlSaturationBrightnessPicker.h" -#include "support/CCPointExtension.h" NS_CC_EXT_BEGIN diff --git a/extensions/GUI/CCControlExtension/CCControlSlider.cpp b/extensions/GUI/CCControlExtension/CCControlSlider.cpp index 44f6177d01..6a2e2b5a10 100644 --- a/extensions/GUI/CCControlExtension/CCControlSlider.cpp +++ b/extensions/GUI/CCControlExtension/CCControlSlider.cpp @@ -28,7 +28,6 @@ */ #include "CCControlSlider.h" -#include "support/CCPointExtension.h" #include "touch_dispatcher/CCTouch.h" #include "CCDirector.h" diff --git a/extensions/GUI/CCControlExtension/CCControlUtils.cpp b/extensions/GUI/CCControlExtension/CCControlUtils.cpp index d6ee004d29..476272370a 100644 --- a/extensions/GUI/CCControlExtension/CCControlUtils.cpp +++ b/extensions/GUI/CCControlExtension/CCControlUtils.cpp @@ -23,7 +23,6 @@ THE SOFTWARE. ****************************************************************************/ #include "CCControlUtils.h" -#include "support/CCPointExtension.h" NS_CC_EXT_BEGIN diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm index 71d18ae3ac..cb8e041d54 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm @@ -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); diff --git a/extensions/GUI/CCScrollView/CCTableView.cpp b/extensions/GUI/CCScrollView/CCTableView.cpp index 9410d7e3ac..8e384e20a8 100644 --- a/extensions/GUI/CCScrollView/CCTableView.cpp +++ b/extensions/GUI/CCScrollView/CCTableView.cpp @@ -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" diff --git a/extensions/network/SocketIO.cpp b/extensions/network/SocketIO.cpp index 3b9282753a..6e4a387f56 100644 --- a/extensions/network/SocketIO.cpp +++ b/extensions/network/SocketIO.cpp @@ -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) { diff --git a/extensions/physics_nodes/CCPhysicsSprite.cpp b/extensions/physics_nodes/CCPhysicsSprite.cpp index f1037728c8..ee48bfb061 100644 --- a/extensions/physics_nodes/CCPhysicsSprite.cpp +++ b/extensions/physics_nodes/CCPhysicsSprite.cpp @@ -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" diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp index 8577e22de8..784c94ead7 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp @@ -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); } From b97ea0815fc60340349721fe37932da3808227c2 Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 15 Jul 2013 16:42:31 +0800 Subject: [PATCH 2/5] issue #2404:re-add some global functions and variables and mark them as deprecated --- cocos2dx/include/CCDeprecated.h | 58 ++++++++++++++++++++++++++++++++- cocos2dx/include/cocos2d.h | 1 + 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/cocos2dx/include/CCDeprecated.h b/cocos2dx/include/CCDeprecated.h index 4f19153aed..2aa48f22f2 100644 --- a/cocos2dx/include/CCDeprecated.h +++ b/cocos2dx/include/CCDeprecated.h @@ -28,8 +28,10 @@ #ifndef __COCOS2D_CCDEPRECATED_H__ #define __COCOS2D_CCDEPRECATED_H__ -#include "cocoa/CCGeometry.h" #include +#include "cocoa/CCGeometry.h" +#include "ccTypes.h" + NS_CC_BEGIN @@ -398,6 +400,60 @@ CC_DEPRECATED_ATTRIBUTE const Size SizeZero = Size::ZERO; CC_DEPRECATED_ATTRIBUTE const Rect RectZero = Rect::ZERO; +CC_DEPRECATED_ATTRIBUTE const Color3B ccWHITE = Color3B::WHITE; +CC_DEPRECATED_ATTRIBUTE const Color3B ccYELLOW = Color3B::YELLOW; +CC_DEPRECATED_ATTRIBUTE const Color3B ccGREEN = Color3B::GREEN; +CC_DEPRECATED_ATTRIBUTE const Color3B ccBLUE = Color3B::BLUE; +CC_DEPRECATED_ATTRIBUTE const Color3B ccRED = Color3B::RED; +CC_DEPRECATED_ATTRIBUTE const Color3B ccMAGENTA = Color3B::MAGENTA; +CC_DEPRECATED_ATTRIBUTE const Color3B ccBLACK = Color3B::BLACK; +CC_DEPRECATED_ATTRIBUTE const Color3B ccORANGE = Color3B::ORANGE; +CC_DEPRECATED_ATTRIBUTE const Color3B ccGRAY = Color3B::GRAY; + +CC_DEPRECATED_ATTRIBUTE const BlendFunc kBlendFuncDisable = BlendFunc::BLEND_FUNC_DISABLE; + +CC_DEPRECATED_ATTRIBUTE static inline Color3B ccc3(GLubyte r, GLubyte g, GLubyte b) +{ + return Color3B(r, g, b); +} + +CC_DEPRECATED_ATTRIBUTE static inline bool ccc3BEqual(const Color3B &col1, const Color3B &col2) +{ + return col1.r == col2.r && col1.g == col2.g && col1.b == col2.b; +} + +CC_DEPRECATED_ATTRIBUTE static inline Color4B +ccc4(const GLubyte r, const GLubyte g, const GLubyte b, const GLubyte o) +{ + return Color4B(r, g, b, o); +} + +CC_DEPRECATED_ATTRIBUTE static inline Color4F ccc4FFromccc3B(Color3B c) +{ + return Color4F(c.r/255.f, c.g/255.f, c.b/255.f, 1.f); +} + +CC_DEPRECATED_ATTRIBUTE static inline Color4F +ccc4f(const GLfloat r, const GLfloat g, const GLfloat b, const GLfloat a) +{ + return Color4F(r, g, b, a); +} + +CC_DEPRECATED_ATTRIBUTE static inline Color4F ccc4FFromccc4B(Color4B c) +{ + return Color4F(c.r/255.f, c.g/255.f, c.b/255.f, c.a/255.f); +} + +CC_DEPRECATED_ATTRIBUTE static inline Color4B ccc4BFromccc4F(Color4F c) +{ + return Color4B((GLubyte)(c.r*255), (GLubyte)(c.g*255), (GLubyte)(c.b*255), (GLubyte)(c.a*255)); +} + +CC_DEPRECATED_ATTRIBUTE static inline bool ccc4FEqual(Color4F a, Color4F b) +{ + return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a; +} + // end of data_structures group /// @} diff --git a/cocos2dx/include/cocos2d.h b/cocos2dx/include/cocos2d.h index a921b02859..67c003d0ff 100755 --- a/cocos2dx/include/cocos2d.h +++ b/cocos2dx/include/cocos2d.h @@ -85,6 +85,7 @@ THE SOFTWARE. #include "ccConfig.h" #include "ccMacros.h" #include "ccTypes.h" +#include "CCDeprecated.h" // kazmath #include "kazmath/include/kazmath/kazmath.h" From 07ae0c6da23844bd1fc041546d243e0f5e3135e8 Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 15 Jul 2013 17:18:30 +0800 Subject: [PATCH 3/5] issue #2404:remove unneeded files --- cocos2dx/proj.win32/cocos2d.vcxproj | 3 +-- cocos2dx/proj.win32/cocos2d.vcxproj.filters | 9 +++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/cocos2dx/proj.win32/cocos2d.vcxproj b/cocos2dx/proj.win32/cocos2d.vcxproj index 7aba1892f4..527e02814e 100644 --- a/cocos2dx/proj.win32/cocos2d.vcxproj +++ b/cocos2dx/proj.win32/cocos2d.vcxproj @@ -217,7 +217,6 @@ xcopy /Y /Q "$(ProjectDir)..\platform\third_party\win32\libraries\*.*" "$(OutDir - @@ -308,6 +307,7 @@ xcopy /Y /Q "$(ProjectDir)..\platform\third_party\win32\libraries\*.*" "$(OutDir + @@ -379,7 +379,6 @@ xcopy /Y /Q "$(ProjectDir)..\platform\third_party\win32\libraries\*.*" "$(OutDir - diff --git a/cocos2dx/proj.win32/cocos2d.vcxproj.filters b/cocos2dx/proj.win32/cocos2d.vcxproj.filters index 4342641386..06fa35bab2 100644 --- a/cocos2dx/proj.win32/cocos2d.vcxproj.filters +++ b/cocos2dx/proj.win32/cocos2d.vcxproj.filters @@ -297,9 +297,6 @@ support - - support - support @@ -720,9 +717,6 @@ support - - support - support @@ -971,5 +965,8 @@ keyboard_dispatcher + + include + \ No newline at end of file From dc2daf31ea0d212d835a4c6d0913494fc0c4f2e8 Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 15 Jul 2013 17:29:35 +0800 Subject: [PATCH 4/5] issue #2404:fixed some compiling errors --- cocos2dx/platform/win32/CCEGLView.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cocos2dx/platform/win32/CCEGLView.cpp b/cocos2dx/platform/win32/CCEGLView.cpp index 9421dd127e..36a6e6bf1b 100644 --- a/cocos2dx/platform/win32/CCEGLView.cpp +++ b/cocos2dx/platform/win32/CCEGLView.cpp @@ -30,7 +30,6 @@ THE SOFTWARE. #include "touch_dispatcher/CCTouchDispatcher.h" #include "text_input_node/CCIMEDispatcher.h" #include "keypad_dispatcher/CCKeypadDispatcher.h" -#include "support/CCPointExtension.h" #include "CCApplication.h" #ifdef CC_KEYBOARD_SUPPORT #include "keyboard_dispatcher/CCKeyboardDispatcher.h" @@ -352,8 +351,8 @@ LRESULT EGLView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) Point pt(point.x, point.y); pt.x /= _frameZoomFactor; pt.y /= _frameZoomFactor; - Point tmp = ccp(pt.x, _screenSize.height - pt.y); - if (_viewPortRect.equals(RectZero) || _viewPortRect.containsPoint(tmp)) + Point tmp = Point(pt.x, _screenSize.height - pt.y); + if (_viewPortRect.equals(Rect::ZERO) || _viewPortRect.containsPoint(tmp)) { _captured = true; SetCapture(_wnd); @@ -415,8 +414,8 @@ LRESULT EGLView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) input.y = TOUCH_COORD_TO_PIXEL(ti.y); ScreenToClient(_wnd, &input); Point pt(input.x, input.y); - Point tmp = ccp(pt.x, _screenSize.height - pt.y); - if (_viewPortRect.equals(RectZero) || _viewPortRect.containsPoint(tmp)) + Point tmp = Point(pt.x, _screenSize.height - pt.y); + if (_viewPortRect.equals(Rect::ZERO) || _viewPortRect.containsPoint(tmp)) { pt.x /= _frameZoomFactor; pt.y /= _frameZoomFactor; From cb271e21d8ec5d21a79c7368f7b55d85ae448c2b Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 15 Jul 2013 17:51:36 +0800 Subject: [PATCH 5/5] issue #2404:fixed some compiling warnings --- cocos2dx/include/CCDeprecated.h | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/cocos2dx/include/CCDeprecated.h b/cocos2dx/include/CCDeprecated.h index 2aa48f22f2..92e691e888 100644 --- a/cocos2dx/include/CCDeprecated.h +++ b/cocos2dx/include/CCDeprecated.h @@ -200,7 +200,7 @@ ccpDistanceSQ(const Point p1, const Point p2) @return float @since v0.7.2 */ -CC_DEPRECATED_ATTRIBUTE static inline float CC_DLL ccpLength(const Point& v) +CC_DEPRECATED_ATTRIBUTE static inline float ccpLength(const Point& v) { return v.getLength(); } @@ -209,7 +209,7 @@ CC_DEPRECATED_ATTRIBUTE static inline float CC_DLL ccpLength(const Point& v) @return float @since v0.7.2 */ -CC_DEPRECATED_ATTRIBUTE static inline float CC_DLL ccpDistance(const Point& v1, const Point& v2) +CC_DEPRECATED_ATTRIBUTE static inline float ccpDistance(const Point& v1, const Point& v2) { return v1.getDistance(v2); } @@ -218,7 +218,7 @@ CC_DEPRECATED_ATTRIBUTE static inline float CC_DLL ccpDistance(const Point& v1, @return Point @since v0.7.2 */ -CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpNormalize(const Point& v) +CC_DEPRECATED_ATTRIBUTE static inline Point ccpNormalize(const Point& v) { return v.normalize(); } @@ -227,7 +227,7 @@ CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpNormalize(const Point& v) @return Point @since v0.7.2 */ -CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpForAngle(const float a) +CC_DEPRECATED_ATTRIBUTE static inline Point ccpForAngle(const float a) { return Point::forAngle(a); } @@ -236,7 +236,7 @@ CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpForAngle(const float a) @return float @since v0.7.2 */ -CC_DEPRECATED_ATTRIBUTE static inline float CC_DLL ccpToAngle(const Point& v) +CC_DEPRECATED_ATTRIBUTE static inline float ccpToAngle(const Point& v) { return v.getAngle(); } @@ -245,7 +245,7 @@ CC_DEPRECATED_ATTRIBUTE static inline float CC_DLL ccpToAngle(const Point& v) /** 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) +CC_DEPRECATED_ATTRIBUTE static inline Point ccpClamp(const Point& p, const Point& from, const Point& to) { return p.getClampPoint(from, to); } @@ -253,7 +253,7 @@ CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpClamp(const Point& p, cons /** Quickly convert Size to a Point @since v0.99.1 */ -CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpFromSize(const Size& s) +CC_DEPRECATED_ATTRIBUTE static inline Point ccpFromSize(const Size& s) { return Point(s); } @@ -265,7 +265,7 @@ CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpFromSize(const Size& s) * ccpCompOp(p,floorf); @since v0.99.1 */ -CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpCompOp(const Point& p, float (*opFunc)(float)) +CC_DEPRECATED_ATTRIBUTE static inline Point ccpCompOp(const Point& p, float (*opFunc)(float)) { return p.compOp(opFunc); } @@ -277,7 +277,7 @@ CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpCompOp(const Point& p, flo 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) +CC_DEPRECATED_ATTRIBUTE static inline Point ccpLerp(const Point& a, const Point& b, float alpha) { return a.lerp(b, alpha); } @@ -286,7 +286,7 @@ CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpLerp(const Point& a, const /** @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) +CC_DEPRECATED_ATTRIBUTE static inline bool ccpFuzzyEqual(const Point& a, const Point& b, float variance) { return a.fuzzyEquals(b, variance); } @@ -296,7 +296,7 @@ CC_DEPRECATED_ATTRIBUTE static inline bool CC_DLL ccpFuzzyEqual(const Point& a, @returns a component-wise multiplication @since v0.99.1 */ -CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpCompMult(const Point& a, const Point& b) +CC_DEPRECATED_ATTRIBUTE static inline Point ccpCompMult(const Point& a, const Point& b) { return Point(a.x * b.x, a.y * b.y); } @@ -304,7 +304,7 @@ CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpCompMult(const Point& a, c /** @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) +CC_DEPRECATED_ATTRIBUTE static inline float ccpAngleSigned(const Point& a, const Point& b) { return a.getAngle(b); } @@ -312,7 +312,7 @@ CC_DEPRECATED_ATTRIBUTE static inline float CC_DLL ccpAngleSigned(const Point& a /** @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) +CC_DEPRECATED_ATTRIBUTE static inline float ccpAngle(const Point& a, const Point& b) { return a.getAngle(b); } @@ -324,7 +324,7 @@ CC_DEPRECATED_ATTRIBUTE static inline float CC_DLL ccpAngle(const Point& a, cons @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) +CC_DEPRECATED_ATTRIBUTE static inline Point ccpRotateByAngle(const Point& v, const Point& pivot, float angle) { return v.rotateByAngle(pivot, angle); } @@ -350,7 +350,7 @@ CC_DEPRECATED_ATTRIBUTE static inline Point CC_DLL ccpRotateByAngle(const Point& 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, +CC_DEPRECATED_ATTRIBUTE static inline bool ccpLineIntersect(const Point& p1, const Point& p2, const Point& p3, const Point& p4, float *s, float *t) { @@ -361,7 +361,7 @@ CC_DEPRECATED_ATTRIBUTE static inline bool CC_DLL ccpLineIntersect(const Point& 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) +CC_DEPRECATED_ATTRIBUTE static inline bool ccpSegmentIntersect(const Point& A, const Point& B, const Point& C, const Point& D) { return Point::isSegmentIntersect(A, B, C, D); } @@ -370,7 +370,7 @@ CC_DEPRECATED_ATTRIBUTE static inline bool CC_DLL ccpSegmentIntersect(const Poin 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) +CC_DEPRECATED_ATTRIBUTE static inline Point ccpIntersectPoint(const Point& A, const Point& B, const Point& C, const Point& D) { return Point::getIntersectPoint(A, B, C, D); }