issue #5, add declares in .cpp files, but still no implementation. change some methods to virtual.

This commit is contained in:
Walzer 2010-07-12 09:56:06 +00:00
parent fb5762c463
commit 1c2b95973d
8 changed files with 2032 additions and 219 deletions

View File

@ -62,40 +62,145 @@ CCNode::~CCNode()
}
/// zOrder getter
int CCNode::getZOrder()
{
return m_iZOrder;
}
/// ertexZ getter
float CCNode::getVertexZ()
{
return m_fVertexZ;
}
/// vertexZ setter
void CCNode::setVertexZ(float var)
{
m_fVertexZ = var;
}
/// rotation getter
float CCNode::getRotation()
{
return m_fRotation;
}
CGPoint CCNode::getPosition()
/// rotation setter
void CCNode::setRotation(float newRotation)
{
return m_tPosition;
m_fRotation = newRotation;
m_bIsTransformDirty = m_bIsInverseDirty = true;
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
m_bIsTransformGLDirty = true;
#endif
}
/// scale getter
float CCNode::getScale(void)
{
///@todo NSAssert( scaleX_ == scaleY_, @"CCNode#scale. ScaleX != ScaleY. Don't know which one to return");
return m_fScale;
}
/// scale setter
void CCNode::setScale(float scale)
{
m_fScaleX = m_fScaleY = scale;
m_bIsTransformDirty = m_bIsInverseDirty = true;
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
m_bIsTransformGLDirty = true;
#endif
}
/// scaleX getter
float CCNode::getScaleX()
{
return m_fScaleX;
}
/// scaleX setter
void CCNode::setScaleX(float newScaleX)
{
m_fScaleX = newScaleX;
m_bIsTransformDirty = m_bIsInverseDirty = true;
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
m_bIsTransformGLDirty = true;
#endif
}
/// scaleY getter
float CCNode::getScaleY()
{
return m_fScaleY;
}
void CCNode::setVisibility(bool bIsVisible)
/// scaleY setter
void CCNode::setScaleY(float newScaleY)
{
m_bIsVisible = bIsVisible;
m_fScaleY = newScaleY;
m_bIsTransformDirty = m_bIsInverseDirty = true;
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
m_bIsTransformGLDirty = true;
#endif
}
bool CCNode::getVisibility()
/// position getter
CGPoint CCNode::getPosition()
{
return m_bIsVisible;
return m_tPosition;
}
/// position setter
void CCNode::setPosition(CGPoint newPosition)
{
m_tPosition = newPosition;
m_bIsTransformDirty = m_bIsInverseDirty = true;
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
m_bIsTransformGLDirty = true;
#endif
}
/// children getter
NSMutableArray * CCNode::getChildren()
{
return m_pChildren;
}
/// children getter
// camera: lazy alloc
CCCamera* getCamera()
{
/** @todo no declare in class
if( ! camera_ ) {
camera_ = [[CCCamera alloc] init];
// by default, center camera at the Sprite's anchor point
// [camera_ setCenterX:anchorPointInPixels_.x centerY:anchorPointInPixels_.y centerZ:0];
// [camera_ setEyeX:anchorPointInPixels_.x eyeY:anchorPointInPixels_.y eyeZ:1];
// [camera_ setCenterX:0 centerY:0 centerZ:0];
// [camera_ setEyeX:0 eyeY:0 eyeZ:1];
}
return camera_;*/
return NULL;
}
/// grid getter
/// @todo
//CCGridBase* CCNode::getGrid()
//{
// return m_pGrid;
//}
/// grid setter
/// @todo
//void CCNode::setGrid(CCGridBase* pGrid)
//{
@ -109,75 +214,52 @@ bool CCNode::getVisibility()
//}
// getters synthesized, setters explicit
void CCNode::setRotation(float newRotation)
/// isVisible getter
bool CCNode::getIsVisible()
{
m_fRotation = newRotation;
m_bIsTransformDirty = m_bIsInverseDirty = true;
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
m_bIsTransformGLDirty = true;
#endif
return m_bIsVisible;
}
void CCNode::setScaleX(float newScaleX)
/// isVisible setter
void CCNode::setIsVisible(bool var)
{
m_fScaleX = newScaleX;
m_bIsTransformDirty = m_bIsInverseDirty = true;
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
m_bIsTransformGLDirty = true;
#endif
m_bIsVisible = var;
}
void CCNode::setScaleY(float newScaleY)
{
m_fScaleY = newScaleY;
m_bIsTransformDirty = m_bIsInverseDirty = true;
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
m_bIsTransformGLDirty = true;
#endif
}
void CCNode::setPosition(CGPoint newPosition)
{
m_tPosition = newPosition;
m_bIsTransformDirty = m_bIsInverseDirty = true;
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
m_bIsTransformGLDirty = true;
#endif
}
void CCNode::setIsRelativeAnchorPoint(bool newValue)
{
m_bIsRelativeAnchorPoint = newValue;
m_bIsTransformDirty = m_bIsInverseDirty = true;
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
m_bIsTransformGLDirty = true;
#endif
}
bool CCNode::getIsRelativeAnchorPoint()
{
return m_bIsRelativeAnchorPoint;
}
/// @todo
void CCNode::setAnchorPoint(CGPoint point)
{
/*if( ! CGPointEqualToPoint(point, m_anchorPoint) )
{
m_anchorPoint = point;
this->m_anchorPointInPixels = ccp( m_contentSize.width * m_anchorPoint.x, m_contentSize.height * m_anchorPoint.y );
m_isTransformDirty = m_isInverseDirty = true;
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
m_bIsTransformGLDirty = true;
#endif
}*/
}
/// anchorPoint getter
CGPoint CCNode::getAnchorPoint()
{
return m_tAnchorPoint;
}
/// @todo
/// @todo anchorPoint setter
void CCNode::setAnchorPoint(CGPoint point)
{
/*if( ! CGPointEqualToPoint(point, m_anchorPoint) )
{
m_anchorPoint = point;
this->m_anchorPointInPixels = ccp( m_contentSize.width * m_anchorPoint.x, m_contentSize.height * m_anchorPoint.y );
m_isTransformDirty = m_isInverseDirty = true;
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
m_bIsTransformGLDirty = true;
#endif
}*/
}
/// anchorPointInPixels getter
CGPoint CCNode::getAnchorPointInPixels()
{
return m_tAnchorPointInPixels;
}
/// contentSize getter
CGSize CCNode::getContentSize()
{
return m_tContentSize;
}
/// @todo contentSize setter
void CCNode::setContentSize(CGSize size)
{
//if( ! CGSizeEqualToSize(size, m_contentSize) )
@ -191,82 +273,76 @@ void CCNode::setContentSize(CGSize size)
//}
}
CGSize CCNode::getContentSize()
{
return m_tContentSize;
}
/// @todo
//CGRect CCNode::boundingBox()
//{
// CGRect rect = CGRectMake(0, 0, m_contentSize.width, m_contentSize.height);
// return CGRectApplyAffineTransform(rect, nodeToParentTransform());
//}
/// @todo
//float CCNode::scale()
//{
// UXAssert( m_scaleX == m_scaleY, L"CocosNode#scale. ScaleX != ScaleY. Don't know which one to return");
// return m_scaleX;
//}
void CCNode::setScale(float scale)
/// isRunning getter
bool CCNode::getIsRunning()
{
m_fScaleX = m_fScaleY = scale;
return m_bIsRunning;
}
/// parent getter
CCNode * CCNode::getParent()
{
return m_pParent;
}
/// parent setter
void CCNode::setParent(CCNode * var)
{
m_pParent = var;
}
/// isRelativeAnchorPoint getter
bool CCNode::getIsRelativeAnchorPoint()
{
return m_bIsRelativeAnchorPoint;
}
/// isRelativeAnchorPoint setter
void CCNode::setIsRelativeAnchorPoint(bool newValue)
{
m_bIsRelativeAnchorPoint = newValue;
m_bIsTransformDirty = m_bIsInverseDirty = true;
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
m_bIsTransformGLDirty = true;
#endif
}
/// @todo
//UxMutableArray* CCNode::children()
//{
// return m_pChildrenArray;
//}
void CCNode::setParent(CCNode* pParentNode)
{
m_pParent = pParentNode;
}
CCNode* CCNode::getParent()
{
return m_pParent;
}
/// tag getter
int CCNode::getTag()
{
return m_iTag;
}
void CCNode::setTag(int tag)
/// tag setter
void CCNode::setTag(int var)
{
m_iTag = tag;
m_iTag = var;
}
int CCNode::getZOrder()
/// userData getter
void * CCNode::getUserData()
{
return m_iZOrder;
return m_pUserData;
}
void CCNode::setVertexZ(float z)
/// userData setter
void CCNode::setUserData(void *var)
{
m_fVertexZ = z;
m_pUserData = var;
}
float CCNode::getVertexZ()
{
return m_fVertexZ;
}
CGPoint CCNode::getAnchorPointInPixels()
{
return m_tAnchorPointInPixels;
}
bool CCNode::getIsRunning()
{
return m_bIsRunning;
}
/// @todo
//CGRect CCNode::boundingBox()
//{
// CGRect rect = CGRectMake(0, 0, m_contentSize.width, m_contentSize.height);
// return CGRectApplyAffineTransform(rect, nodeToParentTransform());
//}
/** @todo
@ -278,37 +354,13 @@ bool CCNode::getIsRunning()
*/
/** @todo
@synthesize children = children_;
@synthesize visible=visible_;
@synthesize parent=parent_;
@synthesize grid=grid_;
@synthesize zOrder=zOrder_;
@synthesize tag=tag_;
@synthesize vertexZ = vertexZ_;
@synthesize isRunning=isRunning_;
@synthesize rotation=rotation_, scaleX=scaleX_, scaleY=scaleY_, position=position_;
@synthesize anchorPointInPixels=anchorPointInPixels_, isRelativeAnchorPoint=isRelativeAnchorPoint_;
@synthesize userData;
*/
float CCNode::getScale(void)
{
///@todo NSAssert( scaleX_ == scaleY_, @"CCNode#scale. ScaleX != ScaleY. Don't know which one to return");
return m_fScale;
}
CCNode * CCNode::node(void)
{
/// @todo return [[[self alloc] init] autorelease];
return NULL;
CCNode * pNode = new CCNode();
pNode->autorelease();
return pNode;
}
void CCNode::cleanup()
@ -356,25 +408,7 @@ void CCNode::childrenAlloc(void)
{
/// @todo children_ = [[CCArray alloc] initWithCapacity:4];
}
/** @todo no declare in class
// camera: lazy alloc
CCCamera* camera
{
if( ! camera_ ) {
camera_ = [[CCCamera alloc] init];
// by default, center camera at the Sprite's anchor point
// [camera_ setCenterX:anchorPointInPixels_.x centerY:anchorPointInPixels_.y centerZ:0];
// [camera_ setEyeX:anchorPointInPixels_.x eyeY:anchorPointInPixels_.y eyeZ:1];
// [camera_ setCenterX:0 centerY:0 centerZ:0];
// [camera_ setEyeX:0 eyeY:0 eyeZ:1];
}
return camera_;
}
*/
CCNode* CCNode::getChildByTag(int aTag)
{
/** @todo
@ -804,7 +838,7 @@ void CCNode::pauseSchedulerAndActions()
}
/** @todo
- (CGAffineTransform)nodeToParentTransform
CGAffineTransform CCNode::nodeToParentTransform(void)
{
if ( isTransformDirty_ ) {
@ -827,8 +861,8 @@ void CCNode::pauseSchedulerAndActions()
}
return transform_;
}
}*/
/** @todo
- (CGAffineTransform)parentToNodeTransform
{
if ( isInverseDirty_ ) {
@ -837,8 +871,8 @@ void CCNode::pauseSchedulerAndActions()
}
return inverse_;
}
}*/
/** @todo
- (CGAffineTransform)nodeToWorldTransform
{
CGAffineTransform t = [self nodeToParentTransform];
@ -847,50 +881,57 @@ void CCNode::pauseSchedulerAndActions()
t = CGAffineTransformConcat(t, [p nodeToParentTransform]);
return t;
}
}*/
/** @todo
- (CGAffineTransform)worldToNodeTransform
{
return CGAffineTransformInvert([self nodeToWorldTransform]);
}*/
CGPoint CCNode::convertToNodeSpace(CGPoint worldPoint)
{
/// @todo return CGPointApplyAffineTransform(worldPoint, [self worldToNodeTransform]);
return CGPoint(0,0);
}
- (CGPoint)convertToNodeSpace:(CGPoint)worldPoint
CGPoint CCNode::convertToWorldSpace(CGPoint nodePoint)
{
return CGPointApplyAffineTransform(worldPoint, [self worldToNodeTransform]);
/// @todo return CGPointApplyAffineTransform(nodePoint, [self nodeToWorldTransform]);
return CGPoint(0,0);
}
- (CGPoint)convertToWorldSpace:(CGPoint)nodePoint
{
return CGPointApplyAffineTransform(nodePoint, [self nodeToWorldTransform]);
}
- (CGPoint)convertToNodeSpaceAR:(CGPoint)worldPoint
CGPoint CCNode::convertToNodeSpaceAR(CGPoint worldPoint)
{
/** @todo
CGPoint nodePoint = [self convertToNodeSpace:worldPoint];
return ccpSub(nodePoint, anchorPointInPixels_);
return ccpSub(nodePoint, anchorPointInPixels_);*/
return CGPoint(0,0);
}
- (CGPoint)convertToWorldSpaceAR:(CGPoint)nodePoint
CGPoint CCNode::convertToWorldSpaceAR(CGPoint nodePoint)
{
/** @todo
nodePoint = ccpAdd(nodePoint, anchorPointInPixels_);
return [self convertToWorldSpace:nodePoint];
return [self convertToWorldSpace:nodePoint];*/
return CGPoint(0,0);
}
- (CGPoint)convertToWindowSpace:(CGPoint)nodePoint
/** @todo no declare in .h file
CGPoint CCNode::convertToWindowSpace(CGPoint nodePoint)
{
CGPoint worldPoint = [self convertToWorldSpace:nodePoint];
return [[CCDirector sharedDirector] convertToUI:worldPoint];
}
}*/
// convenience methods which take a UITouch instead of CGPoint
/** @todo
- (CGPoint)convertTouchToNodeSpace:(UITouch *)touch
{
CGPoint point = [touch locationInView: [touch view]];
point = [[CCDirector sharedDirector] convertToGL: point];
return [self convertToNodeSpace:point];
}
}*/
/** @todo
- (CGPoint)convertTouchToNodeSpaceAR:(UITouch *)touch
{
CGPoint point = [touch locationInView: [touch view]];

View File

@ -45,6 +45,10 @@ class CCLayer : public CCNode//, public UIAccelerometerDelegate, public CCStanda
public:
CCLayer();
virtual ~CCLayer();
virtual void onEnter();
virtual void onExit();
/** If isTouchEnabled, this method is called onEnter. Override it to change the
way CCLayer receives touch events.
( Default: [[TouchDispatcher sharedDispatcher] addStandardDelegate:self priority:0] )
@ -91,6 +95,9 @@ public:
CCColorLayer();
virtual ~CCColorLayer();
virtual void draw();
virtual void setContentSize(CGSize var);
/** creates a CCLayer with color, width and height */
static CCColorLayer * layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
/** creates a CCLayer with color. Width and height are the window size. */
@ -111,11 +118,14 @@ public:
void changeWidthAndHeight(GLfloat w ,GLfloat h);
/** Opacity: conforms to CCRGBAProtocol protocol */
CCX_PROPERTY_READONLY(GLubyte, m_cOpacity, Opacity)
CCX_PROPERTY(GLubyte, m_cOpacity, Opacity)
/** Opacity: conforms to CCRGBAProtocol protocol */
CCX_PROPERTY_READONLY(ccColor3B, m_tColor, Color)
CCX_PROPERTY(ccColor3B, m_tColor, Color)
/** BlendFunction. Conforms to CCBlendProtocol protocol */
CCX_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc)
private :
void updateColor();
};
/** CCMultipleLayer is a CCLayer with the ability to multiplex it's children.
@ -127,7 +137,7 @@ class CCMultiplexLayer : public CCLayer
{
protected:
unsigned int m_iEnabledLayer;
NSMutableArray * m_tLayers;
NSMutableArray * m_pLayers;
public:
CCMultiplexLayer();

View File

@ -92,8 +92,8 @@ Camera:
- Each node has a camera. By default it points to the center of the CCNode.
*/
class CCNode{
class CCNode : public NSObject
{
// variable property
/** The z order of the node relative to it's "brothers": children of the same parent */
@ -135,7 +135,7 @@ class CCNode{
CCX_PROPERTY(CCGridBase *, m_pGrid, Grid)
/** Whether of not the node is visible. Default is true */
CCX_PROPERTY(bool, m_bIsVisible, Visibility)
CCX_PROPERTY(bool, m_bIsVisible, IsVisible)
/** anchorPoint is the point around which all transformations and positioning manipulations take place.
It's like a pin in the node where it is "attached" to its parent.
@ -149,7 +149,7 @@ class CCNode{
/** The anchorPoint in absolute pixels.
Since v0.8 you can only read it. If you wish to modify it, use anchorPoint instead
*/
CCX_PROPERTY(CGPoint, m_tAnchorPointInPixels, AnchorPointInPixels)
CCX_PROPERTY_READONLY(CGPoint, m_tAnchorPointInPixels, AnchorPointInPixels)
/** The untransformed size of the node.
The contentSize remains the same no matter the node is scaled or rotated.
@ -221,7 +221,7 @@ public:
If the CCNode enters the 'stage' with a transition, this callback is called when the transition starts.
During onEnter you can't a "sister/brother" node.
*/
void onEnter();
virtual void onEnter();
/** callback that is called when the CCNode enters in the 'stage'.
If the CCNode enters the 'stage' with a transition, this callback is called when the transition finishes.
@since v0.8
@ -231,7 +231,7 @@ public:
If the CCNode leaves the 'stage' with a transition, this callback is called when the transition finishes.
During onExit you can't a "sister/brother" node.
*/
void onExit();
virtual void onExit();
// composition: ADD
@ -291,8 +291,10 @@ public:
/** Stops all running actions and schedulers
@since v0.8
*/
void cleanup(void);
virtual void cleanup(void);
// @todo no declare in objc,but delcare in .m file
virtual void dealloc(void);
// draw

View File

@ -43,7 +43,6 @@ class CCScene : public CCNode
public:
CCScene();
virtual ~CCScene();
};
#endif // __CCSCENE_H__

View File

@ -38,6 +38,8 @@ class CCTransitionEaseScene : public NSObject
@since v0.8.2
*/
public:
CCTransitionEaseScene();
virtual ~CCTransitionEaseScene();
virtual CCIntervalAction * easeActionWithAction(CCIntervalAction * action);
};
@ -60,13 +62,22 @@ class CCTransitionScene : public CCScene
{
protected:
CCScene * m_tInScene;
CCScene * m_tOutScene;
CCScene * m_pInScene;
CCScene * m_pOutScene;
ccTime m_fDuration;
BOOL m_bIsInSceneOnTop;
BOOL m_bIsSendCleanupToScene;
bool m_bIsInSceneOnTop;
bool m_bIsSendCleanupToScene;
public:
CCTransitionScene();
virtual ~CCTransitionScene();
virtual void draw();
virtual void onEnter();
virtual void onExit();
virtual void cleanup();
virtual void dealloc();
/** creates a base transition with duration and incoming scene */
static CCTransitionScene * transitionWithDurationAndScene(ccTime t, CCScene *scene);
@ -78,6 +89,11 @@ public:
/** used by some transitions to hide the outter scene */
void hideOutShowIn(void);
private:
void sceneOrder();
void setNewScene(ccTime dt);
};
/** A CCTransition that supports orientation like.
@ -89,8 +105,11 @@ protected:
tOrientation m_tOrientation;
public:
CCOrientedTransitionScene();
~CCOrientedTransitionScene();
/** creates a base transition with duration and incoming scene */
virtual CCOrientedTransitionScene * transitionWithDurationAndScene(ccTime t,CCScene* scene, tOrientation orientation);
static CCOrientedTransitionScene * transitionWithDurationAndScene(ccTime t,CCScene* scene, tOrientation orientation);
/** initializes a transition with duration and incoming scene */
virtual CCOrientedTransitionScene * initWithDurationAndScene(ccTime t,CCScene* scene,tOrientation orientation);
};
@ -103,6 +122,7 @@ class CCRotoZoomTransition : public CCTransitionScene
public:
CCRotoZoomTransition();
virtual ~CCRotoZoomTransition();
virtual void onEnter();
};
/** CCJumpZoomTransition:
@ -113,6 +133,7 @@ class CCJumpZoomTransition : public CCTransitionScene
public:
CCJumpZoomTransition();
virtual ~CCJumpZoomTransition();
virtual void onEnter();
};
/** CCMoveInLTransition:
@ -126,7 +147,11 @@ public:
/** initializes the scenes */
virtual void initScenes(void);
/** returns the action that will be performed */
virtual CCIntervalAction* action(void);
CCIntervalAction* action(void);
virtual CCIntervalAction* easeActionWithAction(CCIntervalAction * action);
virtual void onEnter();
};
/** CCMoveInRTransition:
@ -137,6 +162,7 @@ class CCMoveInRTransition : public CCMoveInLTransition
public:
CCMoveInRTransition();
virtual ~CCMoveInRTransition();
virtual void initScenes();
};
/** CCMoveInTTransition:
@ -147,6 +173,7 @@ class CCMoveInTTransition : public CCMoveInLTransition
public:
CCMoveInTTransition();
virtual ~CCMoveInTTransition();
virtual void initScenes();
};
/** CCMoveInBTransition:
@ -157,6 +184,7 @@ class CCMoveInBTransition : public CCMoveInLTransition
public:
CCMoveInBTransition();
virtual ~CCMoveInBTransition();
virtual void initScenes();
};
/** CCSlideInLTransition:
@ -172,6 +200,10 @@ public:
virtual void initScenes(void);
/** returns the action that will be performed by the incomming and outgoing scene */
virtual CCIntervalAction* action(void);
virtual void onEnter();
virtual void sceneOrder();
virtual CCIntervalAction* easeActionWithAction(CCIntervalAction * action);
};
/** CCSlideInRTransition:
@ -182,6 +214,13 @@ class CCSlideInRTransition : public CCSlideInLTransition
public:
CCSlideInRTransition();
virtual ~CCSlideInRTransition();
/** initializes the scenes */
virtual void initScenes(void);
/** returns the action that will be performed by the incomming and outgoing scene */
virtual CCIntervalAction* action(void);
virtual void sceneOrder();
};
/** CCSlideInBTransition:
@ -192,6 +231,13 @@ class CCSlideInBTransition : public CCSlideInLTransition
public:
CCSlideInBTransition();
virtual ~CCSlideInBTransition();
/** initializes the scenes */
virtual void initScenes(void);
/** returns the action that will be performed by the incomming and outgoing scene */
virtual CCIntervalAction* action(void);
virtual void sceneOrder();
};
/** CCSlideInTTransition:
@ -202,6 +248,13 @@ class CCSlideInTTransition : public CCSlideInLTransition
public:
CCSlideInTTransition();
virtual ~CCSlideInTTransition();
/** initializes the scenes */
virtual void initScenes(void);
/** returns the action that will be performed by the incomming and outgoing scene */
virtual CCIntervalAction* action(void);
virtual void sceneOrder();
};
/**
@ -212,6 +265,9 @@ class CCShrinkGrowTransition : public CCTransitionScene , public CCTransitionEas
public:
CCShrinkGrowTransition();
virtual ~CCShrinkGrowTransition();
virtual void onEnter();
virtual CCIntervalAction* easeActionWithAction(CCIntervalAction * action);
};
/** CCFlipXTransition:
@ -223,6 +279,8 @@ class CCFlipXTransition : public CCOrientedTransitionScene
public:
CCFlipXTransition();
virtual ~CCFlipXTransition();
virtual void onEnter();
};
/** CCFlipYTransition:
@ -234,6 +292,8 @@ class CCFlipYTransition : public CCOrientedTransitionScene
public:
CCFlipYTransition();
virtual ~CCFlipYTransition();
virtual void onEnter();
};
/** CCFlipAngularTransition:
@ -245,6 +305,8 @@ class CCFlipAngularTransition : public CCOrientedTransitionScene
public:
CCFlipAngularTransition();
virtual ~CCFlipAngularTransition();
virtual void onEnter();
};
/** CCZoomFlipXTransition:
@ -256,6 +318,8 @@ class CCZoomFlipXTransition : public CCOrientedTransitionScene
public:
CCZoomFlipXTransition();
virtual ~CCZoomFlipXTransition();
virtual void onEnter();
};
/** CCZoomFlipYTransition:
@ -267,6 +331,8 @@ class CCZoomFlipYTransition : public CCOrientedTransitionScene
public:
CCZoomFlipYTransition();
virtual ~CCZoomFlipYTransition();
virtual void onEnter();
};
/** CCZoomFlipAngularTransition:
@ -278,6 +344,8 @@ class CCZoomFlipAngularTransition : public CCOrientedTransitionScene
public:
CCZoomFlipAngularTransition();
virtual ~CCZoomFlipAngularTransition();
virtual void onEnter();
};
/** CCFadeTransition:
@ -299,6 +367,10 @@ public:
static CCFadeTransition* transitionWithDurationAndColor(ccTime duration,CCScene* scene, ccColor3B color);
/** initializes the transition with a duration and with an RGB color */
CCFadeTransition* initWithDurationAndColor(ccTime duration, CCScene*scene ,ccColor3B color);
virtual CCFadeTransition * initWithDurationAndScene(ccTime t,CCScene* scene);
virtual void onEnter();
virtual void onExit();
};
/**
@ -311,6 +383,10 @@ class CCCrossFadeTransition : public CCTransitionScene
public :
CCCrossFadeTransition();
virtual ~CCCrossFadeTransition();
virtual void draw();
virtual void onEnter();
virtual void onExit();
};
/** CCTurnOffTilesTransition:
@ -321,6 +397,10 @@ class CCTurnOffTilesTransition : public CCTransitionScene ,public CCTransitionEa
public :
CCTurnOffTilesTransition();
virtual ~CCTurnOffTilesTransition();
virtual void sceneOrder();
virtual void onEnter();
CCIntervalAction * easeActionWithAction(CCIntervalAction * action);
};
/** CCSplitColsTransition:
@ -333,6 +413,8 @@ public:
virtual ~CCSplitColsTransition();
virtual CCIntervalAction* action(void);
virtual void onEnter();
virtual CCIntervalAction * easeActionWithAction(CCIntervalAction * action);
};
/** CCSplitRowsTransition:
@ -343,6 +425,8 @@ class CCSplitRowsTransition : public CCSplitColsTransition
public:
CCSplitRowsTransition();
virtual ~CCSplitRowsTransition();
virtual CCIntervalAction* action(void);
};
/** CCFadeTRTransition:
@ -354,6 +438,10 @@ public:
CCFadeTRTransition();
virtual ~CCFadeTRTransition();
virtual CCIntervalAction* actionWithSize(ccGridSize size);
virtual void sceneOrder();
virtual void onEnter();
virtual CCIntervalAction* easeActionWithAction(CCIntervalAction * action);
};
/** CCFadeBLTransition:
@ -364,6 +452,7 @@ class CCFadeBLTransition : public CCFadeTRTransition
public:
CCFadeBLTransition();
virtual ~CCFadeBLTransition();
virtual CCIntervalAction* actionWithSize(ccGridSize size);
};
/** CCFadeUpTransition:
@ -374,6 +463,7 @@ class CCFadeUpTransition : public CCFadeTRTransition
public:
CCFadeUpTransition();
virtual ~CCFadeUpTransition();
virtual CCIntervalAction* actionWithSize(ccGridSize size);
};
/** CCFadeDownTransition:
@ -384,6 +474,7 @@ class CCFadeDownTransition : public CCFadeTRTransition
public:
CCFadeDownTransition();
virtual ~CCFadeDownTransition();
virtual CCIntervalAction* actionWithSize(ccGridSize size);
};
#endif // __CCTRANSITION_H__

View File

@ -25,3 +25,353 @@ THE SOFTWARE.
#include "CCLayer.h"
using namespace std;
// CCLayer
CCLayer::CCLayer()
{
/// @todo
}
CCLayer::~CCLayer()
{
/// @todo
}
/// Touch and Accelerometer related
void CCLayer::registerWithTouchDispatcher()
{
/// @todo [[CCTouchDispatcher sharedDispatcher] addStandardDelegate:self priority:0];
}
/// isTouchEnabled getter
bool CCLayer::getIsTouchEnabled()
{
return m_bIsTouchEnabled;
}
/// isTouchEnabled setter
void CCLayer::setIsTouchEnabled(bool enabled)
{
/** @todo
if( isTouchEnabled != enabled ) {
isTouchEnabled = enabled;
if( isRunning_ ) {
if( enabled )
[self registerWithTouchDispatcher];
else
[[CCTouchDispatcher sharedDispatcher] removeDelegate:self];
}
}*/
}
/// isAccelerometerEnabled getter
bool CCLayer::getIsAccelerometerEnabled()
{
return m_bIsAccelerometerEnabled;
}
/// isAccelerometerEnabled setter
void CCLayer::setIsAccelerometerEnabled(bool enabled)
{
/** @todo
if( enabled != isAccelerometerEnabled ) {
isAccelerometerEnabled = enabled;
if( isRunning_ ) {
if( enabled )
[[UIAccelerometer sharedAccelerometer] setDelegate:self];
else
[[UIAccelerometer sharedAccelerometer] setDelegate:nil];
}
}*/
}
/// Callbacks
void CCLayer::onEnter()
{
/** @todo
// register 'parent' nodes first
// since events are propagated in reverse order
if (isTouchEnabled)
[self registerWithTouchDispatcher];
// then iterate over all the children
[super onEnter];
if( isAccelerometerEnabled )
[[UIAccelerometer sharedAccelerometer] setDelegate:self];*/
}
void CCLayer::onExit()
{
/**
if( isTouchEnabled )
[[CCTouchDispatcher sharedDispatcher] removeDelegate:self];
if( isAccelerometerEnabled )
[[UIAccelerometer sharedAccelerometer] setDelegate:nil];
[super onExit];*/
}
/** @todo
-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
NSAssert(NO, @"Layer#ccTouchBegan override me");
return YES;
}*/
/// ColorLayer
CCColorLayer::CCColorLayer()
{
/// @todo
}
CCColorLayer::~CCColorLayer()
{
/// @todo
}
// Opacity and RGB color protocol
/// opacity getter
GLubyte CCColorLayer::getOpacity()
{
return m_cOpacity;
}
/// opacity setter
void CCColorLayer::setOpacity(GLubyte var)
{
m_cOpacity = var;
updateColor();
}
/// color getter
ccColor3B CCColorLayer::getColor()
{
return m_tColor;
}
/// color setter
void CCColorLayer::setColor(ccColor3B var)
{
m_tColor = var;
updateColor();
}
/// blendFunc getter
ccBlendFunc CCColorLayer::getBlendFunc()
{
return m_tBlendFunc;
}
/// blendFunc setter
void CCColorLayer::setBlendFunc(ccBlendFunc var)
{
m_tBlendFunc = var;
}
CCColorLayer * CCColorLayer::layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height)
{
/// @todo return [[[self alloc] initWithColor:color width:w height:h] autorelease];
CCColorLayer * pLayer = new CCColorLayer();
pLayer->initWithColorWidthHeight(color,width,height);
pLayer->autorelease();
return pLayer;
}
CCColorLayer * CCColorLayer::layerWithColor(ccColor4B color)
{
/// @todo return [[[self alloc] initWithColor:color] autorelease];
CCColorLayer * pLayer = new CCColorLayer();
pLayer->initWithColor(color);
pLayer->autorelease();
return pLayer;
}
CCColorLayer* CCColorLayer::initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height)
{
/** @todo
if( (self=[super init]) ) {
// default blend function
blendFunc_ = (ccBlendFunc) { CC_BLEND_SRC, CC_BLEND_DST };
color_.r = color.r;
color_.g = color.g;
color_.b = color.b;
opacity_ = color.a;
for (NSUInteger i=0; i<sizeof(squareVertices) / sizeof( squareVertices[0]); i++ )
squareVertices[i] = 0.0f;
[self updateColor];
[self setContentSize:CGSizeMake(w,h)];
}
return self;*/
return NULL;
}
CCColorLayer * CCColorLayer::initWithColor(ccColor4B color)
{
/** @todo
CGSize s = [[CCDirector sharedDirector] winSize];
return [self initWithColor:color width:s.width height:s.height];*/
return NULL;
}
/// override contentSize
void CCColorLayer::setContentSize(CGSize size)
{
/** @todo
squareVertices[2] = size.width;
squareVertices[5] = size.height;
squareVertices[6] = size.width;
squareVertices[7] = size.height;
[super setContentSize:size];*/
}
void CCColorLayer::changeWidthAndHeight(GLfloat w ,GLfloat h)
{
/// @todo [self setContentSize:CGSizeMake(w,h)];
}
void CCColorLayer::changeWidth(GLfloat w)
{
/// @todo [self setContentSize:CGSizeMake(w,contentSize_.height)];
}
void CCColorLayer::changeHeight(GLfloat h)
{
/// @todo [self setContentSize:CGSizeMake(contentSize_.width,h)];
}
void CCColorLayer::updateColor()
{
/** @todo
for( NSUInteger i=0; i < sizeof(squareColors) / sizeof(squareColors[0]);i++ )
{
if( i % 4 == 0 )
squareColors[i] = color_.r;
else if( i % 4 == 1)
squareColors[i] = color_.g;
else if( i % 4 ==2 )
squareColors[i] = color_.b;
else
squareColors[i] = opacity_;
}*/
}
void CCColorLayer::draw()
{
/** @todo
// Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
// Needed states: GL_VERTEX_ARRAY, GL_COLOR_ARRAY
// Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisable(GL_TEXTURE_2D);
glVertexPointer(2, GL_FLOAT, 0, squareVertices);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors);
BOOL newBlend = NO;
if( blendFunc_.src != CC_BLEND_SRC || blendFunc_.dst != CC_BLEND_DST ) {
newBlend = YES;
glBlendFunc(blendFunc_.src, blendFunc_.dst);
}
else if( opacity_ != 255 ) {
newBlend = YES;
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
if( newBlend )
glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST);
// restore default GL state
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_2D);*/
}
/// MultiplexLayer
CCMultiplexLayer::CCMultiplexLayer()
{
/// @todo
}
CCMultiplexLayer::~CCMultiplexLayer()
{
/// @todo
}
CCMultiplexLayer * CCMultiplexLayer::layerWithLayers(CCLayer * layer, ...)
{
/** @todo va_list args;
va_start(args,layer);
id s = [[[self alloc] initWithLayers: layer vaList:args] autorelease];
va_end(args);
return s;*/
return NULL;
}
CCMultiplexLayer * CCMultiplexLayer::initWithLayers(CCLayer *layer, va_list params)
{
/** @todo
if( (self=[super init]) ) {
layers = [[NSMutableArray arrayWithCapacity:5] retain];
[layers addObject: layer];
CCLayer *l = va_arg(params,CCLayer*);
while( l ) {
[layers addObject: l];
l = va_arg(params,CCLayer*);
}
enabledLayer = 0;
[self addChild: [layers objectAtIndex: enabledLayer]];
}
return self;*/
return NULL;
}
/** @todo
-(void) dealloc
{
[layers release];
[super dealloc];
}*/
void CCMultiplexLayer::switchTo(unsigned int n)
{
/** @todo
NSAssert( n < [layers count], @"Invalid index in MultiplexLayer switchTo message" );
[self removeChild: [layers objectAtIndex:enabledLayer] cleanup:YES];
enabledLayer = n;
[self addChild: [layers objectAtIndex:n]]; */
}
void CCMultiplexLayer::switchToAndReleaseMe(unsigned int n)
{
/** @todo
NSAssert( n < [layers count], @"Invalid index in MultiplexLayer switchTo message" );
[self removeChild: [layers objectAtIndex:enabledLayer] cleanup:YES];
[layers replaceObjectAtIndex:enabledLayer withObject:[NSNull null]];
enabledLayer = n;
[self addChild: [layers objectAtIndex:n]]; */
}

View File

@ -25,3 +25,13 @@ THE SOFTWARE.
#include "CCScene.h"
using namespace std;
CCScene::CCScene()
{
/// @todo
}
CCScene::~CCScene()
{
/// @todo
}

File diff suppressed because it is too large Load Diff