issue #5, modify some bugs in all my .h files

This commit is contained in:
Walzer 2010-07-09 10:24:08 +00:00
parent d70eb65227
commit 8672eea9da
10 changed files with 815 additions and 87 deletions

View File

@ -56,6 +56,11 @@ CCNode::CCNode(void)
{
// nothing
}
/// @todo
CCNode::~CCNode()
{
}
float CCNode::getRotation()
{
@ -86,12 +91,12 @@ bool CCNode::getVisibility()
{
return m_bIsVisible;
}
//
/// @todo
//CCGridBase* CCNode::getGrid()
//{
// return m_pGrid;
//}
//
/// @todo
//void CCNode::setGrid(CCGridBase* pGrid)
//{
// if(/*!pGrid &&*/ m_pGrid)
@ -154,7 +159,7 @@ bool CCNode::getIsRelativeAnchorPoint()
{
return m_bIsRelativeAnchorPoint;
}
/// @todo
void CCNode::setAnchorPoint(CGPoint point)
{
/*if( ! CGPointEqualToPoint(point, m_anchorPoint) )
@ -172,7 +177,7 @@ CGPoint CCNode::getAnchorPoint()
{
return m_tAnchorPoint;
}
/// @todo
void CCNode::setContentSize(CGSize size)
{
//if( ! CGSizeEqualToSize(size, m_contentSize) )
@ -190,13 +195,13 @@ 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");
@ -212,7 +217,7 @@ void CCNode::setScale(float scale)
#endif
}
//
/// @todo
//UxMutableArray* CCNode::children()
//{
// return m_pChildrenArray;
@ -263,3 +268,634 @@ bool CCNode::getIsRunning()
return m_bIsRunning;
}
/** @todo
#if CC_COCOSNODE_RENDER_SUBPIXEL
#define RENDER_IN_SUBPIXEL
#else
#define RENDER_IN_SUBPIXEL (int)
#endif
*/
/** @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;
}
void CCNode::cleanup()
{
/** @todo
// actions
[self stopAllActions];
[self unscheduleAllSelectors];
// timers
[children_ makeObjectsPerformSelector:@selector(cleanup)];*/
}
/** @todo no declare in class
- (NSString*) description
{
return [NSString stringWithFormat:@"<%@ = %08X | Tag = %i>", [self class], self, tag_];
}
*/
/** @todo no declare in class
- (void) dealloc
{
CCLOGINFO( @"cocos2d: deallocing %@", self);
// attributes
[camera_ release];
[grid_ release];
// children
for (CCNode *child in children_) {
child.parent = nil;
}
[children_ release];
[super dealloc];
}
*/
// lazy allocs
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
NSAssert( aTag != kCCNodeTagInvalid, @"Invalid tag");
for( CCNode *node in children_ ) {
if( node.tag == aTag )
return node;
}
// not found
return nil;*/
return NULL;
}
/* "add" logic MUST only be on this method
* If a class want's to extend the 'addChild' behaviour it only needs
* to override this method
*/
CCNode * CCNode::addChild(CCNode *node, int zOrder, int tag)
{
/** @todo
NSAssert( child != nil, @"Argument must be non-nil");
NSAssert( child.parent == nil, @"child already added. It can't be added again");
if( ! children_ )
[self childrenAlloc];
[self insertChild:child z:z];
child.tag = aTag;
[child setParent: self];
if( isRunning_ )
[child onEnter];
return self;*/
return NULL;
}
CCNode * CCNode::addChild(CCNode *node, int zOrder)
{
/** @todo
NSAssert( child != nil, @"Argument must be non-nil");
return [self addChild:child z:z tag:child.tag];*/
return NULL;
}
CCNode * CCNode::addChild(CCNode *node)
{
/** @todo
NSAssert( child != nil, @"Argument must be non-nil");
return [self addChild:child z:child.zOrder tag:child.tag];*/
return NULL;
}
void CCNode::removeFromParentAndCleanup(bool cleanup)
{
/** @todo
[self.parent removeChild:self cleanup:cleanup];*/
}
/* "remove" logic MUST only be on this method
* If a class want's to extend the 'removeChild' behavior it only needs
* to override this method
*/
void CCNode::removeChild(CCNode* node, bool cleanup)
{
/** @todo
// explicit nil handling
if (child == nil)
return;
if ( [children_ containsObject:child] )
[self detachChild:child cleanup:cleanup];*/
}
void CCNode::removeChildByTag(int tag, bool cleanup)
{
/** @todo
NSAssert( aTag != kCCNodeTagInvalid, @"Invalid tag");
CCNode *child = [self getChildByTag:aTag];
if (child == nil)
CCLOG(@"cocos2d: removeChildByTag: child not found!");
else
[self removeChild:child cleanup:cleanup];*/
}
void CCNode::removeAllChildrenWithCleanup(bool cleanup)
{
/** @todo
// not using detachChild improves speed here
for (CCNode *c in children_)
{
// IMPORTANT:
// -1st do onExit
// -2nd cleanup
if (isRunning_)
[c onExit];
if (cleanup)
[c cleanup];
// set parent nil at the end (issue #476)
[c setParent:nil];
}
[children_ removeAllObjects];*/
}
void CCNode::detachChild(CCNode *child, bool doCleanup)
{
/** @todo
// IMPORTANT:
// -1st do onExit
// -2nd cleanup
if (isRunning_)
[child onExit];
// If you don't do cleanup, the child's actions will not get removed and the
// its scheduledSelectors_ dict will not get released!
if (doCleanup)
[child cleanup];
// set parent nil at the end (issue #476)
[child setParent:nil];
[children_ removeObject:child];*/
}
// used internally to alter the zOrder variable. DON'T call this method manually
void CCNode::setZOrder(int z)
{
m_iZOrder = z;
}
// helper used by reorderChild & add
void CCNode::insertChild(CCNode* child, int z)
{
/** @todo
int index=0;
BOOL added = NO;
for( CCNode *a in children_ ) {
if ( a.zOrder > z ) {
added = YES;
[ children_ insertObject:child atIndex:index];
break;
}
index++;
}
if( ! added )
[children_ addObject:child];
[child _setZOrder:z];*/
}
void CCNode::reorderChild(CCNode *child, int zOrder)
{
/** @todo
NSAssert( child != nil, @"Child must be non-nil");
[child retain];
[children_ removeObject:child];
[self insertChild:child z:z];
[child release];*/
}
void CCNode::draw()
{
// override me
// Only use this function to draw your staff.
// DON'T draw your stuff outside this method
}
void CCNode::visit()
{
/** @todo
if (!visible_)
return;
glPushMatrix();
if ( grid_ && grid_.active) {
[grid_ beforeDraw];
[self transformAncestors];
}
[self transform];
ccArray *arrayData;
int i = 0, nu;
if(children_){
arrayData = children_->data;
nu = arrayData->num;
for(;i<nu; i++){
CCNode *child = arrayData->arr[i];
if ( child.zOrder < 0 )
[child visit];
else
break;
}
}
[self draw];
if(children_)
for (;i<nu; i++)
[arrayData->arr[i] visit];
if ( grid_ && grid_.active)
[grid_ afterDraw:self];
glPopMatrix();*/
}
void CCNode::transformAncestors()
{
if( m_pParent != NULL )
{
m_pParent->transformAncestors();
m_pParent->transform();
}
}
void CCNode::transform()
{
/** @todo
// transformations
#if CC_NODE_TRANSFORM_USING_AFFINE_MATRIX
// BEGIN alternative -- using cached transform
//
if( isTransformGLDirty_ ) {
CGAffineTransform t = [self nodeToParentTransform];
CGAffineToGL(&t, transformGL_);
isTransformGLDirty_ = NO;
}
glMultMatrixf(transformGL_);
if( vertexZ_ )
glTranslatef(0, 0, vertexZ_);
// XXX: Expensive calls. Camera should be integrated into the cached affine matrix
if ( camera_ && !(grid_ && grid_.active) ) {
BOOL translate = (anchorPointInPixels_.x != 0.0f || anchorPointInPixels_.y != 0.0f);
if( translate )
glTranslatef(RENDER_IN_SUBPIXEL(anchorPointInPixels_.x), RENDER_IN_SUBPIXEL(anchorPointInPixels_.y), 0);
[camera_ locate];
if( translate )
glTranslatef(RENDER_IN_SUBPIXEL(-anchorPointInPixels_.x), RENDER_IN_SUBPIXEL(-anchorPointInPixels_.y), 0);
}
// END alternative
#else
// BEGIN original implementation
//
// translate
if ( isRelativeAnchorPoint_ && (anchorPointInPixels_.x != 0 || anchorPointInPixels_.y != 0 ) )
glTranslatef( RENDER_IN_SUBPIXEL(-anchorPointInPixels_.x), RENDER_IN_SUBPIXEL(-anchorPointInPixels_.y), 0);
if (anchorPointInPixels_.x != 0 || anchorPointInPixels_.y != 0)
glTranslatef( RENDER_IN_SUBPIXEL(position_.x + anchorPointInPixels_.x), RENDER_IN_SUBPIXEL(position_.y + anchorPointInPixels_.y), vertexZ_);
else if ( position_.x !=0 || position_.y !=0 || vertexZ_ != 0)
glTranslatef( RENDER_IN_SUBPIXEL(position_.x), RENDER_IN_SUBPIXEL(position_.y), vertexZ_ );
// rotate
if (rotation_ != 0.0f )
glRotatef( -rotation_, 0.0f, 0.0f, 1.0f );
// scale
if (scaleX_ != 1.0f || scaleY_ != 1.0f)
glScalef( scaleX_, scaleY_, 1.0f );
if ( camera_ && !(grid_ && grid_.active) )
[camera_ locate];
// restore and re-position point
if (anchorPointInPixels_.x != 0.0f || anchorPointInPixels_.y != 0.0f)
glTranslatef(RENDER_IN_SUBPIXEL(-anchorPointInPixels_.x), RENDER_IN_SUBPIXEL(-anchorPointInPixels_.y), 0);
//
// END original implementation
#endif
*/
}
void CCNode::onEnter()
{
/** @todo callback?
[children_ makeObjectsPerformSelector:@selector(onEnter)];
[self resumeSchedulerAndActions];
isRunning_ = YES;*/
}
void CCNode::onEnterTransitionDidFinish()
{
/** @todo callback?
[children_ makeObjectsPerformSelector:@selector(onEnterTransitionDidFinish)];*/
}
void CCNode::onExit()
{
/** @todo callback?
[self pauseSchedulerAndActions];
isRunning_ = NO;
[children_ makeObjectsPerformSelector:@selector(onExit)];*/
}
/** @todo
-(CCAction*) runAction:(CCAction*) action
{
NSAssert( action != nil, @"Argument must be non-nil");
[[CCActionManager sharedManager] addAction:action target:self paused:!isRunning_];
return action;
}
*/
void CCNode::stopAllActions()
{
/** @todo
[[CCActionManager sharedManager] removeAllActionsFromTarget:self];*/
}
/** @todo
-(void) stopAction: (CCAction*) action
{
[[CCActionManager sharedManager] removeAction:action];
}*/
void CCNode::stopActionByTag(int tag)
{
/** @todo
NSAssert( aTag != kCCActionTagInvalid, @"Invalid tag");
[[CCActionManager sharedManager] removeActionByTag:aTag target:self];*/
}
/** @todo
-(CCAction*) getActionByTag:(int) aTag
{
NSAssert( aTag != kCCActionTagInvalid, @"Invalid tag");
return [[CCActionManager sharedManager] getActionByTag:aTag target:self];
}*/
int CCNode::numberOfRunningActions()
{
/// @todo return [[CCActionManager sharedManager] numberOfRunningActionsInTarget:self];
return 0;
}
/// @todo #pragma mark CCNode - Callbacks????
void CCNode::scheduleUpdate()
{
scheduleUpdateWithPriority(0);
}
void CCNode::scheduleUpdateWithPriority(int priority)
{
/// @todo [[CCScheduler sharedScheduler] scheduleUpdateForTarget:self priority:priority paused:!isRunning_];
}
void CCNode::unscheduleUpdate()
{
/// @todo [[CCScheduler sharedScheduler] unscheduleUpdateForTarget:self];
}
/** @todo
-(void) schedule:(SEL)selector
{
[self schedule:selector interval:0];
}*/
/** @todo
-(void) schedule:(SEL)selector interval:(ccTime)interval
{
NSAssert( selector != nil, @"Argument must be non-nil");
NSAssert( interval >=0, @"Arguemnt must be positive");
[[CCScheduler sharedScheduler] scheduleSelector:selector forTarget:self interval:interval paused:!isRunning_];
}*/
/** @todo
-(void) unschedule:(SEL)selector
{
// explicit nil handling
if (selector == nil)
return;
[[CCScheduler sharedScheduler] unscheduleSelector:selector forTarget:self];
}*/
void CCNode::unscheduleAllSelectors()
{
/// @todo [[CCScheduler sharedScheduler] unscheduleAllSelectorsForTarget:self];
}
void CCNode::resumeSchedulerAndActions()
{
/** @todo
[[CCScheduler sharedScheduler] resumeTarget:self];
[[CCActionManager sharedManager] resumeTarget:self];*/
}
void CCNode::pauseSchedulerAndActions()
{
/** @todo
[[CCScheduler sharedScheduler] pauseTarget:self];
[[CCActionManager sharedManager] pauseTarget:self];*/
}
/** @todo
- (CGAffineTransform)nodeToParentTransform
{
if ( isTransformDirty_ ) {
transform_ = CGAffineTransformIdentity;
if ( !isRelativeAnchorPoint_ && !CGPointEqualToPoint(anchorPointInPixels_, CGPointZero) )
transform_ = CGAffineTransformTranslate(transform_, anchorPointInPixels_.x, anchorPointInPixels_.y);
if( ! CGPointEqualToPoint(position_, CGPointZero) )
transform_ = CGAffineTransformTranslate(transform_, position_.x, position_.y);
if( rotation_ != 0 )
transform_ = CGAffineTransformRotate(transform_, -CC_DEGREES_TO_RADIANS(rotation_));
if( ! (scaleX_ == 1 && scaleY_ == 1) )
transform_ = CGAffineTransformScale(transform_, scaleX_, scaleY_);
if( ! CGPointEqualToPoint(anchorPointInPixels_, CGPointZero) )
transform_ = CGAffineTransformTranslate(transform_, -anchorPointInPixels_.x, -anchorPointInPixels_.y);
isTransformDirty_ = NO;
}
return transform_;
}
- (CGAffineTransform)parentToNodeTransform
{
if ( isInverseDirty_ ) {
inverse_ = CGAffineTransformInvert([self nodeToParentTransform]);
isInverseDirty_ = NO;
}
return inverse_;
}
- (CGAffineTransform)nodeToWorldTransform
{
CGAffineTransform t = [self nodeToParentTransform];
for (CCNode *p = parent_; p != nil; p = p.parent)
t = CGAffineTransformConcat(t, [p nodeToParentTransform]);
return t;
}
- (CGAffineTransform)worldToNodeTransform
{
return CGAffineTransformInvert([self nodeToWorldTransform]);
}
- (CGPoint)convertToNodeSpace:(CGPoint)worldPoint
{
return CGPointApplyAffineTransform(worldPoint, [self worldToNodeTransform]);
}
- (CGPoint)convertToWorldSpace:(CGPoint)nodePoint
{
return CGPointApplyAffineTransform(nodePoint, [self nodeToWorldTransform]);
}
- (CGPoint)convertToNodeSpaceAR:(CGPoint)worldPoint
{
CGPoint nodePoint = [self convertToNodeSpace:worldPoint];
return ccpSub(nodePoint, anchorPointInPixels_);
}
- (CGPoint)convertToWorldSpaceAR:(CGPoint)nodePoint
{
nodePoint = ccpAdd(nodePoint, anchorPointInPixels_);
return [self convertToWorldSpace:nodePoint];
}
- (CGPoint)convertToWindowSpace:(CGPoint)nodePoint
{
CGPoint worldPoint = [self convertToWorldSpace:nodePoint];
return [[CCDirector sharedDirector] convertToUI:worldPoint];
}
// convenience methods which take a UITouch instead of CGPoint
- (CGPoint)convertTouchToNodeSpace:(UITouch *)touch
{
CGPoint point = [touch locationInView: [touch view]];
point = [[CCDirector sharedDirector] convertToGL: point];
return [self convertToNodeSpace:point];
}
- (CGPoint)convertTouchToNodeSpaceAR:(UITouch *)touch
{
CGPoint point = [touch locationInView: [touch view]];
point = [[CCDirector sharedDirector] convertToGL: point];
return [self convertToNodeSpaceAR:point];
}
*/

View File

@ -85,10 +85,10 @@ public:
virtual ~CCAtlasNode();
/** creates a CCAtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
static void* atlasWithTileFile(NSString* tile, int tileWidth, int tileHeight, int itemsToRender);
static CCAtlasNode* atlasWithTileFile(NSString* tile, int tileWidth, int tileHeight, int itemsToRender);
/** initializes an CCAtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
void* initWithTileFile(NSString* tile, int tileWidth, int tileHeight, int itemsToRender;
CCAtlasNode* initWithTileFile(NSString* tile, int tileWidth, int tileHeight, int itemsToRender;
/** updates the Atlas (indexed vertex array).
* Shall be overriden in subclasses

View File

@ -43,6 +43,8 @@ All features from CCNode are valid, plus the following new features:
class CCLayer : public CCNode//, public UIAccelerometerDelegate, public CCStandardTouchDelegate, public CCTargetedTouchDelegate
{
public:
CCLayer();
virtual ~CCLayer();
/** If isTouchEnabled, this method is called onEnter. Override it to change the
way CCLayer receives touch events.
( Default: [[TouchDispatcher sharedDispatcher] addStandardDelegate:self priority:0] )
@ -60,7 +62,7 @@ public:
Only the touches of this node will be affected. This "method" is not propagated to it's children.
@since v0.8.1
*/
CCX_SYNTHESIZE(bool, m_bIsTouchEnabled, IsTouchEnabled)
CCX_PROPERTY(bool, m_bIsTouchEnabled, IsTouchEnabled)
/** whether or not it will receive Accelerometer events
You can enable / disable accelerometer events with this property.
@since v0.8.1
@ -85,15 +87,19 @@ protected:
GLubyte m_cSquareColors[4 * 4];
public:
CCColorLayer();
virtual ~CCColorLayer();
/** creates a CCLayer with color, width and height */
static void* layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
static CCColorLayer * layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
/** creates a CCLayer with color. Width and height are the window size. */
static void* layerWithColor(ccColor4B color);
static CCColorLayer * layerWithColor(ccColor4B color);
/** initializes a CCLayer with color, width and height */
void* initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
CCColorLayer * initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
/** initializes a CCLayer with color. Width and height are the window size. */
void* initWithColor(ccColor4B color);
CCColorLayer * initWithColor(ccColor4B color);
/** change width */
void changeWidth(GLfloat w);
@ -120,13 +126,17 @@ Features:
class CCMultiplexLayer : public CCLayer
{
protected:
unsigned int enabledLayer;
NSMutableArray *layers;
unsigned int m_iEnabledLayer;
NSMutableArray * m_tLayers;
public:
CCMultiplexLayer();
virtual ~CCMultiplexLayer();
/** creates a CCMultiplexLayer with one or more layers using a variable argument list. */
static void* layerWithLayers(CCLayer* layer, ... );
static CCMultiplexLayer * layerWithLayers(CCLayer* layer, ... );
/** initializes a MultiplexLayer with one or more layers using a variable argument list. */
void* initWithLayers(CCLayer* layer, va_list params);
CCMultiplexLayer * initWithLayers(CCLayer* layer, va_list params);
/** switches to a certain layer indexed by n.
The current (old) layer will be removed from it's parent with 'cleanup:YES'.
*/
@ -137,4 +147,5 @@ public:
void switchToAndReleaseMe(unsigned int n);
};
#endif // __CCLAYER_H__
#endif // __CCLAYER_H__

View File

@ -212,7 +212,26 @@ public:
/** allocates and initializes a node.
The node will be created as "autorelease".
*/
static void* node(void);
static CCNode * node(void);
/// @todo callback?
//scene managment
/** callback that is called every time the CCNode enters the 'stage'.
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();
/** 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
*/
void onEnterTransitionDidFinish();
/** callback that is called every time the CCNode leaves the 'stage'.
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();
// composition: ADD
@ -220,19 +239,19 @@ public:
It returns self, so you can chain several addChilds.
@since v0.7.1
*/
void * addChild(CCNode* node);
CCNode * addChild(CCNode * node);
/** Adds a child to the container with a z-order
It returns self, so you can chain several addChilds.
@since v0.7.1
*/
void * addChild(CCNode* node, int zOrder);
CCNode * addChild(CCNode * node, int zOrder);
/** Adds a child to the container with z order and tag
It returns self, so you can chain several addChilds.
@since v0.7.1
*/
void * addChild(CCNode* node, int zOrder, int tag);
CCNode * addChild(CCNode * node, int zOrder, int tag);
// composition: REMOVE
@ -262,7 +281,7 @@ public:
@return returns a CCNode object
@since v0.7.1
*/
CCNode* getChildByTag(int tag);
CCNode * getChildByTag(int tag);
/** Reorders a child according to a new z value.
* The child MUST be already added.
@ -459,4 +478,4 @@ public:
#endif // __CCNODE_H__

View File

@ -44,21 +44,25 @@ protected:
bool m_bBack;
public:
/**
* creates a base transition with duration and incoming scene
* if back is TRUE then the effect is reversed to appear as if the incoming
* scene is being turned from left over the outgoing scene
*/
static void* transitionWithDurationAndScene(ccTime t,CCScene* scene,bool backwards);
CCPageTurnTransition();
virtual ~CCPageTurnTransition();
/**
* creates a base transition with duration and incoming scene
* if back is TRUE then the effect is reversed to appear as if the incoming
* scene is being turned from left over the outgoing scene
*/
void* initWithDuration(ccTime t,CCScene* scene,bool backwards);
static CCPageTurnTransition* transitionWithDurationAndScene(ccTime t,CCScene* scene,bool backwards);
/**
* creates a base transition with duration and incoming scene
* if back is TRUE then the effect is reversed to appear as if the incoming
* scene is being turned from left over the outgoing scene
*/
CCPageTurnTransition* initWithDuration(ccTime t,CCScene* scene,bool backwards);
CCIntervalAction* actionWithSize(ccGridSize vector);
};
#endif // __CCPAGE_TURN_TRANSITION_H__
#endif // __CCPAGE_TURN_TRANSITION_H__

