mirror of https://github.com/axmolengine/axmol.git
issue #5, add declares in .cpp files, but still no implementation. change some methods to virtual.
This commit is contained in:
parent
fb5762c463
commit
1c2b95973d
|
@ -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()
|
float CCNode::getRotation()
|
||||||
{
|
{
|
||||||
return m_fRotation;
|
return m_fRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// rotation setter
|
||||||
|
void CCNode::setRotation(float newRotation)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// scaleY setter
|
||||||
|
void CCNode::setScaleY(float newScaleY)
|
||||||
|
{
|
||||||
|
m_fScaleY = newScaleY;
|
||||||
|
m_bIsTransformDirty = m_bIsInverseDirty = true;
|
||||||
|
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
|
||||||
|
m_bIsTransformGLDirty = true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/// position getter
|
||||||
CGPoint CCNode::getPosition()
|
CGPoint CCNode::getPosition()
|
||||||
{
|
{
|
||||||
return m_tPosition;
|
return m_tPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CCNode::getScaleX()
|
/// position setter
|
||||||
|
void CCNode::setPosition(CGPoint newPosition)
|
||||||
{
|
{
|
||||||
return m_fScaleX;
|
m_tPosition = newPosition;
|
||||||
|
m_bIsTransformDirty = m_bIsInverseDirty = true;
|
||||||
|
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
|
||||||
|
m_bIsTransformGLDirty = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
float CCNode::getScaleY()
|
/// children getter
|
||||||
|
NSMutableArray * CCNode::getChildren()
|
||||||
{
|
{
|
||||||
return m_fScaleY;
|
return m_pChildren;
|
||||||
}
|
|
||||||
|
|
||||||
void CCNode::setVisibility(bool bIsVisible)
|
|
||||||
{
|
|
||||||
m_bIsVisible = bIsVisible;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCNode::getVisibility()
|
/// children getter
|
||||||
|
// camera: lazy alloc
|
||||||
|
CCCamera* getCamera()
|
||||||
{
|
{
|
||||||
return m_bIsVisible;
|
/** @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
|
/// @todo
|
||||||
//CCGridBase* CCNode::getGrid()
|
//CCGridBase* CCNode::getGrid()
|
||||||
//{
|
//{
|
||||||
// return m_pGrid;
|
// return m_pGrid;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
/// grid setter
|
||||||
/// @todo
|
/// @todo
|
||||||
//void CCNode::setGrid(CCGridBase* pGrid)
|
//void CCNode::setGrid(CCGridBase* pGrid)
|
||||||
//{
|
//{
|
||||||
|
@ -108,76 +213,53 @@ bool CCNode::getVisibility()
|
||||||
// m_pGrid->retain();
|
// m_pGrid->retain();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
// getters synthesized, setters explicit
|
/// isVisible getter
|
||||||
void CCNode::setRotation(float newRotation)
|
bool CCNode::getIsVisible()
|
||||||
{
|
{
|
||||||
m_fRotation = newRotation;
|
return m_bIsVisible;
|
||||||
m_bIsTransformDirty = m_bIsInverseDirty = true;
|
|
||||||
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
|
|
||||||
m_bIsTransformGLDirty = true;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCNode::setScaleX(float newScaleX)
|
/// isVisible setter
|
||||||
|
void CCNode::setIsVisible(bool var)
|
||||||
{
|
{
|
||||||
m_fScaleX = newScaleX;
|
m_bIsVisible = var;
|
||||||
m_bIsTransformDirty = m_bIsInverseDirty = true;
|
|
||||||
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
|
|
||||||
m_bIsTransformGLDirty = true;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
/// anchorPoint getter
|
||||||
|
CGPoint CCNode::getAnchorPoint()
|
||||||
{
|
{
|
||||||
m_tPosition = newPosition;
|
return m_tAnchorPoint;
|
||||||
m_bIsTransformDirty = m_bIsInverseDirty = true;
|
|
||||||
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
|
|
||||||
m_bIsTransformGLDirty = true;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCNode::setIsRelativeAnchorPoint(bool newValue)
|
/// @todo anchorPoint setter
|
||||||
{
|
|
||||||
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)
|
void CCNode::setAnchorPoint(CGPoint point)
|
||||||
{
|
{
|
||||||
/*if( ! CGPointEqualToPoint(point, m_anchorPoint) )
|
/*if( ! CGPointEqualToPoint(point, m_anchorPoint) )
|
||||||
{
|
{
|
||||||
m_anchorPoint = point;
|
m_anchorPoint = point;
|
||||||
this->m_anchorPointInPixels = ccp( m_contentSize.width * m_anchorPoint.x, m_contentSize.height * m_anchorPoint.y );
|
this->m_anchorPointInPixels = ccp( m_contentSize.width * m_anchorPoint.x, m_contentSize.height * m_anchorPoint.y );
|
||||||
m_isTransformDirty = m_isInverseDirty = true;
|
m_isTransformDirty = m_isInverseDirty = true;
|
||||||
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
|
#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX
|
||||||
m_bIsTransformGLDirty = true;
|
m_bIsTransformGLDirty = true;
|
||||||
#endif
|
#endif
|
||||||
}*/
|
}*/
|
||||||
}
|
|
||||||
|
|
||||||
CGPoint CCNode::getAnchorPoint()
|
|
||||||
{
|
|
||||||
return m_tAnchorPoint;
|
|
||||||
}
|
}
|
||||||
/// @todo
|
|
||||||
|
/// anchorPointInPixels getter
|
||||||
|
CGPoint CCNode::getAnchorPointInPixels()
|
||||||
|
{
|
||||||
|
return m_tAnchorPointInPixels;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// contentSize getter
|
||||||
|
CGSize CCNode::getContentSize()
|
||||||
|
{
|
||||||
|
return m_tContentSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @todo contentSize setter
|
||||||
void CCNode::setContentSize(CGSize size)
|
void CCNode::setContentSize(CGSize size)
|
||||||
{
|
{
|
||||||
//if( ! CGSizeEqualToSize(size, m_contentSize) )
|
//if( ! CGSizeEqualToSize(size, m_contentSize) )
|
||||||
|
@ -191,82 +273,76 @@ void CCNode::setContentSize(CGSize size)
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
CGSize CCNode::getContentSize()
|
|
||||||
|
/// isRunning getter
|
||||||
|
bool CCNode::getIsRunning()
|
||||||
{
|
{
|
||||||
return m_tContentSize;
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
/// tag getter
|
||||||
|
int CCNode::getTag()
|
||||||
|
{
|
||||||
|
return m_iTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// tag setter
|
||||||
|
void CCNode::setTag(int var)
|
||||||
|
{
|
||||||
|
m_iTag = var;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// userData getter
|
||||||
|
void * CCNode::getUserData()
|
||||||
|
{
|
||||||
|
return m_pUserData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// userData setter
|
||||||
|
void CCNode::setUserData(void *var)
|
||||||
|
{
|
||||||
|
m_pUserData = var;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @todo
|
/// @todo
|
||||||
//CGRect CCNode::boundingBox()
|
//CGRect CCNode::boundingBox()
|
||||||
//{
|
//{
|
||||||
// CGRect rect = CGRectMake(0, 0, m_contentSize.width, m_contentSize.height);
|
// CGRect rect = CGRectMake(0, 0, m_contentSize.width, m_contentSize.height);
|
||||||
// return CGRectApplyAffineTransform(rect, nodeToParentTransform());
|
// 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)
|
|
||||||
{
|
|
||||||
m_fScaleX = m_fScaleY = scale;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CCNode::getTag()
|
|
||||||
{
|
|
||||||
return m_iTag;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCNode::setTag(int tag)
|
|
||||||
{
|
|
||||||
m_iTag = tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CCNode::getZOrder()
|
|
||||||
{
|
|
||||||
return m_iZOrder;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCNode::setVertexZ(float z)
|
|
||||||
{
|
|
||||||
m_fVertexZ = z;
|
|
||||||
}
|
|
||||||
|
|
||||||
float CCNode::getVertexZ()
|
|
||||||
{
|
|
||||||
return m_fVertexZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
CGPoint CCNode::getAnchorPointInPixels()
|
|
||||||
{
|
|
||||||
return m_tAnchorPointInPixels;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CCNode::getIsRunning()
|
|
||||||
{
|
|
||||||
return m_bIsRunning;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** @todo
|
/** @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)
|
CCNode * CCNode::node(void)
|
||||||
{
|
{
|
||||||
/// @todo return [[[self alloc] init] autorelease];
|
/// @todo return [[[self alloc] init] autorelease];
|
||||||
return NULL;
|
CCNode * pNode = new CCNode();
|
||||||
|
pNode->autorelease();
|
||||||
|
return pNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCNode::cleanup()
|
void CCNode::cleanup()
|
||||||
|
@ -356,25 +408,7 @@ void CCNode::childrenAlloc(void)
|
||||||
{
|
{
|
||||||
/// @todo children_ = [[CCArray alloc] initWithCapacity:4];
|
/// @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)
|
CCNode* CCNode::getChildByTag(int aTag)
|
||||||
{
|
{
|
||||||
/** @todo
|
/** @todo
|
||||||
|
@ -804,7 +838,7 @@ void CCNode::pauseSchedulerAndActions()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @todo
|
/** @todo
|
||||||
- (CGAffineTransform)nodeToParentTransform
|
CGAffineTransform CCNode::nodeToParentTransform(void)
|
||||||
{
|
{
|
||||||
if ( isTransformDirty_ ) {
|
if ( isTransformDirty_ ) {
|
||||||
|
|
||||||
|
@ -827,8 +861,8 @@ void CCNode::pauseSchedulerAndActions()
|
||||||
}
|
}
|
||||||
|
|
||||||
return transform_;
|
return transform_;
|
||||||
}
|
}*/
|
||||||
|
/** @todo
|
||||||
- (CGAffineTransform)parentToNodeTransform
|
- (CGAffineTransform)parentToNodeTransform
|
||||||
{
|
{
|
||||||
if ( isInverseDirty_ ) {
|
if ( isInverseDirty_ ) {
|
||||||
|
@ -837,8 +871,8 @@ void CCNode::pauseSchedulerAndActions()
|
||||||
}
|
}
|
||||||
|
|
||||||
return inverse_;
|
return inverse_;
|
||||||
}
|
}*/
|
||||||
|
/** @todo
|
||||||
- (CGAffineTransform)nodeToWorldTransform
|
- (CGAffineTransform)nodeToWorldTransform
|
||||||
{
|
{
|
||||||
CGAffineTransform t = [self nodeToParentTransform];
|
CGAffineTransform t = [self nodeToParentTransform];
|
||||||
|
@ -847,50 +881,57 @@ void CCNode::pauseSchedulerAndActions()
|
||||||
t = CGAffineTransformConcat(t, [p nodeToParentTransform]);
|
t = CGAffineTransformConcat(t, [p nodeToParentTransform]);
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}*/
|
||||||
|
/** @todo
|
||||||
- (CGAffineTransform)worldToNodeTransform
|
- (CGAffineTransform)worldToNodeTransform
|
||||||
{
|
{
|
||||||
return CGAffineTransformInvert([self nodeToWorldTransform]);
|
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
|
CGPoint CCNode::convertToNodeSpaceAR(CGPoint worldPoint)
|
||||||
{
|
|
||||||
return CGPointApplyAffineTransform(nodePoint, [self nodeToWorldTransform]);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (CGPoint)convertToNodeSpaceAR:(CGPoint)worldPoint
|
|
||||||
{
|
{
|
||||||
|
/** @todo
|
||||||
CGPoint nodePoint = [self convertToNodeSpace:worldPoint];
|
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_);
|
nodePoint = ccpAdd(nodePoint, anchorPointInPixels_);
|
||||||
return [self convertToWorldSpace:nodePoint];
|
return [self convertToWorldSpace:nodePoint];*/
|
||||||
|
return CGPoint(0,0);
|
||||||
}
|
}
|
||||||
|
/** @todo no declare in .h file
|
||||||
- (CGPoint)convertToWindowSpace:(CGPoint)nodePoint
|
CGPoint CCNode::convertToWindowSpace(CGPoint nodePoint)
|
||||||
{
|
{
|
||||||
|
|
||||||
CGPoint worldPoint = [self convertToWorldSpace:nodePoint];
|
CGPoint worldPoint = [self convertToWorldSpace:nodePoint];
|
||||||
return [[CCDirector sharedDirector] convertToUI:worldPoint];
|
return [[CCDirector sharedDirector] convertToUI:worldPoint];
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// convenience methods which take a UITouch instead of CGPoint
|
// convenience methods which take a UITouch instead of CGPoint
|
||||||
|
/** @todo
|
||||||
- (CGPoint)convertTouchToNodeSpace:(UITouch *)touch
|
- (CGPoint)convertTouchToNodeSpace:(UITouch *)touch
|
||||||
{
|
{
|
||||||
CGPoint point = [touch locationInView: [touch view]];
|
CGPoint point = [touch locationInView: [touch view]];
|
||||||
point = [[CCDirector sharedDirector] convertToGL: point];
|
point = [[CCDirector sharedDirector] convertToGL: point];
|
||||||
return [self convertToNodeSpace:point];
|
return [self convertToNodeSpace:point];
|
||||||
}
|
}*/
|
||||||
|
/** @todo
|
||||||
- (CGPoint)convertTouchToNodeSpaceAR:(UITouch *)touch
|
- (CGPoint)convertTouchToNodeSpaceAR:(UITouch *)touch
|
||||||
{
|
{
|
||||||
CGPoint point = [touch locationInView: [touch view]];
|
CGPoint point = [touch locationInView: [touch view]];
|
||||||
|
|
|
@ -45,6 +45,10 @@ class CCLayer : public CCNode//, public UIAccelerometerDelegate, public CCStanda
|
||||||
public:
|
public:
|
||||||
CCLayer();
|
CCLayer();
|
||||||
virtual ~CCLayer();
|
virtual ~CCLayer();
|
||||||
|
|
||||||
|
virtual void onEnter();
|
||||||
|
virtual void onExit();
|
||||||
|
|
||||||
/** If isTouchEnabled, this method is called onEnter. Override it to change the
|
/** If isTouchEnabled, this method is called onEnter. Override it to change the
|
||||||
way CCLayer receives touch events.
|
way CCLayer receives touch events.
|
||||||
( Default: [[TouchDispatcher sharedDispatcher] addStandardDelegate:self priority:0] )
|
( Default: [[TouchDispatcher sharedDispatcher] addStandardDelegate:self priority:0] )
|
||||||
|
@ -91,6 +95,9 @@ public:
|
||||||
CCColorLayer();
|
CCColorLayer();
|
||||||
virtual ~CCColorLayer();
|
virtual ~CCColorLayer();
|
||||||
|
|
||||||
|
virtual void draw();
|
||||||
|
virtual void setContentSize(CGSize var);
|
||||||
|
|
||||||
/** creates a CCLayer with color, width and height */
|
/** creates a CCLayer with color, width and height */
|
||||||
static CCColorLayer * 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. */
|
/** creates a CCLayer with color. Width and height are the window size. */
|
||||||
|
@ -111,11 +118,14 @@ public:
|
||||||
void changeWidthAndHeight(GLfloat w ,GLfloat h);
|
void changeWidthAndHeight(GLfloat w ,GLfloat h);
|
||||||
|
|
||||||
/** Opacity: conforms to CCRGBAProtocol protocol */
|
/** Opacity: conforms to CCRGBAProtocol protocol */
|
||||||
CCX_PROPERTY_READONLY(GLubyte, m_cOpacity, Opacity)
|
CCX_PROPERTY(GLubyte, m_cOpacity, Opacity)
|
||||||
/** Opacity: conforms to CCRGBAProtocol protocol */
|
/** Opacity: conforms to CCRGBAProtocol protocol */
|
||||||
CCX_PROPERTY_READONLY(ccColor3B, m_tColor, Color)
|
CCX_PROPERTY(ccColor3B, m_tColor, Color)
|
||||||
/** BlendFunction. Conforms to CCBlendProtocol protocol */
|
/** BlendFunction. Conforms to CCBlendProtocol protocol */
|
||||||
CCX_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc)
|
CCX_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc)
|
||||||
|
|
||||||
|
private :
|
||||||
|
void updateColor();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCMultipleLayer is a CCLayer with the ability to multiplex it's children.
|
/** CCMultipleLayer is a CCLayer with the ability to multiplex it's children.
|
||||||
|
@ -127,7 +137,7 @@ class CCMultiplexLayer : public CCLayer
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
unsigned int m_iEnabledLayer;
|
unsigned int m_iEnabledLayer;
|
||||||
NSMutableArray * m_tLayers;
|
NSMutableArray * m_pLayers;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CCMultiplexLayer();
|
CCMultiplexLayer();
|
||||||
|
|
|
@ -92,8 +92,8 @@ Camera:
|
||||||
- Each node has a camera. By default it points to the center of the CCNode.
|
- Each node has a camera. By default it points to the center of the CCNode.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CCNode{
|
class CCNode : public NSObject
|
||||||
|
{
|
||||||
// variable property
|
// variable property
|
||||||
|
|
||||||
/** The z order of the node relative to it's "brothers": children of the same parent */
|
/** 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)
|
CCX_PROPERTY(CCGridBase *, m_pGrid, Grid)
|
||||||
|
|
||||||
/** Whether of not the node is visible. Default is true */
|
/** 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.
|
/** 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.
|
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.
|
/** The anchorPoint in absolute pixels.
|
||||||
Since v0.8 you can only read it. If you wish to modify it, use anchorPoint instead
|
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 untransformed size of the node.
|
||||||
The contentSize remains the same no matter the node is scaled or rotated.
|
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.
|
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.
|
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'.
|
/** 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.
|
If the CCNode enters the 'stage' with a transition, this callback is called when the transition finishes.
|
||||||
@since v0.8
|
@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.
|
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.
|
During onExit you can't a "sister/brother" node.
|
||||||
*/
|
*/
|
||||||
void onExit();
|
virtual void onExit();
|
||||||
|
|
||||||
// composition: ADD
|
// composition: ADD
|
||||||
|
|
||||||
|
@ -291,8 +291,10 @@ public:
|
||||||
/** Stops all running actions and schedulers
|
/** Stops all running actions and schedulers
|
||||||
@since v0.8
|
@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
|
// draw
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,6 @@ class CCScene : public CCNode
|
||||||
public:
|
public:
|
||||||
CCScene();
|
CCScene();
|
||||||
virtual ~CCScene();
|
virtual ~CCScene();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __CCSCENE_H__
|
#endif // __CCSCENE_H__
|
||||||
|
|
|
@ -38,6 +38,8 @@ class CCTransitionEaseScene : public NSObject
|
||||||
@since v0.8.2
|
@since v0.8.2
|
||||||
*/
|
*/
|
||||||
public:
|
public:
|
||||||
|
CCTransitionEaseScene();
|
||||||
|
virtual ~CCTransitionEaseScene();
|
||||||
virtual CCIntervalAction * easeActionWithAction(CCIntervalAction * action);
|
virtual CCIntervalAction * easeActionWithAction(CCIntervalAction * action);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -60,13 +62,22 @@ class CCTransitionScene : public CCScene
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CCScene * m_tInScene;
|
CCScene * m_pInScene;
|
||||||
CCScene * m_tOutScene;
|
CCScene * m_pOutScene;
|
||||||
ccTime m_fDuration;
|
ccTime m_fDuration;
|
||||||
BOOL m_bIsInSceneOnTop;
|
bool m_bIsInSceneOnTop;
|
||||||
BOOL m_bIsSendCleanupToScene;
|
bool m_bIsSendCleanupToScene;
|
||||||
|
|
||||||
public:
|
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 */
|
/** creates a base transition with duration and incoming scene */
|
||||||
static CCTransitionScene * transitionWithDurationAndScene(ccTime t, CCScene *scene);
|
static CCTransitionScene * transitionWithDurationAndScene(ccTime t, CCScene *scene);
|
||||||
|
|
||||||
|
@ -78,6 +89,11 @@ public:
|
||||||
|
|
||||||
/** used by some transitions to hide the outter scene */
|
/** used by some transitions to hide the outter scene */
|
||||||
void hideOutShowIn(void);
|
void hideOutShowIn(void);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void sceneOrder();
|
||||||
|
void setNewScene(ccTime dt);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A CCTransition that supports orientation like.
|
/** A CCTransition that supports orientation like.
|
||||||
|
@ -89,8 +105,11 @@ protected:
|
||||||
tOrientation m_tOrientation;
|
tOrientation m_tOrientation;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
CCOrientedTransitionScene();
|
||||||
|
~CCOrientedTransitionScene();
|
||||||
|
|
||||||
/** creates a base transition with duration and incoming scene */
|
/** 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 */
|
/** initializes a transition with duration and incoming scene */
|
||||||
virtual CCOrientedTransitionScene * initWithDurationAndScene(ccTime t,CCScene* scene,tOrientation orientation);
|
virtual CCOrientedTransitionScene * initWithDurationAndScene(ccTime t,CCScene* scene,tOrientation orientation);
|
||||||
};
|
};
|
||||||
|
@ -103,6 +122,7 @@ class CCRotoZoomTransition : public CCTransitionScene
|
||||||
public:
|
public:
|
||||||
CCRotoZoomTransition();
|
CCRotoZoomTransition();
|
||||||
virtual ~CCRotoZoomTransition();
|
virtual ~CCRotoZoomTransition();
|
||||||
|
virtual void onEnter();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCJumpZoomTransition:
|
/** CCJumpZoomTransition:
|
||||||
|
@ -113,6 +133,7 @@ class CCJumpZoomTransition : public CCTransitionScene
|
||||||
public:
|
public:
|
||||||
CCJumpZoomTransition();
|
CCJumpZoomTransition();
|
||||||
virtual ~CCJumpZoomTransition();
|
virtual ~CCJumpZoomTransition();
|
||||||
|
virtual void onEnter();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCMoveInLTransition:
|
/** CCMoveInLTransition:
|
||||||
|
@ -126,7 +147,11 @@ public:
|
||||||
/** initializes the scenes */
|
/** initializes the scenes */
|
||||||
virtual void initScenes(void);
|
virtual void initScenes(void);
|
||||||
/** returns the action that will be performed */
|
/** returns the action that will be performed */
|
||||||
virtual CCIntervalAction* action(void);
|
CCIntervalAction* action(void);
|
||||||
|
|
||||||
|
virtual CCIntervalAction* easeActionWithAction(CCIntervalAction * action);
|
||||||
|
|
||||||
|
virtual void onEnter();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCMoveInRTransition:
|
/** CCMoveInRTransition:
|
||||||
|
@ -137,6 +162,7 @@ class CCMoveInRTransition : public CCMoveInLTransition
|
||||||
public:
|
public:
|
||||||
CCMoveInRTransition();
|
CCMoveInRTransition();
|
||||||
virtual ~CCMoveInRTransition();
|
virtual ~CCMoveInRTransition();
|
||||||
|
virtual void initScenes();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCMoveInTTransition:
|
/** CCMoveInTTransition:
|
||||||
|
@ -147,6 +173,7 @@ class CCMoveInTTransition : public CCMoveInLTransition
|
||||||
public:
|
public:
|
||||||
CCMoveInTTransition();
|
CCMoveInTTransition();
|
||||||
virtual ~CCMoveInTTransition();
|
virtual ~CCMoveInTTransition();
|
||||||
|
virtual void initScenes();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCMoveInBTransition:
|
/** CCMoveInBTransition:
|
||||||
|
@ -157,6 +184,7 @@ class CCMoveInBTransition : public CCMoveInLTransition
|
||||||
public:
|
public:
|
||||||
CCMoveInBTransition();
|
CCMoveInBTransition();
|
||||||
virtual ~CCMoveInBTransition();
|
virtual ~CCMoveInBTransition();
|
||||||
|
virtual void initScenes();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCSlideInLTransition:
|
/** CCSlideInLTransition:
|
||||||
|
@ -172,6 +200,10 @@ public:
|
||||||
virtual void initScenes(void);
|
virtual void initScenes(void);
|
||||||
/** returns the action that will be performed by the incomming and outgoing scene */
|
/** returns the action that will be performed by the incomming and outgoing scene */
|
||||||
virtual CCIntervalAction* action(void);
|
virtual CCIntervalAction* action(void);
|
||||||
|
|
||||||
|
virtual void onEnter();
|
||||||
|
virtual void sceneOrder();
|
||||||
|
virtual CCIntervalAction* easeActionWithAction(CCIntervalAction * action);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCSlideInRTransition:
|
/** CCSlideInRTransition:
|
||||||
|
@ -182,6 +214,13 @@ class CCSlideInRTransition : public CCSlideInLTransition
|
||||||
public:
|
public:
|
||||||
CCSlideInRTransition();
|
CCSlideInRTransition();
|
||||||
virtual ~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:
|
/** CCSlideInBTransition:
|
||||||
|
@ -192,6 +231,13 @@ class CCSlideInBTransition : public CCSlideInLTransition
|
||||||
public:
|
public:
|
||||||
CCSlideInBTransition();
|
CCSlideInBTransition();
|
||||||
virtual ~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:
|
/** CCSlideInTTransition:
|
||||||
|
@ -202,6 +248,13 @@ class CCSlideInTTransition : public CCSlideInLTransition
|
||||||
public:
|
public:
|
||||||
CCSlideInTTransition();
|
CCSlideInTTransition();
|
||||||
virtual ~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:
|
public:
|
||||||
CCShrinkGrowTransition();
|
CCShrinkGrowTransition();
|
||||||
virtual ~CCShrinkGrowTransition();
|
virtual ~CCShrinkGrowTransition();
|
||||||
|
|
||||||
|
virtual void onEnter();
|
||||||
|
virtual CCIntervalAction* easeActionWithAction(CCIntervalAction * action);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCFlipXTransition:
|
/** CCFlipXTransition:
|
||||||
|
@ -223,6 +279,8 @@ class CCFlipXTransition : public CCOrientedTransitionScene
|
||||||
public:
|
public:
|
||||||
CCFlipXTransition();
|
CCFlipXTransition();
|
||||||
virtual ~CCFlipXTransition();
|
virtual ~CCFlipXTransition();
|
||||||
|
|
||||||
|
virtual void onEnter();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCFlipYTransition:
|
/** CCFlipYTransition:
|
||||||
|
@ -234,6 +292,8 @@ class CCFlipYTransition : public CCOrientedTransitionScene
|
||||||
public:
|
public:
|
||||||
CCFlipYTransition();
|
CCFlipYTransition();
|
||||||
virtual ~CCFlipYTransition();
|
virtual ~CCFlipYTransition();
|
||||||
|
|
||||||
|
virtual void onEnter();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCFlipAngularTransition:
|
/** CCFlipAngularTransition:
|
||||||
|
@ -245,6 +305,8 @@ class CCFlipAngularTransition : public CCOrientedTransitionScene
|
||||||
public:
|
public:
|
||||||
CCFlipAngularTransition();
|
CCFlipAngularTransition();
|
||||||
virtual ~CCFlipAngularTransition();
|
virtual ~CCFlipAngularTransition();
|
||||||
|
|
||||||
|
virtual void onEnter();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCZoomFlipXTransition:
|
/** CCZoomFlipXTransition:
|
||||||
|
@ -256,6 +318,8 @@ class CCZoomFlipXTransition : public CCOrientedTransitionScene
|
||||||
public:
|
public:
|
||||||
CCZoomFlipXTransition();
|
CCZoomFlipXTransition();
|
||||||
virtual ~CCZoomFlipXTransition();
|
virtual ~CCZoomFlipXTransition();
|
||||||
|
|
||||||
|
virtual void onEnter();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCZoomFlipYTransition:
|
/** CCZoomFlipYTransition:
|
||||||
|
@ -267,6 +331,8 @@ class CCZoomFlipYTransition : public CCOrientedTransitionScene
|
||||||
public:
|
public:
|
||||||
CCZoomFlipYTransition();
|
CCZoomFlipYTransition();
|
||||||
virtual ~CCZoomFlipYTransition();
|
virtual ~CCZoomFlipYTransition();
|
||||||
|
|
||||||
|
virtual void onEnter();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCZoomFlipAngularTransition:
|
/** CCZoomFlipAngularTransition:
|
||||||
|
@ -278,6 +344,8 @@ class CCZoomFlipAngularTransition : public CCOrientedTransitionScene
|
||||||
public:
|
public:
|
||||||
CCZoomFlipAngularTransition();
|
CCZoomFlipAngularTransition();
|
||||||
virtual ~CCZoomFlipAngularTransition();
|
virtual ~CCZoomFlipAngularTransition();
|
||||||
|
|
||||||
|
virtual void onEnter();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCFadeTransition:
|
/** CCFadeTransition:
|
||||||
|
@ -299,6 +367,10 @@ public:
|
||||||
static CCFadeTransition* 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 */
|
/** initializes the transition with a duration and with an RGB color */
|
||||||
CCFadeTransition* initWithDurationAndColor(ccTime duration, CCScene*scene ,ccColor3B 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 :
|
public :
|
||||||
CCCrossFadeTransition();
|
CCCrossFadeTransition();
|
||||||
virtual ~CCCrossFadeTransition();
|
virtual ~CCCrossFadeTransition();
|
||||||
|
|
||||||
|
virtual void draw();
|
||||||
|
virtual void onEnter();
|
||||||
|
virtual void onExit();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCTurnOffTilesTransition:
|
/** CCTurnOffTilesTransition:
|
||||||
|
@ -321,6 +397,10 @@ class CCTurnOffTilesTransition : public CCTransitionScene ,public CCTransitionEa
|
||||||
public :
|
public :
|
||||||
CCTurnOffTilesTransition();
|
CCTurnOffTilesTransition();
|
||||||
virtual ~CCTurnOffTilesTransition();
|
virtual ~CCTurnOffTilesTransition();
|
||||||
|
|
||||||
|
virtual void sceneOrder();
|
||||||
|
virtual void onEnter();
|
||||||
|
CCIntervalAction * easeActionWithAction(CCIntervalAction * action);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCSplitColsTransition:
|
/** CCSplitColsTransition:
|
||||||
|
@ -333,6 +413,8 @@ public:
|
||||||
virtual ~CCSplitColsTransition();
|
virtual ~CCSplitColsTransition();
|
||||||
|
|
||||||
virtual CCIntervalAction* action(void);
|
virtual CCIntervalAction* action(void);
|
||||||
|
virtual void onEnter();
|
||||||
|
virtual CCIntervalAction * easeActionWithAction(CCIntervalAction * action);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCSplitRowsTransition:
|
/** CCSplitRowsTransition:
|
||||||
|
@ -343,6 +425,8 @@ class CCSplitRowsTransition : public CCSplitColsTransition
|
||||||
public:
|
public:
|
||||||
CCSplitRowsTransition();
|
CCSplitRowsTransition();
|
||||||
virtual ~CCSplitRowsTransition();
|
virtual ~CCSplitRowsTransition();
|
||||||
|
|
||||||
|
virtual CCIntervalAction* action(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCFadeTRTransition:
|
/** CCFadeTRTransition:
|
||||||
|
@ -354,6 +438,10 @@ public:
|
||||||
CCFadeTRTransition();
|
CCFadeTRTransition();
|
||||||
virtual ~CCFadeTRTransition();
|
virtual ~CCFadeTRTransition();
|
||||||
virtual CCIntervalAction* actionWithSize(ccGridSize size);
|
virtual CCIntervalAction* actionWithSize(ccGridSize size);
|
||||||
|
|
||||||
|
virtual void sceneOrder();
|
||||||
|
virtual void onEnter();
|
||||||
|
virtual CCIntervalAction* easeActionWithAction(CCIntervalAction * action);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCFadeBLTransition:
|
/** CCFadeBLTransition:
|
||||||
|
@ -364,6 +452,7 @@ class CCFadeBLTransition : public CCFadeTRTransition
|
||||||
public:
|
public:
|
||||||
CCFadeBLTransition();
|
CCFadeBLTransition();
|
||||||
virtual ~CCFadeBLTransition();
|
virtual ~CCFadeBLTransition();
|
||||||
|
virtual CCIntervalAction* actionWithSize(ccGridSize size);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCFadeUpTransition:
|
/** CCFadeUpTransition:
|
||||||
|
@ -374,6 +463,7 @@ class CCFadeUpTransition : public CCFadeTRTransition
|
||||||
public:
|
public:
|
||||||
CCFadeUpTransition();
|
CCFadeUpTransition();
|
||||||
virtual ~CCFadeUpTransition();
|
virtual ~CCFadeUpTransition();
|
||||||
|
virtual CCIntervalAction* actionWithSize(ccGridSize size);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CCFadeDownTransition:
|
/** CCFadeDownTransition:
|
||||||
|
@ -384,6 +474,7 @@ class CCFadeDownTransition : public CCFadeTRTransition
|
||||||
public:
|
public:
|
||||||
CCFadeDownTransition();
|
CCFadeDownTransition();
|
||||||
virtual ~CCFadeDownTransition();
|
virtual ~CCFadeDownTransition();
|
||||||
|
virtual CCIntervalAction* actionWithSize(ccGridSize size);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __CCTRANSITION_H__
|
#endif // __CCTRANSITION_H__
|
||||||
|
|
|
@ -24,4 +24,354 @@ THE SOFTWARE.
|
||||||
|
|
||||||
#include "CCLayer.h"
|
#include "CCLayer.h"
|
||||||
|
|
||||||
using namespace std;
|
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]]; */
|
||||||
|
}
|
||||||
|
|
|
@ -25,3 +25,13 @@ THE SOFTWARE.
|
||||||
#include "CCScene.h"
|
#include "CCScene.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
CCScene::CCScene()
|
||||||
|
{
|
||||||
|
/// @todo
|
||||||
|
}
|
||||||
|
|
||||||
|
CCScene::~CCScene()
|
||||||
|
{
|
||||||
|
/// @todo
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue