fixed #1189: updated linebreak and tab(4 space) for all source files.

This commit is contained in:
James Chen 2012-04-25 18:17:04 +08:00
parent a5f0bc3cbc
commit 1d94ba05a0
11 changed files with 339 additions and 339 deletions

View File

@ -83,9 +83,9 @@ bool CCConfiguration::init(void)
bEnableProfilers ? "YES - *** Disable it when you finish profiling ***" : "NO");
#if CC_ENABLE_GL_STATE_CACHE == 0
CCLOG("");
CCLOG("cocos2d: **** WARNING **** CC_ENABLE_GL_STATE_CACHE is disabled. To improve performance, enable it by editing ccConfig.h");
printf("\n");
CCLOG("");
CCLOG("cocos2d: **** WARNING **** CC_ENABLE_GL_STATE_CACHE is disabled. To improve performance, enable it by editing ccConfig.h");
printf("\n");
#endif
CHECK_GL_ERROR_DEBUG();

View File

@ -353,10 +353,10 @@ void CCDirector::setProjection(ccDirectorProjection kProjection)
case kCCDirectorProjection3D:
{
// reset the viewport if 3d proj & retina display
if( CC_CONTENT_SCALE_FACTOR() != 1.0f )
{
glViewport((GLint)-size.width/2, (GLint)-size.height/2, (GLsizei)(size.width * CC_CONTENT_SCALE_FACTOR()), (GLsizei)(size.height * CC_CONTENT_SCALE_FACTOR()) );
// reset the viewport if 3d proj & retina display
if( CC_CONTENT_SCALE_FACTOR() != 1.0f )
{
glViewport((GLint)-size.width/2, (GLint)-size.height/2, (GLsizei)(size.width * CC_CONTENT_SCALE_FACTOR()), (GLsizei)(size.height * CC_CONTENT_SCALE_FACTOR()) );
}
float zeye = this->getZEye();

View File

@ -34,16 +34,16 @@ THE SOFTWARE.
#include "ccConfig.h"
// actions
#include "CCAction.h"
#include "CCActionInterval.h"
#include "CCActionCamera.h"
#include "CCActionManager.h"
#include "CCActionEase.h"
#include "CCActionPageTurn3D.h"
#include "CCActionGrid.h"
#include "CCActionProgressTimer.h"
#include "CCActionGrid3D.h"
#include "CCActionTiledGrid.h"
#include "CCAction.h"
#include "CCActionInterval.h"
#include "CCActionCamera.h"
#include "CCActionManager.h"
#include "CCActionEase.h"
#include "CCActionPageTurn3D.h"
#include "CCActionGrid.h"
#include "CCActionProgressTimer.h"
#include "CCActionGrid3D.h"
#include "CCActionTiledGrid.h"
#include "CCActionInstant.h"
#include "CCActionTween.h"
@ -52,15 +52,15 @@ THE SOFTWARE.
#include "CCAtlasNode.h"
// cocoa
#include "CCAffineTransform.h"
#include "CCDictionary.h"
#include "CCObject.h"
#include "CCArray.h"
#include "CCGeometry.h"
#include "CCSet.h"
#include "CCAutoreleasePool.h"
#include "CCInteger.h"
#include "CCString.h"
#include "CCAffineTransform.h"
#include "CCDictionary.h"
#include "CCObject.h"
#include "CCArray.h"
#include "CCGeometry.h"
#include "CCSet.h"
#include "CCAutoreleasePool.h"
#include "CCInteger.h"
#include "CCString.h"
#include "CCData.h"
#include "CCNS.h"
#include "CCZone.h"
@ -70,11 +70,11 @@ THE SOFTWARE.
#include "CCGrid.h"
// include
#include "CCEventType.h"
#include "CCProtocols.h"
#include "ccConfig.h"
#include "ccMacros.h"
#include "ccTypes.h"
#include "CCEventType.h"
#include "CCProtocols.h"
#include "ccConfig.h"
#include "ccMacros.h"
#include "ccTypes.h"
#include "cocos2dExt.h"
// kazmath
@ -86,15 +86,15 @@ THE SOFTWARE.
#include "CCKeypadDispatcher.h"
// label_nodes
#include "CCLabelAtlas.h"
#include "CCLabelTTF.h"
#include "CCLabelAtlas.h"
#include "CCLabelTTF.h"
#include "CCLabelBMFont.h"
// layers_scenes_transitions_nodes
#include "CCLayer.h"
#include "CCScene.h"
#include "CCTransition.h"
#include "CCTransitionPageTurn.h"
#include "CCLayer.h"
#include "CCScene.h"
#include "CCTransition.h"
#include "CCTransitionPageTurn.h"
#include "CCTransitionProgress.h"
// menu_nodes
@ -107,8 +107,8 @@ THE SOFTWARE.
#include "CCRenderTexture.h"
// particle_nodes
#include "CCParticleBatchNode.h"
#include "CCParticleSystem.h"
#include "CCParticleBatchNode.h"
#include "CCParticleSystem.h"
#include "CCParticleExamples.h"
#include "CCParticleSystemQuad.h"
@ -135,18 +135,18 @@ THE SOFTWARE.
#include "ccShaders.h"
// sprite_nodes
#include "CCAnimation.h"
#include "CCAnimationCache.h"
#include "CCSprite.h"
#include "CCSpriteBatchNode.h"
#include "CCSpriteFrame.h"
#include "CCAnimation.h"
#include "CCAnimationCache.h"
#include "CCSprite.h"
#include "CCSpriteBatchNode.h"
#include "CCSpriteFrame.h"
#include "CCSpriteFrameCache.h"
// support
#include "CCPointExtension.h"
#include "CCProfiling.h"
#include "CCUserDefault.h"
#include "CCVertex.h"
#include "CCPointExtension.h"
#include "CCProfiling.h"
#include "CCUserDefault.h"
#include "CCVertex.h"
// text_input_node
#include "CCIMEDelegate.h"
@ -160,17 +160,17 @@ THE SOFTWARE.
#include "CCTexturePVR.h"
// tileMap_parallax_nodes
#include "CCParallaxNode.h"
#include "CCTMXLayer.h"
#include "CCTMXObjectGroup.h"
#include "CCTMXTiledMap.h"
#include "CCTMXXMLParser.h"
#include "CCParallaxNode.h"
#include "CCTMXLayer.h"
#include "CCTMXObjectGroup.h"
#include "CCTMXTiledMap.h"
#include "CCTMXXMLParser.h"
#include "CCTileMapAtlas.h"
// touch_dispatcher
#include "CCTouch.h"
#include "CCTouchDelegateProtocol.h"
#include "CCTouchDispatcher.h"
#include "CCTouch.h"
#include "CCTouchDelegateProtocol.h"
#include "CCTouchDispatcher.h"
#include "CCTouchHandler.h"
// root

View File

@ -954,9 +954,9 @@ void CCLabelBMFont::setString(const char *newString)
void CCLabelBMFont::setString(const char *newString, bool fromUpdate)
{
CC_SAFE_DELETE_ARRAY(m_sString);
m_sString = cc_utf8_from_cstr(newString);
m_sString_initial = newString;
CC_SAFE_DELETE_ARRAY(m_sString);
m_sString = cc_utf8_from_cstr(newString);
m_sString_initial = newString;
updateString(fromUpdate);
}
@ -1082,11 +1082,11 @@ void CCLabelBMFont::updateLabel()
vector<unsigned short> str_whole = cc_utf8_vec_from_cstr(m_sString);
unsigned int stringLength = str_whole.size();
vector<unsigned short> multiline_string;
multiline_string.reserve( stringLength );
multiline_string.reserve( stringLength );
vector<unsigned short> last_word;
last_word.reserve( stringLength );
last_word.reserve( stringLength );
unsigned int line = 1, i = 0;
unsigned int line = 1, i = 0;
bool start_line = false, start_word = false;
float startOfLine = -1, startOfWord = -1;
int skip = 0;
@ -1108,7 +1108,7 @@ void CCLabelBMFont::updateLabel()
if (!start_word)
{
startOfWord = getLetterPosXLeft( characterSprite );
startOfWord = getLetterPosXLeft( characterSprite );
start_word = true;
}
if (!start_line)
@ -1122,15 +1122,15 @@ void CCLabelBMFont::updateLabel()
{
cc_utf8_trim_ws(&last_word);
last_word.push_back('\n');
multiline_string.insert(multiline_string.end(), last_word.begin(), last_word.end());
last_word.clear();
start_word = false;
start_line = false;
startOfWord = -1;
startOfLine = -1;
i++;
line++;
last_word.push_back('\n');
multiline_string.insert(multiline_string.end(), last_word.begin(), last_word.end());
last_word.clear();
start_word = false;
start_line = false;
startOfWord = -1;
startOfLine = -1;
i++;
line++;
if (i >= stringLength || i < 0)
break;
@ -1139,7 +1139,7 @@ void CCLabelBMFont::updateLabel()
if (!startOfWord)
{
startOfWord = getLetterPosXLeft( characterSprite );
startOfWord = getLetterPosXLeft( characterSprite );
start_word = true;
}
if (!startOfLine)
@ -1162,7 +1162,7 @@ void CCLabelBMFont::updateLabel()
}
// Out of bounds.
if ( getLetterPosXRight( characterSprite ) - startOfLine > m_fWidth )
if ( getLetterPosXRight( characterSprite ) - startOfLine > m_fWidth )
{
if (!m_bLineBreakWithoutSpaces)
{
@ -1200,7 +1200,7 @@ void CCLabelBMFont::updateLabel()
if (!startOfWord)
{
startOfWord = getLetterPosXLeft( characterSprite );
startOfWord = getLetterPosXLeft( characterSprite );
start_word = true;
}
if (!startOfLine)
@ -1251,13 +1251,13 @@ void CCLabelBMFont::updateLabel()
if (m_sString[ctr] == '\n' || m_sString[ctr] == 0)
{
float lineWidth = 0.0f;
unsigned int line_length = last_line.size();
unsigned int line_length = last_line.size();
int index = i + line_length - 1 + lineNumber;
if (index < 0) continue;
CCSprite* lastChar = (CCSprite*)getChildByTag(index);
if ( lastChar == NULL )
continue;
if ( lastChar == NULL )
continue;
lineWidth = lastChar->getPosition().x + lastChar->getContentSize().width/2.0f;
@ -1318,30 +1318,30 @@ void CCLabelBMFont::setLineBreakWithoutSpace( bool breakWithoutSpace )
void CCLabelBMFont::setScale(float scale)
{
CCSpriteBatchNode::setScale(scale);
updateLabel();
CCSpriteBatchNode::setScale(scale);
updateLabel();
}
void CCLabelBMFont::setScaleX(float scaleX)
{
CCSpriteBatchNode::setScaleX(scaleX);
updateLabel();
CCSpriteBatchNode::setScaleX(scaleX);
updateLabel();
}
void CCLabelBMFont::setScaleY(float scaleY)
{
CCSpriteBatchNode::setScaleY(scaleY);
updateLabel();
CCSpriteBatchNode::setScaleY(scaleY);
updateLabel();
}
float CCLabelBMFont::getLetterPosXLeft( CCSprite* sp )
{
return sp->getPosition().x * m_fScaleX - (sp->getContentSize().width * m_fScaleX * sp->getAnchorPoint().x);
return sp->getPosition().x * m_fScaleX - (sp->getContentSize().width * m_fScaleX * sp->getAnchorPoint().x);
}
float CCLabelBMFont::getLetterPosXRight( CCSprite* sp )
{
return sp->getPosition().x * m_fScaleX + (sp->getContentSize().width * m_fScaleX * sp->getAnchorPoint().x);
return sp->getPosition().x * m_fScaleX + (sp->getContentSize().width * m_fScaleX * sp->getAnchorPoint().x);
}
//LabelBMFont - Debug draw
#if CC_LABELBMFONT_DEBUG_DRAW

View File

@ -198,9 +198,9 @@ public:
virtual void setAlignment(CCTextAlignment alignment);
virtual void setWidth(float width);
virtual void setLineBreakWithoutSpace(bool breakWithoutSpace);
virtual void setScale(float scale);
virtual void setScaleX(float scaleX);
virtual void setScaleY(float scaleY);
virtual void setScale(float scale);
virtual void setScaleX(float scaleX);
virtual void setScaleY(float scaleY);
#if CC_LABELBMFONT_DEBUG_DRAW
virtual void draw();
@ -208,8 +208,8 @@ public:
private:
char * atlasNameFromFntFile(const char *fntFile);
int kerningAmountForFirst(unsigned short first, unsigned short second);
float getLetterPosXLeft( CCSprite* characterSprite );
float getLetterPosXRight( CCSprite* characterSprite );
float getLetterPosXLeft( CCSprite* characterSprite );
float getLetterPosXRight( CCSprite* characterSprite );
};

View File

@ -229,19 +229,19 @@ void CCRenderTexture::end(bool bIsTOCacheTexture)
{
CC_SAFE_DELETE(m_pUITextureImage);
// to get the rendered texture data
const CCSize& s = m_pTexture->getContentSizeInPixels();
// to get the rendered texture data
const CCSize& s = m_pTexture->getContentSizeInPixels();
m_pUITextureImage = newCCImage();
if (m_pUITextureImage)
{
VolatileTexture::addDataTexture(m_pTexture, m_pUITextureImage->getData(), kTexture2DPixelFormat_RGBA8888, s);
}
else
{
CCLOG("Cache rendertexture failed!");
}
}
if (m_pUITextureImage)
{
VolatileTexture::addDataTexture(m_pTexture, m_pUITextureImage->getData(), kTexture2DPixelFormat_RGBA8888, s);
}
else
{
CCLOG("Cache rendertexture failed!");
}
}
#endif
}

View File

@ -1,28 +1,28 @@
#ifndef __CCPLATFORMDEFINE_H__
#define __CCPLATFORMDEFINE_H__
#define CC_DLL
#define CC_ASSERT(cond) \
if (! (cond)) \
{ \
char content[100]; \
sprintf(content, "%s function:%s line:%d", __FILE__, __FUNCTION__, __LINE__ - 3); \
CCMessageBox(content, "Assert error"); \
}
#define CC_UNUSED_PARAM(unusedparam) (void)unusedparam
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#endif /* __CCPLATFORMDEFINE_H__*/
#ifndef __CCPLATFORMDEFINE_H__
#define __CCPLATFORMDEFINE_H__
#define CC_DLL
#define CC_ASSERT(cond) \
if (! (cond)) \
{ \
char content[100]; \
sprintf(content, "%s function:%s line:%d", __FILE__, __FUNCTION__, __LINE__ - 3); \
CCMessageBox(content, "Assert error"); \
}
#define CC_UNUSED_PARAM(unusedparam) (void)unusedparam
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#endif /* __CCPLATFORMDEFINE_H__*/

View File

@ -1,28 +1,28 @@
#ifndef __CCPLATFORMDEFINE_H__
#define __CCPLATFORMDEFINE_H__
#define CC_DLL
#define CC_ASSERT(cond) \
if (! (cond)) \
{ \
char content[100]; \
sprintf(content, "%s function:%s line:%d", __FILE__, __FUNCTION__, __LINE__ - 3); \
CCMessageBox(content, "Assert error"); \
}
#define CC_UNUSED_PARAM(unusedparam) (void)unusedparam
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#endif /* __CCPLATFORMDEFINE_H__*/
#ifndef __CCPLATFORMDEFINE_H__
#define __CCPLATFORMDEFINE_H__
#define CC_DLL
#define CC_ASSERT(cond) \
if (! (cond)) \
{ \
char content[100]; \
sprintf(content, "%s function:%s line:%d", __FILE__, __FUNCTION__, __LINE__ - 3); \
CCMessageBox(content, "Assert error"); \
}
#define CC_UNUSED_PARAM(unusedparam) (void)unusedparam
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#endif /* __CCPLATFORMDEFINE_H__*/

View File

@ -1,26 +1,26 @@
#ifndef __CCPLATFORMDEFINE_H__
#define __CCPLATFORMDEFINE_H__
#if defined(_USRDLL)
#define CC_DLL __declspec(dllexport)
#else /* use a DLL library */
#define CC_DLL __declspec(dllimport)
#endif
#include <assert.h>
#define CC_ASSERT(cond) assert(cond)
#define CC_UNUSED_PARAM(unusedparam) (void)unusedparam
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#endif /* __CCPLATFORMDEFINE_H__*/
#ifndef __CCPLATFORMDEFINE_H__
#define __CCPLATFORMDEFINE_H__
#if defined(_USRDLL)
#define CC_DLL __declspec(dllexport)
#else /* use a DLL library */
#define CC_DLL __declspec(dllimport)
#endif
#include <assert.h>
#define CC_ASSERT(cond) assert(cond)
#define CC_UNUSED_PARAM(unusedparam) (void)unusedparam
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#endif /* __CCPLATFORMDEFINE_H__*/

View File

@ -1,129 +1,129 @@
#include "MutiTouchTest.h"
static ccColor3B s_TouchColors[CC_MAX_TOUCHES] = {
ccYELLOW,
ccBLUE,
ccGREEN,
ccRED,
ccMAGENTA
};
class TouchPoint : public CCNode
{
public:
TouchPoint()
{
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColor));
}
virtual void draw()
{
ccDrawColor4B(m_TouchColor.r, m_TouchColor.g, m_TouchColor.b, 255);
glLineWidth(10);
ccDrawLine( ccp(0, m_pTouchPoint.y), ccp(getContentSize().width, m_pTouchPoint.y) );
ccDrawLine( ccp(m_pTouchPoint.x, 0), ccp(m_pTouchPoint.x, getContentSize().height) );
glLineWidth(1);
ccPointSize(30);
ccDrawPoint(m_pTouchPoint);
}
void setTouchPos(const CCPoint& pt)
{
m_pTouchPoint = pt;
}
void setTouchColor(ccColor3B color)
{
m_TouchColor = color;
}
static TouchPoint* touchPointWithParent(CCNode* pParent)
{
TouchPoint* pRet = new TouchPoint();
pRet->setContentSize(pParent->getContentSize());
pRet->setAnchorPoint(ccp(0.0f, 0.0f));
pRet->autorelease();
return pRet;
}
private:
CCPoint m_pTouchPoint;
ccColor3B m_TouchColor;
};
bool MutiTouchTestLayer::init()
{
if (CCLayer::init())
{
setIsTouchEnabled(true);
return true;
}
return false;
}
static CCDictionary s_dic;
void MutiTouchTestLayer::registerWithTouchDispatcher(void)
{
CCDirector::sharedDirector()->getTouchDispatcher()->addStandardDelegate(this, 0);
}
void MutiTouchTestLayer::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)
{
CCSetIterator iter = pTouches->begin();
for (; iter != pTouches->end(); iter++)
{
CCTouch* pTouch = (CCTouch*)(*iter);
TouchPoint* pTouchPoint = TouchPoint::touchPointWithParent(this);
CCPoint location = pTouch->locationInView();
location = CCDirector::sharedDirector()->convertToGL(location);
pTouchPoint->setTouchPos(location);
pTouchPoint->setTouchColor(s_TouchColors[pTouch->getID()]);
addChild(pTouchPoint);
s_dic.setObject(pTouchPoint, pTouch->getID());
}
}
void MutiTouchTestLayer::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent)
{
CCSetIterator iter = pTouches->begin();
for (; iter != pTouches->end(); iter++)
{
CCTouch* pTouch = (CCTouch*)(*iter);
TouchPoint* pTP = (TouchPoint*)s_dic.objectForKey(pTouch->getID());
CCPoint location = pTouch->locationInView();
location = CCDirector::sharedDirector()->convertToGL(location);
pTP->setTouchPos(location);
}
}
void MutiTouchTestLayer::ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent)
{
CCSetIterator iter = pTouches->begin();
for (; iter != pTouches->end(); iter++)
{
CCTouch* pTouch = (CCTouch*)(*iter);
TouchPoint* pTP = (TouchPoint*)s_dic.objectForKey(pTouch->getID());
removeChild(pTP, true);
s_dic.removeObjectForKey(pTouch->getID());
}
}
void MutiTouchTestLayer::ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent)
{
ccTouchesEnded(pTouches, pEvent);
}
void MutiTouchTestScene::runThisTest()
{
MutiTouchTestLayer* pLayer = MutiTouchTestLayer::node();
addChild(pLayer, 0);
CCDirector::sharedDirector()->replaceScene(this);
}
#include "MutiTouchTest.h"
static ccColor3B s_TouchColors[CC_MAX_TOUCHES] = {
ccYELLOW,
ccBLUE,
ccGREEN,
ccRED,
ccMAGENTA
};
class TouchPoint : public CCNode
{
public:
TouchPoint()
{
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColor));
}
virtual void draw()
{
ccDrawColor4B(m_TouchColor.r, m_TouchColor.g, m_TouchColor.b, 255);
glLineWidth(10);
ccDrawLine( ccp(0, m_pTouchPoint.y), ccp(getContentSize().width, m_pTouchPoint.y) );
ccDrawLine( ccp(m_pTouchPoint.x, 0), ccp(m_pTouchPoint.x, getContentSize().height) );
glLineWidth(1);
ccPointSize(30);
ccDrawPoint(m_pTouchPoint);
}
void setTouchPos(const CCPoint& pt)
{
m_pTouchPoint = pt;
}
void setTouchColor(ccColor3B color)
{
m_TouchColor = color;
}
static TouchPoint* touchPointWithParent(CCNode* pParent)
{
TouchPoint* pRet = new TouchPoint();
pRet->setContentSize(pParent->getContentSize());
pRet->setAnchorPoint(ccp(0.0f, 0.0f));
pRet->autorelease();
return pRet;
}
private:
CCPoint m_pTouchPoint;
ccColor3B m_TouchColor;
};
bool MutiTouchTestLayer::init()
{
if (CCLayer::init())
{
setIsTouchEnabled(true);
return true;
}
return false;
}
static CCDictionary s_dic;
void MutiTouchTestLayer::registerWithTouchDispatcher(void)
{
CCDirector::sharedDirector()->getTouchDispatcher()->addStandardDelegate(this, 0);
}
void MutiTouchTestLayer::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)
{
CCSetIterator iter = pTouches->begin();
for (; iter != pTouches->end(); iter++)
{
CCTouch* pTouch = (CCTouch*)(*iter);
TouchPoint* pTouchPoint = TouchPoint::touchPointWithParent(this);
CCPoint location = pTouch->locationInView();
location = CCDirector::sharedDirector()->convertToGL(location);
pTouchPoint->setTouchPos(location);
pTouchPoint->setTouchColor(s_TouchColors[pTouch->getID()]);
addChild(pTouchPoint);
s_dic.setObject(pTouchPoint, pTouch->getID());
}
}
void MutiTouchTestLayer::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent)
{
CCSetIterator iter = pTouches->begin();
for (; iter != pTouches->end(); iter++)
{
CCTouch* pTouch = (CCTouch*)(*iter);
TouchPoint* pTP = (TouchPoint*)s_dic.objectForKey(pTouch->getID());
CCPoint location = pTouch->locationInView();
location = CCDirector::sharedDirector()->convertToGL(location);
pTP->setTouchPos(location);
}
}
void MutiTouchTestLayer::ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent)
{
CCSetIterator iter = pTouches->begin();
for (; iter != pTouches->end(); iter++)
{
CCTouch* pTouch = (CCTouch*)(*iter);
TouchPoint* pTP = (TouchPoint*)s_dic.objectForKey(pTouch->getID());
removeChild(pTP, true);
s_dic.removeObjectForKey(pTouch->getID());
}
}
void MutiTouchTestLayer::ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent)
{
ccTouchesEnded(pTouches, pEvent);
}
void MutiTouchTestScene::runThisTest()
{
MutiTouchTestLayer* pLayer = MutiTouchTestLayer::node();
addChild(pLayer, 0);
CCDirector::sharedDirector()->replaceScene(this);
}