View File

@ -36,7 +36,9 @@ THE SOFTWARE.
///
class CCRadialCCWTransition : public CCTransitionScene
{
public:
CCRadialCCWTransition();
virtual ~CCRadialCCWTransition();
};
///
@ -44,8 +46,11 @@ class CCRadialCCWTransition : public CCTransitionScene
///
class CCRadialCWTransition : public CCRadialCCWTransition
{
public:
CCRadialCWTransition();
virtual ~CCRadialCWTransition();
};
#endif __CCRADIAL_TRANSITION_H__
#endif __CCRADIAL_TRANSITION_H__

View File

@ -46,4 +46,5 @@ public:
};
#endif // __CCSCENE_H__
#endif // __CCSCENE_H__

View File

@ -68,10 +68,10 @@ protected:
public:
/** creates a base transition with duration and incoming scene */
static void* transitionWithDurationAndScene(ccTime t, CCScene *scene);
static CCTransitionScene * transitionWithDurationAndScene(ccTime t, CCScene *scene);
/** initializes a transition with duration and incoming scene */
virtual void* initWithDurationAndScene(ccTime t,CCScene* scene);
virtual CCTransitionScene * initWithDurationAndScene(ccTime t,CCScene* scene);
/** called after the transition finishes */
void finish(void);
@ -90,9 +90,9 @@ protected:
public:
/** creates a base transition with duration and incoming scene */
virtual void* transitionWithDurationAndScene(ccTime t,CCScene* scene, tOrientation orientation);
virtual CCOrientedTransitionScene * transitionWithDurationAndScene(ccTime t,CCScene* scene, tOrientation orientation);
/** initializes a transition with duration and incoming scene */
virtual void* initWithDurationAndScene(ccTime t,CCScene* scene,tOrientation orientation);
virtual CCOrientedTransitionScene * initWithDurationAndScene(ccTime t,CCScene* scene,tOrientation orientation);
};
/** CCRotoZoomTransition:
@ -100,7 +100,9 @@ Rotate and zoom out the outgoing scene, and then rotate and zoom in the incoming
*/
class CCRotoZoomTransition : public CCTransitionScene
{
public:
CCRotoZoomTransition();
virtual ~CCRotoZoomTransition();
};
/** CCJumpZoomTransition:
@ -108,7 +110,9 @@ Zoom out and jump the outgoing scene, and then jump and zoom in the incoming
*/
class CCJumpZoomTransition : public CCTransitionScene
{
public:
CCJumpZoomTransition();
virtual ~CCJumpZoomTransition();
};
/** CCMoveInLTransition:
@ -117,6 +121,8 @@ Move in from to the left the incoming scene.
class CCMoveInLTransition : public CCTransitionScene, public CCTransitionEaseScene
{
public:
CCMoveInLTransition();
virtual ~CCMoveInLTransition();
/** initializes the scenes */
virtual void initScenes(void);
/** returns the action that will be performed */
@ -128,7 +134,9 @@ Move in from to the right the incoming scene.
*/
class CCMoveInRTransition : public CCMoveInLTransition
{
public:
CCMoveInRTransition();
virtual ~CCMoveInRTransition();
};
/** CCMoveInTTransition:
@ -136,7 +144,9 @@ Move in from to the top the incoming scene.
*/
class CCMoveInTTransition : public CCMoveInLTransition
{
public:
CCMoveInTTransition();
virtual ~CCMoveInTTransition();
};
/** CCMoveInBTransition:
@ -144,7 +154,9 @@ Move in from to the bottom the incoming scene.
*/
class CCMoveInBTransition : public CCMoveInLTransition
{
public:
CCMoveInBTransition();
virtual ~CCMoveInBTransition();
};
/** CCSlideInLTransition:
@ -153,6 +165,9 @@ Slide in the incoming scene from the left border.
class CCSlideInLTransition : public CCTransitionScene, public CCTransitionEaseScene
{
public:
CCSlideInLTransition();
virtual ~CCSlideInLTransition();
/** initializes the scenes */
virtual void initScenes(void);
/** returns the action that will be performed by the incomming and outgoing scene */
@ -164,7 +179,9 @@ Slide in the incoming scene from the right border.
*/
class CCSlideInRTransition : public CCSlideInLTransition
{
public:
CCSlideInRTransition();
virtual ~CCSlideInRTransition();
};
/** CCSlideInBTransition:
@ -172,7 +189,9 @@ Slide in the incoming scene from the bottom border.
*/
class CCSlideInBTransition : public CCSlideInLTransition
{
public:
CCSlideInBTransition();
virtual ~CCSlideInBTransition();
};
/** CCSlideInTTransition:
@ -180,7 +199,9 @@ Slide in the incoming scene from the top border.
*/
class CCSlideInTTransition : public CCSlideInLTransition
{
public:
CCSlideInTTransition();
virtual ~CCSlideInTTransition();
};
/**
@ -188,7 +209,9 @@ Shrink the outgoing scene while grow the incoming scene
*/
class CCShrinkGrowTransition : public CCTransitionScene , public CCTransitionEaseScene
{
public:
CCShrinkGrowTransition();
virtual ~CCShrinkGrowTransition();
};
/** CCFlipXTransition:
@ -197,7 +220,9 @@ The front face is the outgoing scene and the back face is the incoming scene.
*/
class CCFlipXTransition : public CCOrientedTransitionScene
{
public:
CCFlipXTransition();
virtual ~CCFlipXTransition();
};
/** CCFlipYTransition:
@ -206,7 +231,9 @@ The front face is the outgoing scene and the back face is the incoming scene.
*/
class CCFlipYTransition : public CCOrientedTransitionScene
{
public:
CCFlipYTransition();
virtual ~CCFlipYTransition();
};
/** CCFlipAngularTransition:
@ -215,7 +242,9 @@ The front face is the outgoing scene and the back face is the incoming scene.
*/
class CCFlipAngularTransition : public CCOrientedTransitionScene
{
public:
CCFlipAngularTransition();
virtual ~CCFlipAngularTransition();
};
/** CCZoomFlipXTransition:
@ -224,7 +253,9 @@ The front face is the outgoing scene and the back face is the incoming scene.
*/
class CCZoomFlipXTransition : public CCOrientedTransitionScene
{
public:
CCZoomFlipXTransition();
virtual ~CCZoomFlipXTransition();
};
/** CCZoomFlipYTransition:
@ -233,7 +264,9 @@ The front face is the outgoing scene and the back face is the incoming scene.
*/
class CCZoomFlipYTransition : public CCOrientedTransitionScene
{
public:
CCZoomFlipYTransition();
virtual ~CCZoomFlipYTransition();
};
/** CCZoomFlipAngularTransition:
@ -242,7 +275,9 @@ The front face is the outgoing scene and the back face is the incoming scene.
*/
class CCZoomFlipAngularTransition : public CCOrientedTransitionScene
{
public:
CCZoomFlipAngularTransition();
virtual ~CCZoomFlipAngularTransition();
};
/** CCFadeTransition:
@ -254,12 +289,16 @@ protected:
ccColor4B color;
public:
CCFadeTransition();
virtual ~CCFadeTransition();
/** creates the transition with a duration and with an RGB color
* Example: [FadeTransition transitionWithDuration:2 scene:s withColor:ccc3(255,0,0)]; // red color
*/
static void* transitionWithDurationAndColor(ccTime duration,CCScene* scene, ccColor3B color);
static CCFadeTransition* transitionWithDurationAndColor(ccTime duration,CCScene* scene, ccColor3B color);
/** initializes the transition with a duration and with an RGB color */
void* initWithDurationAndColor(ccTime duration, CCScene*scene ,ccColor3B color);
CCFadeTransition* initWithDurationAndColor(ccTime duration, CCScene*scene ,ccColor3B color);
};
/**
@ -269,7 +308,9 @@ Cross fades two scenes using the CCRenderTexture object.
class CCRenderTexture;
class CCCrossFadeTransition : public CCTransitionScene
{
public :
CCCrossFadeTransition();
virtual ~CCCrossFadeTransition();
};
/** CCTurnOffTilesTransition:
@ -277,7 +318,9 @@ Turn off the tiles of the outgoing scene in random order
*/
class CCTurnOffTilesTransition : public CCTransitionScene ,public CCTransitionEaseScene
{
public :
CCTurnOffTilesTransition();
virtual ~CCTurnOffTilesTransition();
};
/** CCSplitColsTransition:
@ -286,6 +329,9 @@ The odd columns goes upwards while the even columns goes downwards.
class CCSplitColsTransition : public CCTransitionScene , public CCTransitionEaseScene
{
public:
CCSplitColsTransition();
virtual ~CCSplitColsTransition();
virtual CCIntervalAction* action(void);
};
@ -294,7 +340,9 @@ The odd rows goes to the left while the even rows goes to the right.
*/
class CCSplitRowsTransition : public CCSplitColsTransition
{
public:
CCSplitRowsTransition();
virtual ~CCSplitRowsTransition();
};
/** CCFadeTRTransition:
@ -303,6 +351,8 @@ Fade the tiles of the outgoing scene from the left-bottom corner the to top-righ
class CCFadeTRTransition : public CCTransitionScene , public CCTransitionEaseScene
{
public:
CCFadeTRTransition();
virtual ~CCFadeTRTransition();
virtual CCIntervalAction* actionWithSize(ccGridSize size);
};
@ -311,7 +361,9 @@ Fade the tiles of the outgoing scene from the top-right corner to the bottom-lef
*/
class CCFadeBLTransition : public CCFadeTRTransition
{
public:
CCFadeBLTransition();
virtual ~CCFadeBLTransition();
};
/** CCFadeUpTransition:
@ -319,7 +371,9 @@ class CCFadeBLTransition : public CCFadeTRTransition
*/
class CCFadeUpTransition : public CCFadeTRTransition
{
public:
CCFadeUpTransition();
virtual ~CCFadeUpTransition();
};
/** CCFadeDownTransition:
@ -327,7 +381,10 @@ class CCFadeUpTransition : public CCFadeTRTransition
*/
class CCFadeDownTransition : public CCFadeTRTransition
{
public:
CCFadeDownTransition();
virtual ~CCFadeDownTransition();
};
#endif // __CCTRANSITION_H__
#endif // __CCTRANSITION_H__

