Merge pull request #3174 from dumganhar/iss2407-class-order

issue 2407: Adds more readability to the class internals for 'ParallaxNode'.
This commit is contained in:
James Chen 2013-07-16 23:45:22 -07:00
commit eb475174b6
4 changed files with 18 additions and 24 deletions

View File

@ -72,14 +72,15 @@ ParallaxNode * ParallaxNode::create()
return pRet;
}
void ParallaxNode::addChild(Node * child, unsigned int zOrder, int tag)
void ParallaxNode::addChild(Node * child, int zOrder, int tag)
{
CC_UNUSED_PARAM(zOrder);
CC_UNUSED_PARAM(child);
CC_UNUSED_PARAM(tag);
CCAssert(0,"ParallaxNode: use addChild:z:parallaxRatio:positionOffset instead");
}
void ParallaxNode::addChild(Node *child, unsigned int z, const Point& ratio, const Point& offset)
void ParallaxNode::addChild(Node *child, int z, const Point& ratio, const Point& offset)
{
CCAssert( child != NULL, "Argument must be non-nil");
PointObject *obj = PointObject::pointWithPoint(ratio, offset);

View File

@ -45,10 +45,10 @@ The children will be moved faster / slower than the parent according the the par
*/
class CC_DLL ParallaxNode : public Node
{
/** array that holds the offset / ratio of the children */
CC_SYNTHESIZE(struct _ccArray *, _parallaxArray, ParallaxArray)
public:
// Create a Parallax node
static ParallaxNode * create();
/** Adds a child to the container with a z-order, a parallax ratio and a position offset
It returns self, so you can chain several addChilds.
@since v0.8
@ -56,17 +56,21 @@ public:
ParallaxNode();
virtual ~ParallaxNode();
static ParallaxNode * create();
virtual void addChild(Node * child, unsigned int z, const Point& parallaxRatio, const Point& positionOffset);
// super methods
virtual void addChild(Node * child, unsigned int zOrder, int tag);
virtual void removeChild(Node* child, bool cleanup);
virtual void removeAllChildrenWithCleanup(bool cleanup);
virtual void visit(void);
virtual void addChild(Node * child, int z, const Point& parallaxRatio, const Point& positionOffset);
//
// Overrides
//
virtual void addChild(Node * child, int zOrder, int tag) override;
virtual void removeChild(Node* child, bool cleanup) override;
virtual void removeAllChildrenWithCleanup(bool cleanup) override;
virtual void visit(void) override;
private:
Point absolutePosition();
protected:
Point _lastPosition;
/** array that holds the offset / ratio of the children */
CC_SYNTHESIZE(struct _ccArray *, _parallaxArray, ParallaxArray)
};
// end of tilemap_parallax_nodes group

View File

@ -5,17 +5,6 @@
#include "Box2D/Box2D.h"
#include "../testBasic.h"
class PhysicsSprite : public Sprite
{
public:
PhysicsSprite();
void setPhysicsBody(b2Body * body);
virtual bool isDirty(void);
virtual AffineTransform nodeToParentTransform(void);
private:
b2Body* _body; // strong ref
};
class Box2DTestLayer : public Layer
{
Texture2D* _spriteTexture; // weak ref

View File

@ -1 +1 @@
31da76f078d1058b703cd45135e59ad906994e9b
963dd3732308b99e5251cb07db6e2260d3574e29