View File

@ -1,26 +1,26 @@
#ifndef __MUTITOUCHTEST_H__
#define __MUTITOUCHTEST_H__
#include "../testBasic.h"
class MutiTouchTestLayer : public CCLayer
{
public:
bool init();
virtual void registerWithTouchDispatcher(void);
virtual void ccTouchesBegan(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
virtual void ccTouchesMoved(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
virtual void ccTouchesEnded(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
virtual void ccTouchesCancelled(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
LAYER_NODE_FUNC(MutiTouchTestLayer)
};
class MutiTouchTestScene : public TestScene
{
public:
virtual void runThisTest();
};
#endif /* __MUTITOUCHTEST_H__ */
#ifndef __MUTITOUCHTEST_H__
#define __MUTITOUCHTEST_H__
#include "../testBasic.h"
class MutiTouchTestLayer : public CCLayer
{
public:
bool init();
virtual void registerWithTouchDispatcher(void);
virtual void ccTouchesBegan(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
virtual void ccTouchesMoved(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
virtual void ccTouchesEnded(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
virtual void ccTouchesCancelled(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
LAYER_NODE_FUNC(MutiTouchTestLayer)
};
class MutiTouchTestScene : public TestScene
{
public:
virtual void runThisTest();
};
#endif /* __MUTITOUCHTEST_H__ */