View File

@ -26,11 +26,11 @@ THE SOFTWARE.
#define __COCOS2D_DEFINE_H__
/** CCX_PROPERTY_READONLY is used to declare a protected variable.
We can use get method to read the variable.
We can use getter to read the variable.
@param varType : the type of variable.
@param varName : variable name.
@param funName : "get + funName" is the name of the get method.
@warning : The get method is a public virtual function, you should override it first.
@param funName : "get + funName" is the name of the getter.
@warning : The getter is a public virtual function, you should rewrite it first.
The variables and methods declared after CCX_PROPERTY_READONLY are all public.
If you need protected or private, please declare.
*/
@ -39,12 +39,12 @@ THE SOFTWARE.
public: virtual varType get##funName(void);
/** CCX_PROPERTY is used to declare a protected variable.
We can use get method to read the variable, and use the set method to change the variable.
We can use getter to read the variable, and use the setter to change the variable.
@param varType : the type of variable.
@param varName : variable name.
@param funName : "get + funName" is the name of the get method.
"set + funName" is the name of the set method.
@warning : The get and set methods are public virtual functions, you should override them first.
@param funName : "get + funName" is the name of the getter.
"set + funName" is the name of the setter.
@warning : The getter and setter are public virtual functions, you should rewrite them first.
The variables and methods declared after CCX_PROPERTY are all public.
If you need protected or private, please declare.
*/
@ -54,11 +54,11 @@ THE SOFTWARE.
public: virtual void set##funName(varType var);
/** CCX_SYNTHESIZE_READONLY is used to declare a protected variable.
We can use get method to read the variable.
We can use getter to read the variable.
@param varType : the type of variable.
@param varName : variable name.
@param funName : "get + funName" is the name of the get method.
@warning : The get method is a public inline function.
@param funName : "get + funName" is the name of the getter.
@warning : The getter is a public inline function.
The variables and methods declared after CCX_SYNTHESIZE_READONLY are all public.
If you need protected or private, please declare.
*/
@ -67,12 +67,12 @@ THE SOFTWARE.
public: inline varType get##funName(void){ return varName; }
/** CCX_SYNTHESIZE is used to declare a protected variable.
We can use get method to read the variable, and use the set method to change the variable.
We can use getter to read the variable, and use the setter to change the variable.
@param varType : the type of variable.
@param varName : variable name.
@param funName : "get + funName" is the name of the get method.
"set + funName" is the name of the set method.
@warning : The get and set methods are public inline functions.
@param funName : "get + funName" is the name of the getter.
"set + funName" is the name of the setter.
@warning : The getter and setter are public inline functions.
The variables and methods declared after CCX_SYNTHESIZE are all public.
If you need protected or private, please declare.
*/
@ -82,6 +82,7 @@ THE SOFTWARE.
public: inline void set##funName(varType var){ varName = var; }
#define CCX_SAFE_DELETE(p) if(p) {delete p; p=NULL;}
#define CXX_BREAK_IF(cond) if(cond) break;
#define CCX_BREAK_IF(cond) if(cond) break;
#endif // __COCOS2D_DEFINE_H__
#endif // __COCOS2D_DEFINE_H__

View File

@ -25,9 +25,3 @@ THE SOFTWARE.
#include "CCScene.h"
using namespace std;
bool CCScene::init(void)
{
return true;
}