From 943b805bc85404770dee62f41e3fa1e3f1832b76 Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Wed, 24 Jul 2013 14:02:36 -0700 Subject: [PATCH] Fixes some warnings ... and updates the version to pre-alpha0 --- cocos2dx/cocos2d.cpp | 2 +- .../tilemap_parallax_nodes/CCParallaxNode.h | 3 +++ .../ComponentsTest/EnemyController.cpp | 11 +++++---- .../ComponentsTest/ProjectileController.cpp | 24 +++++++++++++------ 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/cocos2dx/cocos2d.cpp b/cocos2dx/cocos2d.cpp index d109164fe1..859af0a34a 100644 --- a/cocos2dx/cocos2d.cpp +++ b/cocos2dx/cocos2d.cpp @@ -30,7 +30,7 @@ NS_CC_BEGIN const char* cocos2dVersion() { - return "3.0-alpha0-pre"; + return "3.0-pre-alpha0"; } NS_CC_END diff --git a/cocos2dx/tilemap_parallax_nodes/CCParallaxNode.h b/cocos2dx/tilemap_parallax_nodes/CCParallaxNode.h index 00ed30e664..7a752d4b2d 100644 --- a/cocos2dx/tilemap_parallax_nodes/CCParallaxNode.h +++ b/cocos2dx/tilemap_parallax_nodes/CCParallaxNode.h @@ -56,6 +56,9 @@ public: ParallaxNode(); virtual ~ParallaxNode(); + // prevents compiler warning: "Included function hides overloaded virtual functions" + using Node::addChild; + void addChild(Node * child, int z, const Point& parallaxRatio, const Point& positionOffset); /** Sets an array of layers for the Parallax node */ diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ComponentsTest/EnemyController.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ComponentsTest/EnemyController.cpp index 8b3ba010ff..2c62142516 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ComponentsTest/EnemyController.cpp +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ComponentsTest/EnemyController.cpp @@ -35,17 +35,18 @@ void EnemyController::onEnter() // Determine speed of the target - int minDuration = (int)2.0; - int maxDuration = (int)4.0; + int minDuration = 2; + int maxDuration = 4; int rangeDuration = maxDuration - minDuration; // srand( TimGetTicks() ); int actualDuration = ( rand() % rangeDuration ) + minDuration; // Create the actions - FiniteTimeAction* actionMove = MoveTo::create( (float)actualDuration, + FiniteTimeAction* actionMove = MoveTo::create( actualDuration, Point(0 - getOwner()->getContentSize().width/2, actualY) ); - FiniteTimeAction* actionMoveDone = CallFuncN::create(getOwner()->getParent()->getComponent("SceneController"), - callfuncN_selector(SceneController::spriteMoveFinished)); + FiniteTimeAction* actionMoveDone = CallFuncN::create( + CC_CALLBACK_1(SceneController::spriteMoveFinished, static_cast( getOwner()->getParent()->getComponent("SceneController") ))); + _owner->runAction( Sequence::create(actionMove, actionMoveDone, NULL) ); } diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp index 3a3995f430..61fe94b312 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp @@ -93,6 +93,10 @@ ProjectileController* ProjectileController::create(void) return pRet; } +void freeFunction( Node *ignore ) +{ + log("hello"); +} void ProjectileController::move(float flocationX, float flocationY) { @@ -121,19 +125,25 @@ void ProjectileController::move(float flocationX, float flocationY) float velocity = 480/1; // 480pixels/1sec float realMoveDuration = length/velocity; - // Move projectile to actual endpoint - _owner->runAction( Sequence::create( - MoveTo::create(realMoveDuration, realDest), - CallFuncN::create(getOwner()->getParent()->getComponent("SceneController"), - callfuncN_selector(SceneController::spriteMoveFinished)), - NULL) ); + auto callfunc = CallFuncN::create( + CC_CALLBACK_1( + SceneController::spriteMoveFinished, + static_cast( getOwner()->getParent()->getComponent("SceneController") + ) ) ); + // Move projectile to actual endpoint + _owner->runAction( + Sequence::create( + MoveTo::create(realMoveDuration, realDest), + callfunc, + NULL) + ); } void ProjectileController::die() { Component *com = _owner->getParent()->getComponent("SceneController"); - cocos2d::Array *_projectiles = ((SceneController*)com)->getProjectiles(); + cocos2d::Array *_projectiles = static_cast(com)->getProjectiles(); _projectiles->removeObject(_owner); _owner->removeFromParentAndCleanup(true); }