Merge branch 'master' into LinuxPort

This commit is contained in:
laschweinski 2011-08-19 13:20:23 +08:00
commit 871abb4a32
116 changed files with 954 additions and 783 deletions

21
AUTHORS
View File

@ -10,20 +10,27 @@ Core Developers:
RongHong Huang RongHong Huang
Developers: Developers:
Dumganhar ZhuoShi Shun
author of Bada port contribute the lua binding of CocosDenshion
Carlos Sessa Jirka Fajfr
implement the accelerometer module onto Android Chris Calm
authors of CCTexturePVR
Max Aksenov
author and maintainer of Marmalade(Airplay) port
RuiXiang Zhou RuiXiang Zhou
XiDi Peng XiDi Peng
AiYu Ye AiYu Ye
authors of lua binding authors of lua binding
Max Aksenov
author and maintainer of Marmalade(Airplay) port
Carlos Sessa
implement the accelerometer module onto Android
Dumganhar
author of Bada port
Cocos2d-x can not grow so fast without the active community. Cocos2d-x can not grow so fast without the active community.
Thanks to all developers who report & trace bugs, dicuss the engine usage in forum & QQ groups! Thanks to all developers who report & trace bugs, dicuss the engine usage in forum & QQ groups!
Special thanks to Ricardo Quesada for giving us lots of guidances & suggestions. Special thanks to Ricardo Quesada for giving us lots of guidances & suggestions.

View File

@ -1,3 +1,59 @@
cocos2d-1.0.1-x-0.9.1 @ Aug.17,2011
[all platforms]
Feature #347 Support custom TTF fonts
Feature #536 Support PVR Texture
Feature #645 update to cocos2d-iphone v1.0.1
Feature #633 allow SimpleAudioEngine::playEffect repeatly
Feature #630 implement CCRenderTexture::saveBuffer method
Feature #613 Call executeCallFuncN instead of executeCallFunc in CCMenuItem::active()
Feature #620 add Texture2d test case
Feature #638 Add support for per ccz format
Feature #641 users can CCRenderTexture::saveBuffer to any path
Feature #643 swap Accelerometer input x/y according to the orientation
Feature #665 add test case for CCRenderTexture::saveBuffer
Bug #513 CCProgressTimer doesn't work with CCspriteFrameCache
Bug #609 Retain & Release CCObject in CCSet
Bug #628 CCMutableArray::arrayWithObjects should autorelease array object
Bug #629 pass eImgFmt to initWithImageData in initWithImageFile
Bug #636 CCTextureCache::textureForKey() can't find the right texture
Bug #639 m_PositionInPixels isn't correctly initialized
Bug #640 the image read from render texture is upseted
Bug #644 CCSpriteBatchNode::removeAllChildrenWithCleanup() not work as expected
Bug #680 CCtouchDispatcher::rearrangeHandlers() crash
Refactor #623 refactor Cocos2dJni.cpp
Refactor #652 refactor char* JniHelper::jstringtochar()
Document #622 comment CCUserDefault in doxygen format
Document #651 add CCFileUtils to oxygen api document
[lua]
Feature #679 bind lua to CocosDenshion
Feature #647 add a method to set search path of lua script
Feature #611 Add some methods in CCMenuItemLabel & CCMenuItemToggle for lua
Feature #612 Export CCNode::getContentSizeInPixels & setContentSizeInPixels to lua
Feature #653 add CCScheduler::unscheduleScriptFunc
Bug #615 CCLOG may crash in LuaEngineImpl
[android]
Feature #610 Remove the support of ndk-r4 crystax.net version
Bug #608 CCRenderTexture cannot show textures after sleep and wake-up
Bug #618 HelloWorld & Tests crash when X is clicked
Bug #619 CCFadeTo may crash on android
Bug #624 CCLabelTTF::setString("\n\n\n") crashes on android
Bug #625 test_image_rgba4444.pvr.gz can not packed into app
Bug #631 TextInputTest crash when input nothing
Bug #637 Create resources folder instead of resource in create-android-project.sh
Bug #648 CCRenderTexture::saveBuffer may crash on some devices like Moto Defy
Bug #655 CCLabelTTF doesn't draw all characters, it may lost the last char
Refactor #656 refactor CCFileUtils, make it support reading data from directory other than assets
[ios]
Feature #642 CCImage_ios.mm should be modified for saving image
Feature #658 xcode3 template should create AppDelegate.cpp/.h instead of ${PROJECT_NAME}AppDelegate.cpp/.h
Feature #661 fix TMXTiledMap for iPhone Retina mode
Bug #667 AppDelegate::applicationDidEnterBackground isn't invoked on iOS
Bug #668 CCLabelBMFont display 4 characters in a square per character block in retina mode
[win32]
Feature #620 change lua library to static lib
Feature #632 Update visual studio template for lua support
cocos2d-1.0.0-x-0.9.0 @ Jul.14,2011 cocos2d-1.0.0-x-0.9.0 @ Jul.14,2011
[all platforms] [all platforms]
Feature #584 sync with cocos2d-iphone v1.0.0 Feature #584 sync with cocos2d-iphone v1.0.0

View File

@ -1,8 +1,10 @@
#include "AppDelegate.h" #include "AppDelegate.h"
#include "cocos2d.h" #include "cocos2d.h"
#include "SimpleAudioEngine.h"
USING_NS_CC; USING_NS_CC;
using namespace CocosDenshion;
AppDelegate::AppDelegate() AppDelegate::AppDelegate()
:m_pLuaEngine(NULL) :m_pLuaEngine(NULL)
@ -11,6 +13,8 @@ AppDelegate::AppDelegate()
AppDelegate::~AppDelegate() AppDelegate::~AppDelegate()
{ {
// end simple audio engine here, or it may crashed on win32
SimpleAudioEngine::sharedEngine()->end();
CCScriptEngineManager::sharedScriptEngineManager()->removeScriptEngine(); CCScriptEngineManager::sharedScriptEngineManager()->removeScriptEngine();
CC_SAFE_DELETE(m_pLuaEngine); CC_SAFE_DELETE(m_pLuaEngine);
} }

View File

@ -118,7 +118,7 @@ layerMenu:addChild(menuPopup)
function menuCallbackOpenPopup() function menuCallbackOpenPopup()
-- loop test sound effect -- loop test sound effect
-- NOTE: effectID is global, so it can be used to stop -- NOTE: effectID is global, so it can be used to stop
effectID = CocosDenshion.SimpleAudioEngine:sharedEngine():playEffect("effect1.wav", true) effectID = CocosDenshion.SimpleAudioEngine:sharedEngine():playEffect("effect1.wav")
menuPopup:setIsVisible(true) menuPopup:setIsVisible(true)
end end
@ -146,8 +146,9 @@ end
cocos2d.CCScheduler:sharedScheduler():scheduleScriptFunc("tick", 0.01, false) cocos2d.CCScheduler:sharedScheduler():scheduleScriptFunc("tick", 0.01, false)
-- run
-- play background music -- play background music
CocosDenshion.SimpleAudioEngine:sharedEngine():playBackgroundMusic("background.mp3", true); CocosDenshion.SimpleAudioEngine:sharedEngine():playBackgroundMusic("background.mp3", true);
-- preload effect
CocosDenshion.SimpleAudioEngine:sharedEngine():preloadEffect("effect1.wav");
-- run
cocos2d.CCDirector:sharedDirector():runWithScene(sceneGame) cocos2d.CCDirector:sharedDirector():runWithScene(sceneGame)

View File

@ -1 +1 @@
eabe18b3bb242fd5280e068546c08189eaed4f55 5aad4711f8c4040a3bfef0c18ca11e79718ccb0f

View File

@ -135,7 +135,7 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\Classes;&quot;$(SolutionDir)lua\cocos2dx_support&quot;;&quot;.$(SolutionDir)\lua\CocosDenshion_support&quot;;&quot;$(SolutionDir)lua\tolua&quot;;&quot;$(SolutionDir)lua\lua&quot;;&quot;$(SolutionDir)cocos2dx&quot;;&quot;$(SolutionDir)cocos2dx\include&quot;;&quot;$(SolutionDir)cocos2dx\platform&quot;;&quot;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES&quot;;&quot;$(SolutionDir)CocosDenshion\Include&quot;" AdditionalIncludeDirectories="..\Classes;&quot;$(SolutionDir)lua\cocos2dx_support&quot;;&quot;$(SolutionDir)lua\CocosDenshion_support&quot;;&quot;$(SolutionDir)lua\tolua&quot;;&quot;$(SolutionDir)lua\lua&quot;;&quot;$(SolutionDir)cocos2dx&quot;;&quot;$(SolutionDir)cocos2dx\include&quot;;&quot;$(SolutionDir)cocos2dx\platform&quot;;&quot;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES&quot;;&quot;$(SolutionDir)CocosDenshion\Include&quot;"
PreprocessorDefinitions="WIN32;_WINDOWS;STRICT;NDEBUG" PreprocessorDefinitions="WIN32;_WINDOWS;STRICT;NDEBUG"
ExceptionHandling="0" ExceptionHandling="0"
RuntimeLibrary="2" RuntimeLibrary="2"

View File

@ -26,6 +26,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloLua", "HelloLua\win32\
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{DDC3E27F-004D-4DD4-9DD3-931A013D2159} = {DDC3E27F-004D-4DD4-9DD3-931A013D2159} {DDC3E27F-004D-4DD4-9DD3-931A013D2159} = {DDC3E27F-004D-4DD4-9DD3-931A013D2159}
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblua", "lua\proj.win32\liblua.vcproj", "{DDC3E27F-004D-4DD4-9DD3-931A013D2159}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblua", "lua\proj.win32\liblua.vcproj", "{DDC3E27F-004D-4DD4-9DD3-931A013D2159}"

View File

@ -14,6 +14,9 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "tests\test.win32\test.win32.vcxproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "tests\test.win32\test.win32.vcxproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloLua", "HelloLua\win32\HelloLua.win32.vcxproj", "{13E55395-94A2-4CD9-BFC2-1A051F80C17D}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloLua", "HelloLua\win32\HelloLua.win32.vcxproj", "{13E55395-94A2-4CD9-BFC2-1A051F80C17D}"
ProjectSection(ProjectDependencies) = postProject
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblua", "lua\proj.win32\liblua.vcxproj", "{DDC3E27F-004D-4DD4-9DD3-931A013D2159}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblua", "lua\proj.win32\liblua.vcxproj", "{DDC3E27F-004D-4DD4-9DD3-931A013D2159}"
EndProject EndProject

View File

@ -393,7 +393,7 @@ void CCDirector::setDepthTest(bool bOn)
} }
} }
CCPoint CCDirector::convertToGL(CCPoint obPoint) CCPoint CCDirector::convertToGL(const CCPoint& obPoint)
{ {
CCSize s = m_obWinSizeInPoints; CCSize s = m_obWinSizeInPoints;
float newY = s.height - obPoint.y; float newY = s.height - obPoint.y;
@ -421,7 +421,7 @@ CCPoint CCDirector::convertToGL(CCPoint obPoint)
return ret; return ret;
} }
CCPoint CCDirector::convertToUI(CCPoint obPoint) CCPoint CCDirector::convertToUI(const CCPoint& obPoint)
{ {
CCSize winSize = m_obWinSizeInPoints; CCSize winSize = m_obWinSizeInPoints;
float oppositeX = winSize.width - obPoint.x; float oppositeX = winSize.width - obPoint.x;
@ -480,7 +480,7 @@ CCSize CCDirector::getDisplaySizeInPixels(void)
return m_obWinSizeInPixels; return m_obWinSizeInPixels;
} }
void CCDirector::reshapeProjection(CCSize newWindowSize) void CCDirector::reshapeProjection(const CCSize& newWindowSize)
{ {
CC_UNUSED_PARAM(newWindowSize); CC_UNUSED_PARAM(newWindowSize);
m_obWinSizeInPoints = m_pobOpenGLView->getSize(); m_obWinSizeInPoints = m_pobOpenGLView->getSize();

View File

@ -39,7 +39,7 @@ THE SOFTWARE.
namespace cocos2d { namespace cocos2d {
void ccDrawPoint(CCPoint point) void ccDrawPoint(const CCPoint& point)
{ {
ccVertex2F p = {point.x * CC_CONTENT_SCALE_FACTOR(), point.y * CC_CONTENT_SCALE_FACTOR() }; ccVertex2F p = {point.x * CC_CONTENT_SCALE_FACTOR(), point.y * CC_CONTENT_SCALE_FACTOR() };
// Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
@ -112,7 +112,7 @@ void ccDrawPoints(const CCPoint *points, unsigned int numberOfPoints)
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
} }
void ccDrawLine(CCPoint origin, CCPoint destination) void ccDrawLine(const CCPoint& origin, const CCPoint& destination)
{ {
ccVertex2F vertices[2] = ccVertex2F vertices[2] =
{ {
@ -204,7 +204,7 @@ void ccDrawPoly(const CCPoint *poli, int numberOfPoints, bool closePolygon)
delete[] newPoint; delete[] newPoint;
} }
void ccDrawCircle(CCPoint center, float r, float a, int segs, bool drawLineToCenter) void ccDrawCircle(const CCPoint& center, float r, float a, int segs, bool drawLineToCenter)
{ {
int additionalSegment = 1; int additionalSegment = 1;
if (drawLineToCenter) if (drawLineToCenter)
@ -252,7 +252,7 @@ void ccDrawCircle(CCPoint center, float r, float a, int segs, bool drawLineToCen
delete[] vertices; // free(vertices); delete[] vertices; // free(vertices);
} }
void ccDrawQuadBezier(CCPoint origin, CCPoint control, CCPoint destination, int segments) void ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, int segments)
{ {
CCPoint *vertices = new CCPoint[segments + 1]; CCPoint *vertices = new CCPoint[segments + 1];
@ -283,7 +283,7 @@ void ccDrawQuadBezier(CCPoint origin, CCPoint control, CCPoint destination, int
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
} }
void ccDrawCubicBezier(CCPoint origin, CCPoint control1, CCPoint control2, CCPoint destination, int segments) void ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, int segments)
{ {
CCPoint *vertices = new CCPoint[segments + 1]; CCPoint *vertices = new CCPoint[segments + 1];

View File

@ -121,7 +121,7 @@ CCTimer* CCTimer::timerWithTarget(SelectorProtocol *pTarget, SEL_SCHEDULE pfnSel
return pTimer; return pTimer;
} }
bool CCTimer::initWithScriptFuncName(const char *pszFuncName, cocos2d::ccTime fSeconds) bool CCTimer::initWithScriptFuncName(const char *pszFuncName, ccTime fSeconds)
{ {
m_scriptFunc = string(pszFuncName); m_scriptFunc = string(pszFuncName);
m_fInterval = fSeconds; m_fInterval = fSeconds;

View File

@ -221,7 +221,7 @@ CCFollow *CCFollow::actionWithTarget(CCNode *pFollowedNode)
CC_SAFE_DELETE(pRet) CC_SAFE_DELETE(pRet)
return NULL; return NULL;
} }
CCFollow *CCFollow::actionWithTarget(CCNode *pFollowedNode, CCRect rect) CCFollow *CCFollow::actionWithTarget(CCNode *pFollowedNode, const CCRect& rect)
{ {
CCFollow *pRet = new CCFollow(); CCFollow *pRet = new CCFollow();
if (pRet && pRet->initWithTarget(pFollowedNode, rect)) if (pRet && pRet->initWithTarget(pFollowedNode, rect))
@ -247,7 +247,7 @@ bool CCFollow::initWithTarget(CCNode *pFollowedNode)
return true; return true;
} }
bool CCFollow::initWithTarget(CCNode *pFollowedNode, CCRect rect) bool CCFollow::initWithTarget(CCNode *pFollowedNode, const CCRect& rect)
{ {
assert(pFollowedNode != NULL); assert(pFollowedNode != NULL);
pFollowedNode->retain(); pFollowedNode->retain();

View File

@ -42,7 +42,7 @@ namespace cocos2d {
// //
// EaseAction // EaseAction
// //
CCActionEase* CCActionEase::actionWithAction(cocos2d::CCActionInterval *pAction) CCActionEase* CCActionEase::actionWithAction(CCActionInterval *pAction)
{ {
CCActionEase *pRet = new CCActionEase(); CCActionEase *pRet = new CCActionEase();
if (pRet) if (pRet)
@ -60,7 +60,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
bool CCActionEase::initWithAction(cocos2d::CCActionInterval *pAction) bool CCActionEase::initWithAction(CCActionInterval *pAction)
{ {
assert(pAction != NULL); assert(pAction != NULL);
@ -75,7 +75,7 @@ namespace cocos2d {
return false; return false;
} }
CCObject* CCActionEase::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCActionEase::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCActionEase* pCopy = NULL; CCActionEase* pCopy = NULL;
@ -115,7 +115,7 @@ namespace cocos2d {
CCActionInterval::stop(); CCActionInterval::stop();
} }
void CCActionEase::update(cocos2d::ccTime time) void CCActionEase::update(ccTime time)
{ {
m_pOther->update(time); m_pOther->update(time);
} }
@ -128,7 +128,7 @@ namespace cocos2d {
// //
// EaseRateAction // EaseRateAction
// //
CCEaseRateAction* CCEaseRateAction::actionWithAction(cocos2d::CCActionInterval *pAction, float fRate) CCEaseRateAction* CCEaseRateAction::actionWithAction(CCActionInterval *pAction, float fRate)
{ {
CCEaseRateAction *pRet = new CCEaseRateAction(); CCEaseRateAction *pRet = new CCEaseRateAction();
if (pRet) if (pRet)
@ -146,7 +146,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
bool CCEaseRateAction::initWithAction(cocos2d::CCActionInterval *pAction, float fRate) bool CCEaseRateAction::initWithAction(CCActionInterval *pAction, float fRate)
{ {
if (CCActionEase::initWithAction(pAction)) if (CCActionEase::initWithAction(pAction))
{ {
@ -157,7 +157,7 @@ namespace cocos2d {
return false; return false;
} }
CCObject* CCEaseRateAction::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseRateAction::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseRateAction* pCopy = NULL; CCEaseRateAction* pCopy = NULL;
@ -190,7 +190,7 @@ namespace cocos2d {
// //
// EeseIn // EeseIn
// //
CCEaseIn* CCEaseIn::actionWithAction(cocos2d::CCActionInterval *pAction, float fRate) CCEaseIn* CCEaseIn::actionWithAction(CCActionInterval *pAction, float fRate)
{ {
CCEaseIn *pRet = new CCEaseIn(); CCEaseIn *pRet = new CCEaseIn();
if (pRet) if (pRet)
@ -208,7 +208,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseIn::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseIn::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseIn* pCopy = NULL; CCEaseIn* pCopy = NULL;
@ -229,7 +229,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseIn::update(cocos2d::ccTime time) void CCEaseIn::update(ccTime time)
{ {
m_pOther->update(powf(time, m_fRate)); m_pOther->update(powf(time, m_fRate));
} }
@ -237,7 +237,7 @@ namespace cocos2d {
// //
// EaseOut // EaseOut
// //
CCEaseOut* CCEaseOut::actionWithAction(cocos2d::CCActionInterval *pAction, float fRate) CCEaseOut* CCEaseOut::actionWithAction(CCActionInterval *pAction, float fRate)
{ {
CCEaseOut *pRet = new CCEaseOut(); CCEaseOut *pRet = new CCEaseOut();
if (pRet) if (pRet)
@ -255,7 +255,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseOut::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseOut::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseOut* pCopy = NULL; CCEaseOut* pCopy = NULL;
@ -276,7 +276,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseOut::update(cocos2d::ccTime time) void CCEaseOut::update(ccTime time)
{ {
m_pOther->update(powf(time, 1 / m_fRate)); m_pOther->update(powf(time, 1 / m_fRate));
} }
@ -284,7 +284,7 @@ namespace cocos2d {
// //
// EaseInOut // EaseInOut
// //
CCEaseInOut* CCEaseInOut::actionWithAction(cocos2d::CCActionInterval *pAction, float fRate) CCEaseInOut* CCEaseInOut::actionWithAction(CCActionInterval *pAction, float fRate)
{ {
CCEaseInOut *pRet = new CCEaseInOut(); CCEaseInOut *pRet = new CCEaseInOut();
if (pRet) if (pRet)
@ -302,7 +302,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseInOut::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseInOut::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseInOut* pCopy = NULL; CCEaseInOut* pCopy = NULL;
@ -323,7 +323,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseInOut::update(cocos2d::ccTime time) void CCEaseInOut::update(ccTime time)
{ {
int sign = 1; int sign = 1;
int r = (int) m_fRate; int r = (int) m_fRate;
@ -371,7 +371,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseExponentialIn::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseExponentialIn::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseExponentialIn* pCopy = NULL; CCEaseExponentialIn* pCopy = NULL;
@ -392,7 +392,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseExponentialIn::update(cocos2d::ccTime time) void CCEaseExponentialIn::update(ccTime time)
{ {
m_pOther->update(time == 0 ? 0 : powf(2, 10 * (time/1 - 1)) - 1 * 0.001f); m_pOther->update(time == 0 ? 0 : powf(2, 10 * (time/1 - 1)) - 1 * 0.001f);
} }
@ -423,7 +423,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseExponentialOut::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseExponentialOut::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseExponentialOut* pCopy = NULL; CCEaseExponentialOut* pCopy = NULL;
@ -444,7 +444,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseExponentialOut::update(cocos2d::ccTime time) void CCEaseExponentialOut::update(ccTime time)
{ {
m_pOther->update(time == 1 ? 1 : (-powf(2, -10 * time / 1) + 1)); m_pOther->update(time == 1 ? 1 : (-powf(2, -10 * time / 1) + 1));
} }
@ -457,7 +457,7 @@ namespace cocos2d {
// //
// EaseExponentialInOut // EaseExponentialInOut
// //
CCEaseExponentialInOut* CCEaseExponentialInOut::actionWithAction(cocos2d::CCActionInterval *pAction) CCEaseExponentialInOut* CCEaseExponentialInOut::actionWithAction(CCActionInterval *pAction)
{ {
CCEaseExponentialInOut *pRet = new CCEaseExponentialInOut(); CCEaseExponentialInOut *pRet = new CCEaseExponentialInOut();
if (pRet) if (pRet)
@ -475,7 +475,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseExponentialInOut::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseExponentialInOut::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseExponentialInOut* pCopy = NULL; CCEaseExponentialInOut* pCopy = NULL;
@ -496,7 +496,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseExponentialInOut::update(cocos2d::ccTime time) void CCEaseExponentialInOut::update(ccTime time)
{ {
time /= 0.5f; time /= 0.5f;
if (time < 1) if (time < 1)
@ -532,7 +532,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseSineIn::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseSineIn::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseSineIn* pCopy = NULL; CCEaseSineIn* pCopy = NULL;
@ -553,7 +553,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseSineIn::update(cocos2d::ccTime time) void CCEaseSineIn::update(ccTime time)
{ {
m_pOther->update(-1 * cosf(time * (float)M_PI_2) + 1); m_pOther->update(-1 * cosf(time * (float)M_PI_2) + 1);
} }
@ -584,7 +584,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseSineOut::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseSineOut::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseSineOut* pCopy = NULL; CCEaseSineOut* pCopy = NULL;
@ -605,7 +605,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseSineOut::update(cocos2d::ccTime time) void CCEaseSineOut::update(ccTime time)
{ {
m_pOther->update(sinf(time * (float)M_PI_2)); m_pOther->update(sinf(time * (float)M_PI_2));
} }
@ -636,7 +636,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseSineInOut::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseSineInOut::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseSineInOut* pCopy = NULL; CCEaseSineInOut* pCopy = NULL;
@ -657,7 +657,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseSineInOut::update(cocos2d::ccTime time) void CCEaseSineInOut::update(ccTime time)
{ {
m_pOther->update(-0.5f * (cosf((float)M_PI * time) - 1)); m_pOther->update(-0.5f * (cosf((float)M_PI * time) - 1));
} }
@ -665,7 +665,7 @@ namespace cocos2d {
// //
// EaseElastic // EaseElastic
// //
CCEaseElastic* CCEaseElastic::actionWithAction(cocos2d::CCActionInterval *pAction) CCEaseElastic* CCEaseElastic::actionWithAction(CCActionInterval *pAction)
{ {
CCEaseElastic *pRet = new CCEaseElastic(); CCEaseElastic *pRet = new CCEaseElastic();
if (pRet) if (pRet)
@ -683,7 +683,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCEaseElastic* CCEaseElastic::actionWithAction(cocos2d::CCActionInterval *pAction, float fPeriod) CCEaseElastic* CCEaseElastic::actionWithAction(CCActionInterval *pAction, float fPeriod)
{ {
CCEaseElastic *pRet = new CCEaseElastic(); CCEaseElastic *pRet = new CCEaseElastic();
if (pRet) if (pRet)
@ -701,12 +701,12 @@ namespace cocos2d {
return pRet; return pRet;
} }
bool CCEaseElastic::initWithAction(cocos2d::CCActionInterval *pAction) bool CCEaseElastic::initWithAction(CCActionInterval *pAction)
{ {
return initWithAction(pAction, 0.3f); return initWithAction(pAction, 0.3f);
} }
bool CCEaseElastic::initWithAction(cocos2d::CCActionInterval *pAction, float fPeriod) bool CCEaseElastic::initWithAction(CCActionInterval *pAction, float fPeriod)
{ {
if (CCActionEase::initWithAction(pAction)) if (CCActionEase::initWithAction(pAction))
{ {
@ -717,7 +717,7 @@ namespace cocos2d {
return false; return false;
} }
CCObject* CCEaseElastic::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseElastic::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseElastic* pCopy = NULL; CCEaseElastic* pCopy = NULL;
@ -784,7 +784,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseElasticIn::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseElasticIn::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseElasticIn* pCopy = NULL; CCEaseElasticIn* pCopy = NULL;
@ -805,7 +805,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseElasticIn::update(cocos2d::ccTime time) void CCEaseElasticIn::update(ccTime time)
{ {
ccTime newT = 0; ccTime newT = 0;
if (time == 0 || time == 1) if (time == 0 || time == 1)
@ -866,7 +866,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject *CCEaseElasticOut::copyWithZone(cocos2d::CCZone *pZone) CCObject *CCEaseElasticOut::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseElasticOut* pCopy = NULL; CCEaseElasticOut* pCopy = NULL;
@ -887,7 +887,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseElasticOut::update(cocos2d::ccTime time) void CCEaseElasticOut::update(ccTime time)
{ {
ccTime newT = 0; ccTime newT = 0;
if (time == 0 || time == 1) if (time == 0 || time == 1)
@ -947,7 +947,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseElasticInOut::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseElasticInOut::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseElasticInOut* pCopy = NULL; CCEaseElasticInOut* pCopy = NULL;
@ -969,7 +969,7 @@ namespace cocos2d {
} }
void CCEaseElasticInOut::update(cocos2d::ccTime time) void CCEaseElasticInOut::update(ccTime time)
{ {
ccTime newT = 0; ccTime newT = 0;
if (time == 0 || time == 1) if (time == 0 || time == 1)
@ -1026,7 +1026,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseBounce::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseBounce::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseBounce* pCopy = NULL; CCEaseBounce* pCopy = NULL;
@ -1047,7 +1047,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
ccTime CCEaseBounce::bounceTime(cocos2d::ccTime time) ccTime CCEaseBounce::bounceTime(ccTime time)
{ {
if (time < 1 / 2.75) if (time < 1 / 2.75)
{ {
@ -1089,7 +1089,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseBounceIn::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseBounceIn::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseBounceIn* pCopy = NULL; CCEaseBounceIn* pCopy = NULL;
@ -1110,7 +1110,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseBounceIn::update(cocos2d::ccTime time) void CCEaseBounceIn::update(ccTime time)
{ {
ccTime newT = 1 - bounceTime(1 - time); ccTime newT = 1 - bounceTime(1 - time);
m_pOther->update(newT); m_pOther->update(newT);
@ -1142,7 +1142,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseBounceOut::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseBounceOut::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseBounceOut* pCopy = NULL; CCEaseBounceOut* pCopy = NULL;
@ -1163,7 +1163,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseBounceOut::update(cocos2d::ccTime time) void CCEaseBounceOut::update(ccTime time)
{ {
ccTime newT = bounceTime(time); ccTime newT = bounceTime(time);
m_pOther->update(newT); m_pOther->update(newT);
@ -1195,7 +1195,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseBounceInOut::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseBounceInOut::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseBounceInOut* pCopy = NULL; CCEaseBounceInOut* pCopy = NULL;
@ -1216,7 +1216,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseBounceInOut::update(cocos2d::ccTime time) void CCEaseBounceInOut::update(ccTime time)
{ {
ccTime newT = 0; ccTime newT = 0;
if (time < 0.5f) if (time < 0.5f)
@ -1235,7 +1235,7 @@ namespace cocos2d {
// //
// EaseBackIn // EaseBackIn
// //
CCEaseBackIn* CCEaseBackIn::actionWithAction(cocos2d::CCActionInterval *pAction) CCEaseBackIn* CCEaseBackIn::actionWithAction(CCActionInterval *pAction)
{ {
CCEaseBackIn *pRet = new CCEaseBackIn(); CCEaseBackIn *pRet = new CCEaseBackIn();
if (pRet) if (pRet)
@ -1253,7 +1253,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseBackIn::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseBackIn::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseBackIn* pCopy = NULL; CCEaseBackIn* pCopy = NULL;
@ -1274,7 +1274,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseBackIn::update(cocos2d::ccTime time) void CCEaseBackIn::update(ccTime time)
{ {
ccTime overshoot = 1.70158f; ccTime overshoot = 1.70158f;
m_pOther->update(time * time * ((overshoot + 1) * time - overshoot)); m_pOther->update(time * time * ((overshoot + 1) * time - overshoot));
@ -1306,7 +1306,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseBackOut::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseBackOut::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseBackOut* pCopy = NULL; CCEaseBackOut* pCopy = NULL;
@ -1327,7 +1327,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseBackOut::update(cocos2d::ccTime time) void CCEaseBackOut::update(ccTime time)
{ {
ccTime overshoot = 1.70158f; ccTime overshoot = 1.70158f;
@ -1361,7 +1361,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
CCObject* CCEaseBackInOut::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCEaseBackInOut::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCEaseBackInOut* pCopy = NULL; CCEaseBackInOut* pCopy = NULL;
@ -1382,7 +1382,7 @@ namespace cocos2d {
return pCopy; return pCopy;
} }
void CCEaseBackInOut::update(cocos2d::ccTime time) void CCEaseBackInOut::update(ccTime time)
{ {
ccTime overshoot = 1.70158f * 1.525f; ccTime overshoot = 1.70158f * 1.525f;

View File

@ -30,7 +30,7 @@ namespace cocos2d
{ {
// implementation of CCGridAction // implementation of CCGridAction
CCGridAction* CCGridAction::actionWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) CCGridAction* CCGridAction::actionWithSize(const ccGridSize& gridSize, ccTime duration)
{ {
CCGridAction *pAction = new CCGridAction(); CCGridAction *pAction = new CCGridAction();
if (pAction) if (pAction)
@ -48,7 +48,7 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCGridAction::initWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) bool CCGridAction::initWithSize(const ccGridSize& gridSize, ccTime duration)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -106,7 +106,7 @@ namespace cocos2d
return CCReverseTime::actionWithAction(this); return CCReverseTime::actionWithAction(this);
} }
CCObject* CCGridAction::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCGridAction::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCGridAction* pCopy = NULL; CCGridAction* pCopy = NULL;
@ -136,19 +136,19 @@ namespace cocos2d
return CCGrid3D::gridWithSize(m_sGridSize); return CCGrid3D::gridWithSize(m_sGridSize);
} }
ccVertex3F CCGrid3DAction::vertex(cocos2d::ccGridSize pos) ccVertex3F CCGrid3DAction::vertex(const ccGridSize& pos)
{ {
CCGrid3D *g = (CCGrid3D*)m_pTarget->getGrid(); CCGrid3D *g = (CCGrid3D*)m_pTarget->getGrid();
return g->vertex(pos); return g->vertex(pos);
} }
ccVertex3F CCGrid3DAction::originalVertex(cocos2d::ccGridSize pos) ccVertex3F CCGrid3DAction::originalVertex(const ccGridSize& pos)
{ {
CCGrid3D *g = (CCGrid3D*)m_pTarget->getGrid(); CCGrid3D *g = (CCGrid3D*)m_pTarget->getGrid();
return g->originalVertex(pos); return g->originalVertex(pos);
} }
void CCGrid3DAction::setVertex(cocos2d::ccGridSize pos, cocos2d::ccVertex3F vertex) void CCGrid3DAction::setVertex(const ccGridSize& pos, const ccVertex3F& vertex)
{ {
CCGrid3D *g = (CCGrid3D*)m_pTarget->getGrid(); CCGrid3D *g = (CCGrid3D*)m_pTarget->getGrid();
g->setVertex(pos, vertex); g->setVertex(pos, vertex);
@ -161,19 +161,19 @@ namespace cocos2d
return CCTiledGrid3D::gridWithSize(m_sGridSize); return CCTiledGrid3D::gridWithSize(m_sGridSize);
} }
ccQuad3 CCTiledGrid3DAction::tile(cocos2d::ccGridSize pos) ccQuad3 CCTiledGrid3DAction::tile(const ccGridSize& pos)
{ {
CCTiledGrid3D *g = (CCTiledGrid3D*)m_pTarget->getGrid(); CCTiledGrid3D *g = (CCTiledGrid3D*)m_pTarget->getGrid();
return g->tile(pos); return g->tile(pos);
} }
ccQuad3 CCTiledGrid3DAction::originalTile(cocos2d::ccGridSize pos) ccQuad3 CCTiledGrid3DAction::originalTile(const ccGridSize& pos)
{ {
CCTiledGrid3D *g = (CCTiledGrid3D*)m_pTarget->getGrid(); CCTiledGrid3D *g = (CCTiledGrid3D*)m_pTarget->getGrid();
return g->originalTile(pos); return g->originalTile(pos);
} }
void CCTiledGrid3DAction::setTile(cocos2d::ccGridSize pos, cocos2d::ccQuad3 coords) void CCTiledGrid3DAction::setTile(const ccGridSize& pos, const ccQuad3& coords)
{ {
CCTiledGrid3D *g = (CCTiledGrid3D*)m_pTarget->getGrid(); CCTiledGrid3D *g = (CCTiledGrid3D*)m_pTarget->getGrid();
return g->setTile(pos, coords); return g->setTile(pos, coords);
@ -181,7 +181,7 @@ namespace cocos2d
// implementation CCAccelDeccelAmplitude // implementation CCAccelDeccelAmplitude
CCAccelDeccelAmplitude* CCAccelDeccelAmplitude::actionWithAction(cocos2d::CCAction *pAction, cocos2d::ccTime duration) CCAccelDeccelAmplitude* CCAccelDeccelAmplitude::actionWithAction(CCAction *pAction, ccTime duration)
{ {
CCAccelDeccelAmplitude *pRet = new CCAccelDeccelAmplitude(); CCAccelDeccelAmplitude *pRet = new CCAccelDeccelAmplitude();
if (pRet) if (pRet)
@ -199,7 +199,7 @@ namespace cocos2d
return pRet; return pRet;
} }
bool CCAccelDeccelAmplitude::initWithAction(cocos2d::CCAction *pAction, cocos2d::ccTime duration) bool CCAccelDeccelAmplitude::initWithAction(CCAction *pAction, ccTime duration)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -224,7 +224,7 @@ namespace cocos2d
m_pOther->startWithTarget(pTarget); m_pOther->startWithTarget(pTarget);
} }
void CCAccelDeccelAmplitude::update(cocos2d::ccTime time) void CCAccelDeccelAmplitude::update(ccTime time)
{ {
float f = time * 2; float f = time * 2;
@ -244,7 +244,7 @@ namespace cocos2d
// implementation of AccelAmplitude // implementation of AccelAmplitude
CCAccelAmplitude* CCAccelAmplitude::actionWithAction(cocos2d::CCAction *pAction, cocos2d::ccTime duration) CCAccelAmplitude* CCAccelAmplitude::actionWithAction(CCAction *pAction, ccTime duration)
{ {
CCAccelAmplitude *pRet = new CCAccelAmplitude(); CCAccelAmplitude *pRet = new CCAccelAmplitude();
if (pRet) if (pRet)
@ -262,7 +262,7 @@ namespace cocos2d
return pRet; return pRet;
} }
bool CCAccelAmplitude::initWithAction(cocos2d::CCAction *pAction, cocos2d::ccTime duration) bool CCAccelAmplitude::initWithAction(CCAction *pAction, ccTime duration)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -287,7 +287,7 @@ namespace cocos2d
m_pOther->startWithTarget(pTarget); m_pOther->startWithTarget(pTarget);
} }
void CCAccelAmplitude::update(cocos2d::ccTime time) void CCAccelAmplitude::update(ccTime time)
{ {
((CCAccelAmplitude*)(m_pOther))->setAmplitudeRate(powf(time, m_fRate)); ((CCAccelAmplitude*)(m_pOther))->setAmplitudeRate(powf(time, m_fRate));
m_pOther->update(time); m_pOther->update(time);
@ -300,7 +300,7 @@ namespace cocos2d
// DeccelAmplitude // DeccelAmplitude
CCDeccelAmplitude* CCDeccelAmplitude::actionWithAction(cocos2d::CCAction *pAction, cocos2d::ccTime duration) CCDeccelAmplitude* CCDeccelAmplitude::actionWithAction(CCAction *pAction, ccTime duration)
{ {
CCDeccelAmplitude *pRet = new CCDeccelAmplitude(); CCDeccelAmplitude *pRet = new CCDeccelAmplitude();
if (pRet) if (pRet)
@ -318,7 +318,7 @@ namespace cocos2d
return pRet; return pRet;
} }
bool CCDeccelAmplitude::initWithAction(cocos2d::CCAction *pAction, cocos2d::ccTime duration) bool CCDeccelAmplitude::initWithAction(CCAction *pAction, ccTime duration)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -343,7 +343,7 @@ namespace cocos2d
m_pOther->startWithTarget(pTarget); m_pOther->startWithTarget(pTarget);
} }
void CCDeccelAmplitude::update(cocos2d::ccTime time) void CCDeccelAmplitude::update(ccTime time)
{ {
((CCDeccelAmplitude*)(m_pOther))->setAmplitudeRate(powf((1 - time), m_fRate)); ((CCDeccelAmplitude*)(m_pOther))->setAmplitudeRate(powf((1 - time), m_fRate));
m_pOther->update(time); m_pOther->update(time);

View File

@ -31,7 +31,7 @@ namespace cocos2d
{ {
// implementation of CCWaves3D // implementation of CCWaves3D
CCWaves3D* CCWaves3D::actionWithWaves(int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) CCWaves3D* CCWaves3D::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{ {
CCWaves3D *pAction = new CCWaves3D(); CCWaves3D *pAction = new CCWaves3D();
@ -50,7 +50,7 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCWaves3D::initWithWaves(int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) bool CCWaves3D::initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{ {
if (CCGrid3DAction::initWithSize(gridSize, duration)) if (CCGrid3DAction::initWithSize(gridSize, duration))
{ {
@ -64,7 +64,7 @@ namespace cocos2d
return false; return false;
} }
CCObject* CCWaves3D::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCWaves3D::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCWaves3D* pCopy = NULL; CCWaves3D* pCopy = NULL;
@ -88,7 +88,7 @@ namespace cocos2d
return pCopy; return pCopy;
} }
void CCWaves3D::update(cocos2d::ccTime time) void CCWaves3D::update(ccTime time)
{ {
int i, j; int i, j;
@ -105,7 +105,7 @@ namespace cocos2d
// implementation of CCFlipX3D // implementation of CCFlipX3D
CCFlipX3D* CCFlipX3D::actionWithDuration(cocos2d::ccTime duration) CCFlipX3D* CCFlipX3D::actionWithDuration(ccTime duration)
{ {
CCFlipX3D *pAction = new CCFlipX3D(); CCFlipX3D *pAction = new CCFlipX3D();
@ -124,12 +124,12 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCFlipX3D::initWithDuration(cocos2d::ccTime duration) bool CCFlipX3D::initWithDuration(ccTime duration)
{ {
return CCGrid3DAction::initWithSize(ccg(1, 1), duration); return CCGrid3DAction::initWithSize(ccg(1, 1), duration);
} }
bool CCFlipX3D::initWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) bool CCFlipX3D::initWithSize(const ccGridSize& gridSize, ccTime duration)
{ {
if (gridSize.x != 1 || gridSize.y != 1) if (gridSize.x != 1 || gridSize.y != 1)
{ {
@ -142,7 +142,7 @@ namespace cocos2d
return CCGrid3DAction::initWithSize(gridSize, duration); return CCGrid3DAction::initWithSize(gridSize, duration);
} }
CCObject* CCFlipX3D::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCFlipX3D::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCFlipX3D* pCopy = NULL; CCFlipX3D* pCopy = NULL;
@ -165,7 +165,7 @@ namespace cocos2d
return pCopy; return pCopy;
} }
void CCFlipX3D::update(cocos2d::ccTime time) void CCFlipX3D::update(ccTime time)
{ {
CGFloat angle = (CGFloat)M_PI * time; // 180 degrees CGFloat angle = (CGFloat)M_PI * time; // 180 degrees
CGFloat mz = sinf(angle); CGFloat mz = sinf(angle);
@ -273,7 +273,7 @@ namespace cocos2d
return pCopy; return pCopy;
} }
void CCFlipY3D::update(cocos2d::ccTime time) void CCFlipY3D::update(ccTime time)
{ {
CGFloat angle = (CGFloat)M_PI * time; // 180 degrees CGFloat angle = (CGFloat)M_PI * time; // 180 degrees
CGFloat mz = sinf( angle ); CGFloat mz = sinf( angle );
@ -340,7 +340,7 @@ namespace cocos2d
// implementation of Lens3D // implementation of Lens3D
CCLens3D* CCLens3D::actionWithPosition(cocos2d::CCPoint pos, float r, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) CCLens3D* CCLens3D::actionWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, ccTime duration)
{ {
CCLens3D *pAction = new CCLens3D(); CCLens3D *pAction = new CCLens3D();
@ -359,7 +359,7 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCLens3D::initWithPosition(cocos2d::CCPoint pos, float r, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) bool CCLens3D::initWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, ccTime duration)
{ {
if (CCGrid3DAction::initWithSize(gridSize, duration)) if (CCGrid3DAction::initWithSize(gridSize, duration))
{ {
@ -375,7 +375,7 @@ namespace cocos2d
return false; return false;
} }
CCObject* CCLens3D::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCLens3D::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCLens3D* pCopy = NULL; CCLens3D* pCopy = NULL;
@ -398,7 +398,7 @@ namespace cocos2d
return pCopy; return pCopy;
} }
void CCLens3D::setPosition(CCPoint pos) void CCLens3D::setPosition(const CCPoint& pos)
{ {
if( ! CCPoint::CCPointEqualToPoint(pos, m_position) ) { if( ! CCPoint::CCPointEqualToPoint(pos, m_position) ) {
m_position = pos; m_position = pos;
@ -409,7 +409,7 @@ namespace cocos2d
} }
} }
void CCLens3D::update(cocos2d::ccTime time) void CCLens3D::update(ccTime time)
{ {
CC_UNUSED_PARAM(time); CC_UNUSED_PARAM(time);
if (m_bDirty) if (m_bDirty)
@ -454,7 +454,7 @@ namespace cocos2d
// implementation of Ripple3D // implementation of Ripple3D
CCRipple3D* CCRipple3D::actionWithPosition(cocos2d::CCPoint pos, float r, int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) CCRipple3D* CCRipple3D::actionWithPosition(const CCPoint& pos, float r, int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{ {
CCRipple3D *pAction = new CCRipple3D(); CCRipple3D *pAction = new CCRipple3D();
@ -473,7 +473,7 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCRipple3D::initWithPosition(cocos2d::CCPoint pos, float r, int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) bool CCRipple3D::initWithPosition(const CCPoint& pos, float r, int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{ {
if (CCGrid3DAction::initWithSize(gridSize, duration)) if (CCGrid3DAction::initWithSize(gridSize, duration))
{ {
@ -489,14 +489,14 @@ namespace cocos2d
return false; return false;
} }
void CCRipple3D::setPosition(CCPoint position) void CCRipple3D::setPosition(const CCPoint& position)
{ {
m_position = position; m_position = position;
m_positionInPixels.x = position.x * CC_CONTENT_SCALE_FACTOR(); m_positionInPixels.x = position.x * CC_CONTENT_SCALE_FACTOR();
m_positionInPixels.y = position.y * CC_CONTENT_SCALE_FACTOR(); m_positionInPixels.y = position.y * CC_CONTENT_SCALE_FACTOR();
} }
CCObject* CCRipple3D::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCRipple3D::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCRipple3D* pCopy = NULL; CCRipple3D* pCopy = NULL;
@ -519,7 +519,7 @@ namespace cocos2d
return pCopy; return pCopy;
} }
void CCRipple3D::update(cocos2d::ccTime time) void CCRipple3D::update(ccTime time)
{ {
int i, j; int i, j;
@ -545,7 +545,7 @@ namespace cocos2d
// implementation of Shaky3D // implementation of Shaky3D
CCShaky3D* CCShaky3D::actionWithRange(int range, bool shakeZ, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) CCShaky3D* CCShaky3D::actionWithRange(int range, bool shakeZ, const ccGridSize& gridSize, ccTime duration)
{ {
CCShaky3D *pAction = new CCShaky3D(); CCShaky3D *pAction = new CCShaky3D();
@ -564,7 +564,7 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCShaky3D::initWithRange(int range, bool shakeZ, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) bool CCShaky3D::initWithRange(int range, bool shakeZ, const ccGridSize& gridSize, ccTime duration)
{ {
if (CCGrid3DAction::initWithSize(gridSize, duration)) if (CCGrid3DAction::initWithSize(gridSize, duration))
{ {
@ -577,7 +577,7 @@ namespace cocos2d
return false; return false;
} }
CCObject* CCShaky3D::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCShaky3D::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCShaky3D* pCopy = NULL; CCShaky3D* pCopy = NULL;
@ -600,7 +600,7 @@ namespace cocos2d
return pCopy; return pCopy;
} }
void CCShaky3D::update(cocos2d::ccTime time) void CCShaky3D::update(ccTime time)
{ {
CC_UNUSED_PARAM(time); CC_UNUSED_PARAM(time);
int i, j; int i, j;
@ -624,7 +624,7 @@ namespace cocos2d
// implementation of Liquid // implementation of Liquid
CCLiquid* CCLiquid::actionWithWaves(int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) CCLiquid* CCLiquid::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{ {
CCLiquid *pAction = new CCLiquid(); CCLiquid *pAction = new CCLiquid();
@ -643,7 +643,7 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCLiquid::initWithWaves(int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) bool CCLiquid::initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{ {
if (CCGrid3DAction::initWithSize(gridSize, duration)) if (CCGrid3DAction::initWithSize(gridSize, duration))
{ {
@ -657,7 +657,7 @@ namespace cocos2d
return false; return false;
} }
CCObject* CCLiquid::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCLiquid::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCLiquid* pCopy = NULL; CCLiquid* pCopy = NULL;
@ -680,7 +680,7 @@ namespace cocos2d
return pCopy; return pCopy;
} }
void CCLiquid::update(cocos2d::ccTime time) void CCLiquid::update(ccTime time)
{ {
int i, j; int i, j;
@ -698,7 +698,7 @@ namespace cocos2d
// implementation of Waves // implementation of Waves
CCWaves* CCWaves::actionWithWaves(int wav, float amp, bool h, bool v, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) CCWaves* CCWaves::actionWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize, ccTime duration)
{ {
CCWaves *pAction = new CCWaves(); CCWaves *pAction = new CCWaves();
@ -717,7 +717,7 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCWaves::initWithWaves(int wav, float amp, bool h, bool v, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) bool CCWaves::initWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize, ccTime duration)
{ {
if (CCGrid3DAction::initWithSize(gridSize, duration)) if (CCGrid3DAction::initWithSize(gridSize, duration))
{ {
@ -733,7 +733,7 @@ namespace cocos2d
return false; return false;
} }
CCObject* CCWaves::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCWaves::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCWaves* pCopy = NULL; CCWaves* pCopy = NULL;
@ -756,7 +756,7 @@ namespace cocos2d
return pCopy; return pCopy;
} }
void CCWaves::update(cocos2d::ccTime time) void CCWaves::update(ccTime time)
{ {
int i, j; int i, j;
@ -783,7 +783,7 @@ namespace cocos2d
// implementation of Twirl // implementation of Twirl
CCTwirl* CCTwirl::actionWithPosition(cocos2d::CCPoint pos, int t, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) CCTwirl* CCTwirl::actionWithPosition(CCPoint pos, int t, float amp, const ccGridSize& gridSize, ccTime duration)
{ {
CCTwirl *pAction = new CCTwirl(); CCTwirl *pAction = new CCTwirl();
@ -802,7 +802,7 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCTwirl::initWithPosition(cocos2d::CCPoint pos, int t, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) bool CCTwirl::initWithPosition(const CCPoint& pos, int t, float amp, const ccGridSize& gridSize, ccTime duration)
{ {
if (CCGrid3DAction::initWithSize(gridSize, duration)) if (CCGrid3DAction::initWithSize(gridSize, duration))
{ {
@ -817,14 +817,14 @@ namespace cocos2d
return false; return false;
} }
void CCTwirl::setPosition(CCPoint position) void CCTwirl::setPosition(const CCPoint& position)
{ {
m_position = position; m_position = position;
m_positionInPixels.x = position.x * CC_CONTENT_SCALE_FACTOR(); m_positionInPixels.x = position.x * CC_CONTENT_SCALE_FACTOR();
m_positionInPixels.y = position.y * CC_CONTENT_SCALE_FACTOR(); m_positionInPixels.y = position.y * CC_CONTENT_SCALE_FACTOR();
} }
CCObject* CCTwirl::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCTwirl::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCTwirl* pCopy = NULL; CCTwirl* pCopy = NULL;
@ -848,7 +848,7 @@ namespace cocos2d
return pCopy; return pCopy;
} }
void CCTwirl::update(cocos2d::ccTime time) void CCTwirl::update(ccTime time)
{ {
int i, j; int i, j;
CCPoint c = m_positionInPixels; CCPoint c = m_positionInPixels;

View File

@ -36,7 +36,7 @@ namespace cocos2d {
CCActionInstant::CCActionInstant() CCActionInstant::CCActionInstant()
{} {}
CCObject * CCActionInstant::copyWithZone(cocos2d::CCZone *pZone) CCObject * CCActionInstant::copyWithZone(CCZone *pZone)
{ {
CCZone *pNewZone = NULL; CCZone *pNewZone = NULL;
CCActionInstant *pRet = NULL; CCActionInstant *pRet = NULL;
@ -218,14 +218,14 @@ namespace cocos2d {
// //
// Place // Place
// //
CCPlace * CCPlace::actionWithPosition(CCPoint pos) CCPlace * CCPlace::actionWithPosition(const CCPoint& pos)
{ {
CCPlace *pRet = new CCPlace(); CCPlace *pRet = new CCPlace();
pRet->initWithPosition(pos); pRet->initWithPosition(pos);
pRet->autorelease(); pRet->autorelease();
return pRet; return pRet;
} }
bool CCPlace::initWithPosition(CCPoint pos) bool CCPlace::initWithPosition(const CCPoint& pos)
{ {
m_tPosition = pos; m_tPosition = pos;
return true; return true;
@ -305,7 +305,7 @@ namespace cocos2d {
return true; return true;
} }
CCObject * CCCallFunc::copyWithZone(cocos2d::CCZone *pZone) CCObject * CCCallFunc::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCCallFunc* pRet = NULL; CCCallFunc* pRet = NULL;

View File

@ -46,7 +46,7 @@ CCActionInterval* CCActionInterval::actionWithDuration(ccTime d)
return pAction; return pAction;
} }
bool CCActionInterval::initWithDuration(cocos2d::ccTime d) bool CCActionInterval::initWithDuration(ccTime d)
{ {
m_fDuration = d; m_fDuration = d;
@ -150,7 +150,7 @@ CCActionInterval* CCActionInterval::reverse(void)
// //
// Sequence // Sequence
// //
CCSequence* CCSequence::actionOneTwo(cocos2d::CCFiniteTimeAction *pActionOne, cocos2d::CCFiniteTimeAction *pActionTwo) CCSequence* CCSequence::actionOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo)
{ {
CCSequence *pSequence = new CCSequence(); CCSequence *pSequence = new CCSequence();
pSequence->initOneTwo(pActionOne, pActionTwo); pSequence->initOneTwo(pActionOne, pActionTwo);
@ -159,7 +159,7 @@ CCSequence* CCSequence::actionOneTwo(cocos2d::CCFiniteTimeAction *pActionOne, co
return pSequence; return pSequence;
} }
CCFiniteTimeAction* CCSequence::actions(cocos2d::CCFiniteTimeAction *pAction1, ...) CCFiniteTimeAction* CCSequence::actions(CCFiniteTimeAction *pAction1, ...)
{ {
va_list params; va_list params;
va_start(params, pAction1); va_start(params, pAction1);
@ -196,7 +196,7 @@ CCFiniteTimeAction* CCSequence::actionsWithArray(CCArray *actions)
return prev; return prev;
} }
bool CCSequence::initOneTwo(cocos2d::CCFiniteTimeAction *pActionOne, cocos2d::CCFiniteTimeAction *pActionTwo) bool CCSequence::initOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo)
{ {
assert(pActionOne != NULL); assert(pActionOne != NULL);
assert(pActionTwo != NULL); assert(pActionTwo != NULL);
@ -257,7 +257,7 @@ void CCSequence::stop(void)
CCActionInterval::stop(); CCActionInterval::stop();
} }
void CCSequence::update(cocos2d::ccTime time) void CCSequence::update(ccTime time)
{ {
int found = 0; int found = 0;
ccTime new_t = 0.0f; ccTime new_t = 0.0f;
@ -317,7 +317,7 @@ CCActionInterval* CCSequence::reverse(void)
// //
// Repeat // Repeat
// //
CCRepeat* CCRepeat::actionWithAction(cocos2d::CCFiniteTimeAction *pAction, unsigned int times) CCRepeat* CCRepeat::actionWithAction(CCFiniteTimeAction *pAction, unsigned int times)
{ {
CCRepeat* pRepeat = new CCRepeat(); CCRepeat* pRepeat = new CCRepeat();
pRepeat->initWithAction(pAction, times); pRepeat->initWithAction(pAction, times);
@ -326,7 +326,7 @@ CCRepeat* CCRepeat::actionWithAction(cocos2d::CCFiniteTimeAction *pAction, unsig
return pRepeat; return pRepeat;
} }
bool CCRepeat::initWithAction(cocos2d::CCFiniteTimeAction *pAction, unsigned int times) bool CCRepeat::initWithAction(CCFiniteTimeAction *pAction, unsigned int times)
{ {
ccTime d = pAction->getDuration() * times; ccTime d = pAction->getDuration() * times;
@ -344,7 +344,7 @@ bool CCRepeat::initWithAction(cocos2d::CCFiniteTimeAction *pAction, unsigned int
return false; return false;
} }
CCObject* CCRepeat::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCRepeat::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
@ -388,7 +388,7 @@ void CCRepeat::stop(void)
// issue #80. Instead of hooking step:, hook update: since it can be called by any // issue #80. Instead of hooking step:, hook update: since it can be called by any
// container action like Repeat, Sequence, AccelDeccel, etc.. // container action like Repeat, Sequence, AccelDeccel, etc..
void CCRepeat::update(cocos2d::ccTime time) void CCRepeat::update(ccTime time)
{ {
ccTime t = time * m_uTimes; ccTime t = time * m_uTimes;
if (t > m_uTotal + 1) if (t > m_uTotal + 1)
@ -515,7 +515,7 @@ CCActionInterval *CCRepeatForever::reverse()
// //
// Spawn // Spawn
// //
CCFiniteTimeAction* CCSpawn::actions(cocos2d::CCFiniteTimeAction *pAction1, ...) CCFiniteTimeAction* CCSpawn::actions(CCFiniteTimeAction *pAction1, ...)
{ {
va_list params; va_list params;
va_start(params, pAction1); va_start(params, pAction1);
@ -540,7 +540,7 @@ CCFiniteTimeAction* CCSpawn::actions(cocos2d::CCFiniteTimeAction *pAction1, ...)
return pPrev; return pPrev;
} }
CCFiniteTimeAction* CCSpawn::actionsWithArray(cocos2d::CCArray *actions) CCFiniteTimeAction* CCSpawn::actionsWithArray(CCArray *actions)
{ {
CCFiniteTimeAction* prev = (CCFiniteTimeAction*)actions->objectAtIndex(0); CCFiniteTimeAction* prev = (CCFiniteTimeAction*)actions->objectAtIndex(0);
@ -552,7 +552,7 @@ CCFiniteTimeAction* CCSpawn::actionsWithArray(cocos2d::CCArray *actions)
return prev; return prev;
} }
CCSpawn* CCSpawn::actionOneTwo(cocos2d::CCFiniteTimeAction *pAction1, cocos2d::CCFiniteTimeAction *pAction2) CCSpawn* CCSpawn::actionOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2)
{ {
CCSpawn *pSpawn = new CCSpawn(); CCSpawn *pSpawn = new CCSpawn();
pSpawn->initOneTwo(pAction1, pAction2); pSpawn->initOneTwo(pAction1, pAction2);
@ -595,7 +595,7 @@ bool CCSpawn:: initOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAct
return bRet; return bRet;
} }
CCObject* CCSpawn::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCSpawn::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCSpawn* pCopy = NULL; CCSpawn* pCopy = NULL;
@ -640,7 +640,7 @@ void CCSpawn::stop(void)
CCActionInterval::stop(); CCActionInterval::stop();
} }
void CCSpawn::update(cocos2d::ccTime time) void CCSpawn::update(ccTime time)
{ {
if (m_pOne) if (m_pOne)
{ {
@ -660,7 +660,7 @@ CCActionInterval* CCSpawn::reverse(void)
// //
// RotateTo // RotateTo
// //
CCRotateTo* CCRotateTo::actionWithDuration(cocos2d::ccTime duration, float fDeltaAngle) CCRotateTo* CCRotateTo::actionWithDuration(ccTime duration, float fDeltaAngle)
{ {
CCRotateTo* pRotateTo = new CCRotateTo(); CCRotateTo* pRotateTo = new CCRotateTo();
pRotateTo->initWithDuration(duration, fDeltaAngle); pRotateTo->initWithDuration(duration, fDeltaAngle);
@ -669,7 +669,7 @@ CCRotateTo* CCRotateTo::actionWithDuration(cocos2d::ccTime duration, float fDelt
return pRotateTo; return pRotateTo;
} }
bool CCRotateTo::initWithDuration(cocos2d::ccTime duration, float fDeltaAngle) bool CCRotateTo::initWithDuration(ccTime duration, float fDeltaAngle)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -680,7 +680,7 @@ bool CCRotateTo::initWithDuration(cocos2d::ccTime duration, float fDeltaAngle)
return false; return false;
} }
CCObject* CCRotateTo::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCRotateTo::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCRotateTo* pCopy = NULL; CCRotateTo* pCopy = NULL;
@ -731,7 +731,7 @@ void CCRotateTo::startWithTarget(CCNode *pTarget)
} }
} }
void CCRotateTo::update(cocos2d::ccTime time) void CCRotateTo::update(ccTime time)
{ {
if (m_pTarget) if (m_pTarget)
{ {
@ -742,7 +742,7 @@ void CCRotateTo::update(cocos2d::ccTime time)
// //
// RotateBy // RotateBy
// //
CCRotateBy* CCRotateBy::actionWithDuration(cocos2d::ccTime duration, float fDeltaAngle) CCRotateBy* CCRotateBy::actionWithDuration(ccTime duration, float fDeltaAngle)
{ {
CCRotateBy *pRotateBy = new CCRotateBy(); CCRotateBy *pRotateBy = new CCRotateBy();
pRotateBy->initWithDuration(duration, fDeltaAngle); pRotateBy->initWithDuration(duration, fDeltaAngle);
@ -751,7 +751,7 @@ CCRotateBy* CCRotateBy::actionWithDuration(cocos2d::ccTime duration, float fDelt
return pRotateBy; return pRotateBy;
} }
bool CCRotateBy::initWithDuration(cocos2d::ccTime duration, float fDeltaAngle) bool CCRotateBy::initWithDuration(ccTime duration, float fDeltaAngle)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -762,7 +762,7 @@ bool CCRotateBy::initWithDuration(cocos2d::ccTime duration, float fDeltaAngle)
return false; return false;
} }
CCObject* CCRotateBy::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCRotateBy::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCRotateBy* pCopy = NULL; CCRotateBy* pCopy = NULL;
@ -791,7 +791,7 @@ void CCRotateBy::startWithTarget(CCNode *pTarget)
m_fStartAngle = pTarget->getRotation(); m_fStartAngle = pTarget->getRotation();
} }
void CCRotateBy::update(cocos2d::ccTime time) void CCRotateBy::update(ccTime time)
{ {
// XXX: shall I add % 360 // XXX: shall I add % 360
if (m_pTarget) if (m_pTarget)
@ -808,7 +808,7 @@ CCActionInterval* CCRotateBy::reverse(void)
// //
// MoveTo // MoveTo
// //
CCMoveTo* CCMoveTo::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint position) CCMoveTo* CCMoveTo::actionWithDuration(ccTime duration, const CCPoint& position)
{ {
CCMoveTo *pMoveTo = new CCMoveTo(); CCMoveTo *pMoveTo = new CCMoveTo();
pMoveTo->initWithDuration(duration, position); pMoveTo->initWithDuration(duration, position);
@ -817,7 +817,7 @@ CCMoveTo* CCMoveTo::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCPoin
return pMoveTo; return pMoveTo;
} }
bool CCMoveTo::initWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint position) bool CCMoveTo::initWithDuration(ccTime duration, const CCPoint& position)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -828,7 +828,7 @@ bool CCMoveTo::initWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint posit
return false; return false;
} }
CCObject* CCMoveTo::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCMoveTo::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCMoveTo* pCopy = NULL; CCMoveTo* pCopy = NULL;
@ -858,7 +858,7 @@ void CCMoveTo::startWithTarget(CCNode *pTarget)
m_delta = ccpSub(m_endPosition, m_startPosition); m_delta = ccpSub(m_endPosition, m_startPosition);
} }
void CCMoveTo::update(cocos2d::ccTime time) void CCMoveTo::update(ccTime time)
{ {
if (m_pTarget) if (m_pTarget)
{ {
@ -870,7 +870,7 @@ void CCMoveTo::update(cocos2d::ccTime time)
// //
// MoveBy // MoveBy
// //
CCMoveBy* CCMoveBy::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint position) CCMoveBy* CCMoveBy::actionWithDuration(ccTime duration, const CCPoint& position)
{ {
CCMoveBy *pMoveBy = new CCMoveBy(); CCMoveBy *pMoveBy = new CCMoveBy();
pMoveBy->initWithDuration(duration, position); pMoveBy->initWithDuration(duration, position);
@ -879,7 +879,7 @@ CCMoveBy* CCMoveBy::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCPoin
return pMoveBy; return pMoveBy;
} }
bool CCMoveBy::initWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint position) bool CCMoveBy::initWithDuration(ccTime duration, const CCPoint& position)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -890,7 +890,7 @@ bool CCMoveBy::initWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint posit
return false; return false;
} }
CCObject* CCMoveBy::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCMoveBy::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCMoveBy* pCopy = NULL; CCMoveBy* pCopy = NULL;
@ -928,7 +928,7 @@ CCActionInterval* CCMoveBy::reverse(void)
// //
// CCSkewTo // CCSkewTo
// //
CCSkewTo* CCSkewTo::actionWithDuration(cocos2d::ccTime t, float sx, float sy) CCSkewTo* CCSkewTo::actionWithDuration(ccTime t, float sx, float sy)
{ {
CCSkewTo *pSkewTo = new CCSkewTo(); CCSkewTo *pSkewTo = new CCSkewTo();
if (pSkewTo) if (pSkewTo)
@ -984,7 +984,7 @@ CCObject* CCSkewTo::copyWithZone(CCZone* pZone)
return pCopy; return pCopy;
} }
void CCSkewTo::startWithTarget(cocos2d::CCNode *pTarget) void CCSkewTo::startWithTarget(CCNode *pTarget)
{ {
CCActionInterval::startWithTarget(pTarget); CCActionInterval::startWithTarget(pTarget);
@ -1072,7 +1072,7 @@ CCSkewBy* CCSkewBy::actionWithDuration(ccTime t, float sx, float sy)
return pSkewBy; return pSkewBy;
} }
bool CCSkewBy::initWithDuration(cocos2d::ccTime t, float deltaSkewX, float deltaSkewY) bool CCSkewBy::initWithDuration(ccTime t, float deltaSkewX, float deltaSkewY)
{ {
bool bRet = false; bool bRet = false;
@ -1087,7 +1087,7 @@ bool CCSkewBy::initWithDuration(cocos2d::ccTime t, float deltaSkewX, float delta
return bRet; return bRet;
} }
void CCSkewBy::startWithTarget(cocos2d::CCNode *pTarget) void CCSkewBy::startWithTarget(CCNode *pTarget)
{ {
CCSkewTo::startWithTarget(pTarget); CCSkewTo::startWithTarget(pTarget);
m_fDeltaX = m_fSkewX; m_fDeltaX = m_fSkewX;
@ -1104,7 +1104,7 @@ CCActionInterval* CCSkewBy::reverse()
// //
// JumpBy // JumpBy
// //
CCJumpBy* CCJumpBy::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint position, cocos2d::ccTime height, unsigned int jumps) CCJumpBy* CCJumpBy::actionWithDuration(ccTime duration, const CCPoint& position, ccTime height, unsigned int jumps)
{ {
CCJumpBy *pJumpBy = new CCJumpBy(); CCJumpBy *pJumpBy = new CCJumpBy();
pJumpBy->initWithDuration(duration, position, height, jumps); pJumpBy->initWithDuration(duration, position, height, jumps);
@ -1113,7 +1113,7 @@ CCJumpBy* CCJumpBy::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCPoin
return pJumpBy; return pJumpBy;
} }
bool CCJumpBy::initWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint position, cocos2d::ccTime height, unsigned int jumps) bool CCJumpBy::initWithDuration(ccTime duration, const CCPoint& position, ccTime height, unsigned int jumps)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -1127,7 +1127,7 @@ bool CCJumpBy::initWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint posit
return false; return false;
} }
CCObject* CCJumpBy::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCJumpBy::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCJumpBy* pCopy = NULL; CCJumpBy* pCopy = NULL;
@ -1156,7 +1156,7 @@ void CCJumpBy::startWithTarget(CCNode *pTarget)
m_startPosition = pTarget->getPosition(); m_startPosition = pTarget->getPosition();
} }
void CCJumpBy::update(cocos2d::ccTime time) void CCJumpBy::update(ccTime time)
{ {
// parabolic jump (since v0.8.2) // parabolic jump (since v0.8.2)
if (m_pTarget) if (m_pTarget)
@ -1178,7 +1178,7 @@ CCActionInterval* CCJumpBy::reverse(void)
// //
// JumpTo // JumpTo
// //
CCJumpTo* CCJumpTo::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint position, cocos2d::ccTime height, int jumps) CCJumpTo* CCJumpTo::actionWithDuration(ccTime duration, const CCPoint& position, ccTime height, int jumps)
{ {
CCJumpTo *pJumpTo = new CCJumpTo(); CCJumpTo *pJumpTo = new CCJumpTo();
pJumpTo->initWithDuration(duration, position, height, jumps); pJumpTo->initWithDuration(duration, position, height, jumps);
@ -1231,7 +1231,7 @@ static inline float bezierat( float a, float b, float c, float d, ccTime t )
// //
// BezierBy // BezierBy
// //
CCBezierBy* CCBezierBy::actionWithDuration(cocos2d::ccTime t, cocos2d::ccBezierConfig c) CCBezierBy* CCBezierBy::actionWithDuration(ccTime t, const ccBezierConfig& c)
{ {
CCBezierBy *pBezierBy = new CCBezierBy(); CCBezierBy *pBezierBy = new CCBezierBy();
pBezierBy->initWithDuration(t, c); pBezierBy->initWithDuration(t, c);
@ -1240,7 +1240,7 @@ CCBezierBy* CCBezierBy::actionWithDuration(cocos2d::ccTime t, cocos2d::ccBezierC
return pBezierBy; return pBezierBy;
} }
bool CCBezierBy::initWithDuration(cocos2d::ccTime t, cocos2d::ccBezierConfig c) bool CCBezierBy::initWithDuration(ccTime t, const ccBezierConfig& c)
{ {
if (CCActionInterval::initWithDuration(t)) if (CCActionInterval::initWithDuration(t))
{ {
@ -1257,7 +1257,7 @@ void CCBezierBy::startWithTarget(CCNode *pTarget)
m_startPosition = pTarget->getPosition(); m_startPosition = pTarget->getPosition();
} }
CCObject* CCBezierBy::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCBezierBy::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCBezierBy* pCopy = NULL; CCBezierBy* pCopy = NULL;
@ -1280,7 +1280,7 @@ CCObject* CCBezierBy::copyWithZone(cocos2d::CCZone *pZone)
return pCopy; return pCopy;
} }
void CCBezierBy::update(cocos2d::ccTime time) void CCBezierBy::update(ccTime time)
{ {
if (m_pTarget) if (m_pTarget)
{ {
@ -1315,7 +1315,7 @@ CCActionInterval* CCBezierBy::reverse(void)
// //
// BezierTo // BezierTo
// //
CCBezierTo* CCBezierTo::actionWithDuration(ccTime t, ccBezierConfig c) CCBezierTo* CCBezierTo::actionWithDuration(ccTime t, const ccBezierConfig& c)
{ {
CCBezierTo *pBezierTo = new CCBezierTo(); CCBezierTo *pBezierTo = new CCBezierTo();
pBezierTo->initWithDuration(t, c); pBezierTo->initWithDuration(t, c);
@ -1324,7 +1324,7 @@ CCBezierTo* CCBezierTo::actionWithDuration(ccTime t, ccBezierConfig c)
return pBezierTo; return pBezierTo;
} }
CCObject* CCBezierTo::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCBezierTo::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCBezierBy* pCopy = NULL; CCBezierBy* pCopy = NULL;
@ -1358,7 +1358,7 @@ void CCBezierTo::startWithTarget(CCNode *pTarget)
// //
// ScaleTo // ScaleTo
// //
CCScaleTo* CCScaleTo::actionWithDuration(cocos2d::ccTime duration, float s) CCScaleTo* CCScaleTo::actionWithDuration(ccTime duration, float s)
{ {
CCScaleTo *pScaleTo = new CCScaleTo(); CCScaleTo *pScaleTo = new CCScaleTo();
pScaleTo->initWithDuration(duration, s); pScaleTo->initWithDuration(duration, s);
@ -1367,7 +1367,7 @@ CCScaleTo* CCScaleTo::actionWithDuration(cocos2d::ccTime duration, float s)
return pScaleTo; return pScaleTo;
} }
bool CCScaleTo::initWithDuration(cocos2d::ccTime duration, float s) bool CCScaleTo::initWithDuration(ccTime duration, float s)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -1380,7 +1380,7 @@ bool CCScaleTo::initWithDuration(cocos2d::ccTime duration, float s)
return false; return false;
} }
CCScaleTo* CCScaleTo::actionWithDuration(cocos2d::ccTime duration, float sx, float sy) CCScaleTo* CCScaleTo::actionWithDuration(ccTime duration, float sx, float sy)
{ {
CCScaleTo *pScaleTo = new CCScaleTo(); CCScaleTo *pScaleTo = new CCScaleTo();
pScaleTo->initWithDuration(duration, sx, sy); pScaleTo->initWithDuration(duration, sx, sy);
@ -1389,7 +1389,7 @@ CCScaleTo* CCScaleTo::actionWithDuration(cocos2d::ccTime duration, float sx, flo
return pScaleTo; return pScaleTo;
} }
bool CCScaleTo::initWithDuration(cocos2d::ccTime duration, float sx, float sy) bool CCScaleTo::initWithDuration(ccTime duration, float sx, float sy)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -1402,7 +1402,7 @@ bool CCScaleTo::initWithDuration(cocos2d::ccTime duration, float sx, float sy)
return false; return false;
} }
CCObject* CCScaleTo::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCScaleTo::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCScaleTo* pCopy = NULL; CCScaleTo* pCopy = NULL;
@ -1435,7 +1435,7 @@ void CCScaleTo::startWithTarget(CCNode *pTarget)
m_fDeltaY = m_fEndScaleY - m_fStartScaleY; m_fDeltaY = m_fEndScaleY - m_fStartScaleY;
} }
void CCScaleTo::update(cocos2d::ccTime time) void CCScaleTo::update(ccTime time)
{ {
if (m_pTarget) if (m_pTarget)
{ {
@ -1447,7 +1447,7 @@ void CCScaleTo::update(cocos2d::ccTime time)
// //
// ScaleBy // ScaleBy
// //
CCScaleBy* CCScaleBy::actionWithDuration(cocos2d::ccTime duration, float s) CCScaleBy* CCScaleBy::actionWithDuration(ccTime duration, float s)
{ {
CCScaleBy *pScaleBy = new CCScaleBy(); CCScaleBy *pScaleBy = new CCScaleBy();
pScaleBy->initWithDuration(duration, s); pScaleBy->initWithDuration(duration, s);
@ -1456,7 +1456,7 @@ CCScaleBy* CCScaleBy::actionWithDuration(cocos2d::ccTime duration, float s)
return pScaleBy; return pScaleBy;
} }
CCScaleBy* CCScaleBy::actionWithDuration(cocos2d::ccTime duration, float sx, float sy) CCScaleBy* CCScaleBy::actionWithDuration(ccTime duration, float sx, float sy)
{ {
CCScaleBy *pScaleBy = new CCScaleBy(); CCScaleBy *pScaleBy = new CCScaleBy();
pScaleBy->initWithDuration(duration, sx, sy); pScaleBy->initWithDuration(duration, sx, sy);
@ -1465,7 +1465,7 @@ CCScaleBy* CCScaleBy::actionWithDuration(cocos2d::ccTime duration, float sx, flo
return pScaleBy; return pScaleBy;
} }
CCObject* CCScaleBy::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCScaleBy::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCScaleTo* pCopy = NULL; CCScaleTo* pCopy = NULL;
@ -1504,7 +1504,7 @@ CCActionInterval* CCScaleBy::reverse(void)
// //
// Blink // Blink
// //
CCBlink* CCBlink::actionWithDuration(cocos2d::ccTime duration, unsigned int uBlinks) CCBlink* CCBlink::actionWithDuration(ccTime duration, unsigned int uBlinks)
{ {
CCBlink *pBlink = new CCBlink(); CCBlink *pBlink = new CCBlink();
pBlink->initWithDuration(duration, uBlinks); pBlink->initWithDuration(duration, uBlinks);
@ -1513,7 +1513,7 @@ CCBlink* CCBlink::actionWithDuration(cocos2d::ccTime duration, unsigned int uBli
return pBlink; return pBlink;
} }
bool CCBlink::initWithDuration(cocos2d::ccTime duration, unsigned int uBlinks) bool CCBlink::initWithDuration(ccTime duration, unsigned int uBlinks)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -1524,7 +1524,7 @@ bool CCBlink::initWithDuration(cocos2d::ccTime duration, unsigned int uBlinks)
return false; return false;
} }
CCObject* CCBlink::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCBlink::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCBlink* pCopy = NULL; CCBlink* pCopy = NULL;
@ -1548,7 +1548,7 @@ CCObject* CCBlink::copyWithZone(cocos2d::CCZone *pZone)
return pCopy; return pCopy;
} }
void CCBlink::update(cocos2d::ccTime time) void CCBlink::update(ccTime time)
{ {
if (m_pTarget && ! isDone()) if (m_pTarget && ! isDone())
{ {
@ -1567,7 +1567,7 @@ CCActionInterval* CCBlink::reverse(void)
// //
// FadeIn // FadeIn
// //
CCFadeIn* CCFadeIn::actionWithDuration(cocos2d::ccTime d) CCFadeIn* CCFadeIn::actionWithDuration(ccTime d)
{ {
CCFadeIn* pAction = new CCFadeIn(); CCFadeIn* pAction = new CCFadeIn();
@ -1577,7 +1577,7 @@ CCFadeIn* CCFadeIn::actionWithDuration(cocos2d::ccTime d)
return pAction; return pAction;
} }
CCObject* CCFadeIn::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCFadeIn::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCFadeIn* pCopy = NULL; CCFadeIn* pCopy = NULL;
@ -1599,7 +1599,7 @@ CCObject* CCFadeIn::copyWithZone(cocos2d::CCZone *pZone)
return pCopy; return pCopy;
} }
void CCFadeIn::update(cocos2d::ccTime time) void CCFadeIn::update(ccTime time)
{ {
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol(); CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
if (pRGBAProtocol) if (pRGBAProtocol)
@ -1617,7 +1617,7 @@ CCActionInterval* CCFadeIn::reverse(void)
// //
// FadeOut // FadeOut
// //
CCFadeOut* CCFadeOut::actionWithDuration(cocos2d::ccTime d) CCFadeOut* CCFadeOut::actionWithDuration(ccTime d)
{ {
CCFadeOut* pAction = new CCFadeOut(); CCFadeOut* pAction = new CCFadeOut();
@ -1627,7 +1627,7 @@ CCFadeOut* CCFadeOut::actionWithDuration(cocos2d::ccTime d)
return pAction; return pAction;
} }
CCObject* CCFadeOut::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCFadeOut::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCFadeOut* pCopy = NULL; CCFadeOut* pCopy = NULL;
@ -1649,7 +1649,7 @@ CCObject* CCFadeOut::copyWithZone(cocos2d::CCZone *pZone)
return pCopy; return pCopy;
} }
void CCFadeOut::update(cocos2d::ccTime time) void CCFadeOut::update(ccTime time)
{ {
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol(); CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
if (pRGBAProtocol) if (pRGBAProtocol)
@ -1667,7 +1667,7 @@ CCActionInterval* CCFadeOut::reverse(void)
// //
// FadeTo // FadeTo
// //
CCFadeTo* CCFadeTo::actionWithDuration(cocos2d::ccTime duration, GLubyte opacity) CCFadeTo* CCFadeTo::actionWithDuration(ccTime duration, GLubyte opacity)
{ {
CCFadeTo *pFadeTo = new CCFadeTo(); CCFadeTo *pFadeTo = new CCFadeTo();
pFadeTo->initWithDuration(duration, opacity); pFadeTo->initWithDuration(duration, opacity);
@ -1676,7 +1676,7 @@ CCFadeTo* CCFadeTo::actionWithDuration(cocos2d::ccTime duration, GLubyte opacity
return pFadeTo; return pFadeTo;
} }
bool CCFadeTo::initWithDuration(cocos2d::ccTime duration, GLubyte opacity) bool CCFadeTo::initWithDuration(ccTime duration, GLubyte opacity)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -1687,7 +1687,7 @@ bool CCFadeTo::initWithDuration(cocos2d::ccTime duration, GLubyte opacity)
return false; return false;
} }
CCObject* CCFadeTo::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCFadeTo::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCFadeTo* pCopy = NULL; CCFadeTo* pCopy = NULL;
@ -1722,7 +1722,7 @@ void CCFadeTo::startWithTarget(CCNode *pTarget)
/*m_fromOpacity = pTarget->getOpacity();*/ /*m_fromOpacity = pTarget->getOpacity();*/
} }
void CCFadeTo::update(cocos2d::ccTime time) void CCFadeTo::update(ccTime time)
{ {
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol(); CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
if (pRGBAProtocol) if (pRGBAProtocol)
@ -1735,7 +1735,7 @@ void CCFadeTo::update(cocos2d::ccTime time)
// //
// TintTo // TintTo
// //
CCTintTo* CCTintTo::actionWithDuration(cocos2d::ccTime duration, GLubyte red, GLubyte green, GLubyte blue) CCTintTo* CCTintTo::actionWithDuration(ccTime duration, GLubyte red, GLubyte green, GLubyte blue)
{ {
CCTintTo *pTintTo = new CCTintTo(); CCTintTo *pTintTo = new CCTintTo();
pTintTo->initWithDuration(duration, red, green, blue); pTintTo->initWithDuration(duration, red, green, blue);
@ -1744,7 +1744,7 @@ CCTintTo* CCTintTo::actionWithDuration(cocos2d::ccTime duration, GLubyte red, GL
return pTintTo; return pTintTo;
} }
bool CCTintTo::initWithDuration(cocos2d::ccTime duration, GLubyte red, GLubyte green, GLubyte blue) bool CCTintTo::initWithDuration(ccTime duration, GLubyte red, GLubyte green, GLubyte blue)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -1755,7 +1755,7 @@ bool CCTintTo::initWithDuration(cocos2d::ccTime duration, GLubyte red, GLubyte g
return false; return false;
} }
CCObject* CCTintTo::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCTintTo::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCTintTo* pCopy = NULL; CCTintTo* pCopy = NULL;
@ -1789,7 +1789,7 @@ void CCTintTo::startWithTarget(CCNode *pTarget)
/*m_from = pTarget->getColor();*/ /*m_from = pTarget->getColor();*/
} }
void CCTintTo::update(cocos2d::ccTime time) void CCTintTo::update(ccTime time)
{ {
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol(); CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
if (pRGBAProtocol) if (pRGBAProtocol)
@ -1803,7 +1803,7 @@ void CCTintTo::update(cocos2d::ccTime time)
// //
// TintBy // TintBy
// //
CCTintBy* CCTintBy::actionWithDuration(cocos2d::ccTime duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue) CCTintBy* CCTintBy::actionWithDuration(ccTime duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue)
{ {
CCTintBy *pTintBy = new CCTintBy(); CCTintBy *pTintBy = new CCTintBy();
pTintBy->initWithDuration(duration, deltaRed, deltaGreen, deltaBlue); pTintBy->initWithDuration(duration, deltaRed, deltaGreen, deltaBlue);
@ -1812,7 +1812,7 @@ CCTintBy* CCTintBy::actionWithDuration(cocos2d::ccTime duration, GLshort deltaRe
return pTintBy; return pTintBy;
} }
bool CCTintBy::initWithDuration(cocos2d::ccTime duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue) bool CCTintBy::initWithDuration(ccTime duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -1826,7 +1826,7 @@ bool CCTintBy::initWithDuration(cocos2d::ccTime duration, GLshort deltaRed, GLsh
return false; return false;
} }
CCObject* CCTintBy::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCTintBy::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCTintBy* pCopy = NULL; CCTintBy* pCopy = NULL;
@ -1863,7 +1863,7 @@ void CCTintBy::startWithTarget(CCNode *pTarget)
} }
} }
void CCTintBy::update(cocos2d::ccTime time) void CCTintBy::update(ccTime time)
{ {
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol(); CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
if (pRGBAProtocol) if (pRGBAProtocol)
@ -1882,7 +1882,7 @@ CCActionInterval* CCTintBy::reverse(void)
// //
// DelayTime // DelayTime
// //
CCDelayTime* CCDelayTime::actionWithDuration(cocos2d::ccTime d) CCDelayTime* CCDelayTime::actionWithDuration(ccTime d)
{ {
CCDelayTime* pAction = new CCDelayTime(); CCDelayTime* pAction = new CCDelayTime();
@ -1892,7 +1892,7 @@ CCDelayTime* CCDelayTime::actionWithDuration(cocos2d::ccTime d)
return pAction; return pAction;
} }
CCObject* CCDelayTime::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCDelayTime::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCDelayTime* pCopy = NULL; CCDelayTime* pCopy = NULL;
@ -1915,7 +1915,7 @@ CCObject* CCDelayTime::copyWithZone(cocos2d::CCZone *pZone)
return pCopy; return pCopy;
} }
void CCDelayTime::update(cocos2d::ccTime time) void CCDelayTime::update(ccTime time)
{ {
CC_UNUSED_PARAM(time); CC_UNUSED_PARAM(time);
return; return;
@ -1929,7 +1929,7 @@ CCActionInterval* CCDelayTime::reverse(void)
// //
// ReverseTime // ReverseTime
// //
CCReverseTime* CCReverseTime::actionWithAction(cocos2d::CCFiniteTimeAction *pAction) CCReverseTime* CCReverseTime::actionWithAction(CCFiniteTimeAction *pAction)
{ {
// casting to prevent warnings // casting to prevent warnings
CCReverseTime *pReverseTime = new CCReverseTime(); CCReverseTime *pReverseTime = new CCReverseTime();
@ -1939,7 +1939,7 @@ CCReverseTime* CCReverseTime::actionWithAction(cocos2d::CCFiniteTimeAction *pAct
return pReverseTime; return pReverseTime;
} }
bool CCReverseTime::initWithAction(cocos2d::CCFiniteTimeAction *pAction) bool CCReverseTime::initWithAction(CCFiniteTimeAction *pAction)
{ {
assert(pAction != NULL); assert(pAction != NULL);
assert(pAction != m_pOther); assert(pAction != m_pOther);
@ -1958,7 +1958,7 @@ bool CCReverseTime::initWithAction(cocos2d::CCFiniteTimeAction *pAction)
return false; return false;
} }
CCObject* CCReverseTime::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCReverseTime::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCReverseTime* pCopy = NULL; CCReverseTime* pCopy = NULL;
@ -2003,7 +2003,7 @@ void CCReverseTime::stop(void)
CCActionInterval::stop(); CCActionInterval::stop();
} }
void CCReverseTime::update(cocos2d::ccTime time) void CCReverseTime::update(ccTime time)
{ {
if (m_pOther) if (m_pOther)
{ {
@ -2019,7 +2019,7 @@ CCActionInterval* CCReverseTime::reverse(void)
// //
// Animate // Animate
// //
CCAnimate* CCAnimate::actionWithAnimation(cocos2d::CCAnimation *pAnimation) CCAnimate* CCAnimate::actionWithAnimation(CCAnimation *pAnimation)
{ {
CCAnimate *pAnimate = new CCAnimate(); CCAnimate *pAnimate = new CCAnimate();
pAnimate->initWithAnimation(pAnimation, true); pAnimate->initWithAnimation(pAnimation, true);
@ -2028,14 +2028,14 @@ CCAnimate* CCAnimate::actionWithAnimation(cocos2d::CCAnimation *pAnimation)
return pAnimate; return pAnimate;
} }
bool CCAnimate::initWithAnimation(cocos2d::CCAnimation *pAnimation) bool CCAnimate::initWithAnimation(CCAnimation *pAnimation)
{ {
assert(pAnimation != NULL); assert(pAnimation != NULL);
return initWithAnimation(pAnimation, true); return initWithAnimation(pAnimation, true);
} }
CCAnimate* CCAnimate::actionWithAnimation(cocos2d::CCAnimation *pAnimation, bool bRestoreOriginalFrame) CCAnimate* CCAnimate::actionWithAnimation(CCAnimation *pAnimation, bool bRestoreOriginalFrame)
{ {
CCAnimate *pAnimate = new CCAnimate(); CCAnimate *pAnimate = new CCAnimate();
pAnimate->initWithAnimation(pAnimation, bRestoreOriginalFrame); pAnimate->initWithAnimation(pAnimation, bRestoreOriginalFrame);
@ -2044,7 +2044,7 @@ CCAnimate* CCAnimate::actionWithAnimation(cocos2d::CCAnimation *pAnimation, bool
return pAnimate; return pAnimate;
} }
bool CCAnimate::initWithAnimation(cocos2d::CCAnimation *pAnimation, bool bRestoreOriginalFrame) bool CCAnimate::initWithAnimation(CCAnimation *pAnimation, bool bRestoreOriginalFrame)
{ {
assert(pAnimation); assert(pAnimation);
@ -2061,7 +2061,7 @@ bool CCAnimate::initWithAnimation(cocos2d::CCAnimation *pAnimation, bool bRestor
return false; return false;
} }
CCAnimate* CCAnimate::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCAnimation *pAnimation, bool bRestoreOriginalFrame) CCAnimate* CCAnimate::actionWithDuration(ccTime duration, CCAnimation *pAnimation, bool bRestoreOriginalFrame)
{ {
CCAnimate *pAnimate = new CCAnimate(); CCAnimate *pAnimate = new CCAnimate();
pAnimate->initWithDuration(duration, pAnimation, bRestoreOriginalFrame); pAnimate->initWithDuration(duration, pAnimation, bRestoreOriginalFrame);
@ -2070,7 +2070,7 @@ CCAnimate* CCAnimate::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCAn
return pAnimate; return pAnimate;
} }
bool CCAnimate::initWithDuration(cocos2d::ccTime duration, cocos2d::CCAnimation *pAnimation, bool bRestoreOriginalFrame) bool CCAnimate::initWithDuration(ccTime duration, CCAnimation *pAnimation, bool bRestoreOriginalFrame)
{ {
assert(pAnimation != NULL); assert(pAnimation != NULL);
@ -2087,7 +2087,7 @@ bool CCAnimate::initWithDuration(cocos2d::ccTime duration, cocos2d::CCAnimation
return false; return false;
} }
CCObject* CCAnimate::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCAnimate::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCAnimate* pCopy = NULL; CCAnimate* pCopy = NULL;
@ -2140,7 +2140,7 @@ void CCAnimate::stop(void)
CCActionInterval::stop(); CCActionInterval::stop();
} }
void CCAnimate::update(cocos2d::ccTime time) void CCAnimate::update(ccTime time)
{ {
CCMutableArray<CCSpriteFrame*> *pFrames = m_pAnimation->getFrames(); CCMutableArray<CCSpriteFrame*> *pFrames = m_pAnimation->getFrames();
unsigned int numberOfFrames = pFrames->count(); unsigned int numberOfFrames = pFrames->count();

View File

@ -189,7 +189,7 @@ void CCActionManager::resumeTarget(CCObject *pTarget)
// run // run
void CCActionManager::addAction(cocos2d::CCAction *pAction, CCNode *pTarget, bool paused) void CCActionManager::addAction(CCAction *pAction, CCNode *pTarget, bool paused)
{ {
assert(pAction != NULL); assert(pAction != NULL);
assert(pTarget != NULL); assert(pTarget != NULL);
@ -261,7 +261,7 @@ void CCActionManager::removeAllActionsFromTarget(CCObject *pTarget)
} }
} }
void CCActionManager::removeAction(cocos2d::CCAction *pAction) void CCActionManager::removeAction(CCAction *pAction)
{ {
// explicit null handling // explicit null handling
if (pAction == NULL) if (pAction == NULL)
@ -357,7 +357,7 @@ unsigned int CCActionManager::numberOfRunningActionsInTarget(CCObject *pTarget)
} }
// main loop // main loop
void CCActionManager::update(cocos2d::ccTime dt) void CCActionManager::update(ccTime dt)
{ {
for (tHashElement *elt = m_pTargets; elt != NULL; ) for (tHashElement *elt = m_pTargets; elt != NULL; )
{ {

View File

@ -26,7 +26,7 @@ THE SOFTWARE.
namespace cocos2d namespace cocos2d
{ {
CCPageTurn3D* CCPageTurn3D::actionWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime time) CCPageTurn3D* CCPageTurn3D::actionWithSize(const ccGridSize& gridSize, ccTime time)
{ {
CCPageTurn3D *pAction = new CCPageTurn3D(); CCPageTurn3D *pAction = new CCPageTurn3D();
@ -49,7 +49,7 @@ namespace cocos2d
* Update each tick * Update each tick
* Time is the percentage of the way through the duration * Time is the percentage of the way through the duration
*/ */
void CCPageTurn3D::update(cocos2d::ccTime time) void CCPageTurn3D::update(ccTime time)
{ {
float tt = MAX(0, time - 0.25f); float tt = MAX(0, time - 0.25f);
float deltaAy = (tt * tt * 500); float deltaAy = (tt * tt * 500);

View File

@ -31,7 +31,7 @@ namespace cocos2d
// implementation of CCProgressTo // implementation of CCProgressTo
CCProgressTo* CCProgressTo::actionWithDuration(cocos2d::ccTime duration, float fPercent) CCProgressTo* CCProgressTo::actionWithDuration(ccTime duration, float fPercent)
{ {
CCProgressTo *pProgressTo = new CCProgressTo(); CCProgressTo *pProgressTo = new CCProgressTo();
pProgressTo->initWithDuration(duration, fPercent); pProgressTo->initWithDuration(duration, fPercent);
@ -40,7 +40,7 @@ namespace cocos2d
return pProgressTo; return pProgressTo;
} }
bool CCProgressTo::initWithDuration(cocos2d::ccTime duration, float fPercent) bool CCProgressTo::initWithDuration(ccTime duration, float fPercent)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -52,7 +52,7 @@ namespace cocos2d
return false; return false;
} }
CCObject* CCProgressTo::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCProgressTo::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCProgressTo* pCopy = NULL; CCProgressTo* pCopy = NULL;
@ -88,14 +88,14 @@ namespace cocos2d
} }
} }
void CCProgressTo::update(cocos2d::ccTime time) void CCProgressTo::update(ccTime time)
{ {
((kProgressTimerCast)(m_pTarget))->setPercentage(m_fFrom + (m_fTo - m_fFrom) * time); ((kProgressTimerCast)(m_pTarget))->setPercentage(m_fFrom + (m_fTo - m_fFrom) * time);
} }
// implementation of CCProgressFromTo // implementation of CCProgressFromTo
CCProgressFromTo* CCProgressFromTo::actionWithDuration(cocos2d::ccTime duration, float fFromPercentage, float fToPercentage) CCProgressFromTo* CCProgressFromTo::actionWithDuration(ccTime duration, float fFromPercentage, float fToPercentage)
{ {
CCProgressFromTo *pProgressFromTo = new CCProgressFromTo(); CCProgressFromTo *pProgressFromTo = new CCProgressFromTo();
pProgressFromTo->initWithDuration(duration, fFromPercentage, fToPercentage); pProgressFromTo->initWithDuration(duration, fFromPercentage, fToPercentage);
@ -104,7 +104,7 @@ namespace cocos2d
return pProgressFromTo; return pProgressFromTo;
} }
bool CCProgressFromTo::initWithDuration(cocos2d::ccTime duration, float fFromPercentage, float fToPercentage) bool CCProgressFromTo::initWithDuration(ccTime duration, float fFromPercentage, float fToPercentage)
{ {
if (CCActionInterval::initWithDuration(duration)) if (CCActionInterval::initWithDuration(duration))
{ {
@ -117,7 +117,7 @@ namespace cocos2d
return false; return false;
} }
CCObject* CCProgressFromTo::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCProgressFromTo::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCProgressFromTo* pCopy = NULL; CCProgressFromTo* pCopy = NULL;
@ -150,7 +150,7 @@ namespace cocos2d
CCActionInterval::startWithTarget(pTarget); CCActionInterval::startWithTarget(pTarget);
} }
void CCProgressFromTo::update(cocos2d::ccTime time) void CCProgressFromTo::update(ccTime time)
{ {
((kProgressTimerCast)(m_pTarget))->setPercentage(m_fFrom + (m_fTo - m_fFrom) * time); ((kProgressTimerCast)(m_pTarget))->setPercentage(m_fFrom + (m_fTo - m_fFrom) * time);
} }

View File

@ -41,7 +41,7 @@ namespace cocos2d
// implementation of ShakyTiles3D // implementation of ShakyTiles3D
CCShakyTiles3D* CCShakyTiles3D::actionWithRange(int nRange, bool bShakeZ, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) CCShakyTiles3D* CCShakyTiles3D::actionWithRange(int nRange, bool bShakeZ,const ccGridSize& gridSize, ccTime duration)
{ {
CCShakyTiles3D *pAction = new CCShakyTiles3D(); CCShakyTiles3D *pAction = new CCShakyTiles3D();
@ -60,7 +60,7 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCShakyTiles3D::initWithRange(int nRange, bool bShakeZ, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) bool CCShakyTiles3D::initWithRange(int nRange, bool bShakeZ, const ccGridSize& gridSize, ccTime duration)
{ {
if (CCTiledGrid3DAction::initWithSize(gridSize, duration)) if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{ {
@ -73,7 +73,7 @@ namespace cocos2d
return false; return false;
} }
CCObject* CCShakyTiles3D::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCShakyTiles3D::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCShakyTiles3D* pCopy = NULL; CCShakyTiles3D* pCopy = NULL;
@ -96,7 +96,7 @@ namespace cocos2d
return pCopy; return pCopy;
} }
void CCShakyTiles3D::update(cocos2d::ccTime time) void CCShakyTiles3D::update(ccTime time)
{ {
CC_UNUSED_PARAM(time); CC_UNUSED_PARAM(time);
int i, j; int i, j;
@ -134,7 +134,7 @@ namespace cocos2d
// implementation of CCShatteredTiles3D // implementation of CCShatteredTiles3D
CCShatteredTiles3D* CCShatteredTiles3D::actionWithRange(int nRange, bool bShatterZ, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) CCShatteredTiles3D* CCShatteredTiles3D::actionWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize, ccTime duration)
{ {
CCShatteredTiles3D *pAction = new CCShatteredTiles3D(); CCShatteredTiles3D *pAction = new CCShatteredTiles3D();
@ -153,7 +153,7 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCShatteredTiles3D::initWithRange(int nRange, bool bShatterZ, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) bool CCShatteredTiles3D::initWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize, ccTime duration)
{ {
if (CCTiledGrid3DAction::initWithSize(gridSize, duration)) if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{ {
@ -167,7 +167,7 @@ namespace cocos2d
return false; return false;
} }
CCObject* CCShatteredTiles3D::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCShatteredTiles3D::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCShatteredTiles3D* pCopy = NULL; CCShatteredTiles3D* pCopy = NULL;
@ -190,7 +190,7 @@ namespace cocos2d
return pCopy; return pCopy;
} }
void CCShatteredTiles3D::update(cocos2d::ccTime time) void CCShatteredTiles3D::update(ccTime time)
{ {
CC_UNUSED_PARAM(time); CC_UNUSED_PARAM(time);
int i, j; int i, j;
@ -233,7 +233,7 @@ namespace cocos2d
// implementation of CCShuffleTiles // implementation of CCShuffleTiles
CCShuffleTiles* CCShuffleTiles::actionWithSeed(int s, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) CCShuffleTiles* CCShuffleTiles::actionWithSeed(int s, const ccGridSize& gridSize, ccTime duration)
{ {
CCShuffleTiles *pAction = new CCShuffleTiles(); CCShuffleTiles *pAction = new CCShuffleTiles();
@ -252,7 +252,7 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCShuffleTiles::initWithSeed(int s, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) bool CCShuffleTiles::initWithSeed(int s, const ccGridSize& gridSize, ccTime duration)
{ {
if (CCTiledGrid3DAction::initWithSize(gridSize, duration)) if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{ {
@ -266,7 +266,7 @@ namespace cocos2d
return false; return false;
} }
CCObject* CCShuffleTiles::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCShuffleTiles::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCShuffleTiles* pCopy = NULL; CCShuffleTiles* pCopy = NULL;
@ -306,7 +306,7 @@ namespace cocos2d
} }
} }
ccGridSize CCShuffleTiles::getDelta(cocos2d::ccGridSize pos) ccGridSize CCShuffleTiles::getDelta(const ccGridSize& pos)
{ {
CCPoint pos2; CCPoint pos2;
@ -318,7 +318,7 @@ namespace cocos2d
return ccg((int)(pos2.x - pos.x), (int)(pos2.y - pos.y)); return ccg((int)(pos2.x - pos.x), (int)(pos2.y - pos.y));
} }
void CCShuffleTiles::placeTile(ccGridSize pos, Tile *t) void CCShuffleTiles::placeTile(const ccGridSize& pos, Tile *t)
{ {
ccQuad3 coords = originalTile(pos); ccQuad3 coords = originalTile(pos);
@ -378,7 +378,7 @@ namespace cocos2d
} }
} }
void CCShuffleTiles::update(cocos2d::ccTime time) void CCShuffleTiles::update(ccTime time)
{ {
int i, j; int i, j;
@ -397,7 +397,7 @@ namespace cocos2d
// implementation of CCFadeOutTRTiles // implementation of CCFadeOutTRTiles
CCFadeOutTRTiles* CCFadeOutTRTiles::actionWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime time) CCFadeOutTRTiles* CCFadeOutTRTiles::actionWithSize(const ccGridSize& gridSize, ccTime time)
{ {
CCFadeOutTRTiles *pAction = new CCFadeOutTRTiles(); CCFadeOutTRTiles *pAction = new CCFadeOutTRTiles();
@ -416,7 +416,7 @@ namespace cocos2d
return pAction; return pAction;
} }
float CCFadeOutTRTiles::testFunc(cocos2d::ccGridSize pos, cocos2d::ccTime time) float CCFadeOutTRTiles::testFunc(const ccGridSize& pos, ccTime time)
{ {
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), time); CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), time);
if ((n.x + n.y) == 0.0f) if ((n.x + n.y) == 0.0f)
@ -427,19 +427,19 @@ namespace cocos2d
return powf((pos.x + pos.y) / (n.x + n.y), 6); return powf((pos.x + pos.y) / (n.x + n.y), 6);
} }
void CCFadeOutTRTiles::turnOnTile(cocos2d::ccGridSize pos) void CCFadeOutTRTiles::turnOnTile(const ccGridSize& pos)
{ {
setTile(pos, originalTile(pos)); setTile(pos, originalTile(pos));
} }
void CCFadeOutTRTiles::turnOffTile(cocos2d::ccGridSize pos) void CCFadeOutTRTiles::turnOffTile(const ccGridSize& pos)
{ {
ccQuad3 coords; ccQuad3 coords;
memset(&coords, 0, sizeof(ccQuad3)); memset(&coords, 0, sizeof(ccQuad3));
setTile(pos, coords); setTile(pos, coords);
} }
void CCFadeOutTRTiles::transformTile(cocos2d::ccGridSize pos, float distance) void CCFadeOutTRTiles::transformTile(const ccGridSize& pos, float distance)
{ {
ccQuad3 coords = originalTile(pos); ccQuad3 coords = originalTile(pos);
CCPoint step = m_pTarget->getGrid()->getStep(); CCPoint step = m_pTarget->getGrid()->getStep();
@ -459,7 +459,7 @@ namespace cocos2d
setTile(pos, coords); setTile(pos, coords);
} }
void CCFadeOutTRTiles::update(cocos2d::ccTime time) void CCFadeOutTRTiles::update(ccTime time)
{ {
int i, j; int i, j;
@ -485,7 +485,7 @@ namespace cocos2d
} }
// implementation of CCFadeOutBLTiles // implementation of CCFadeOutBLTiles
CCFadeOutBLTiles* CCFadeOutBLTiles::actionWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime time) CCFadeOutBLTiles* CCFadeOutBLTiles::actionWithSize(const ccGridSize& gridSize, ccTime time)
{ {
CCFadeOutBLTiles *pAction = new CCFadeOutBLTiles(); CCFadeOutBLTiles *pAction = new CCFadeOutBLTiles();
@ -504,7 +504,7 @@ namespace cocos2d
return pAction; return pAction;
} }
float CCFadeOutBLTiles::testFunc(cocos2d::ccGridSize pos, cocos2d::ccTime time) float CCFadeOutBLTiles::testFunc(const ccGridSize& pos, ccTime time)
{ {
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), (1.0f - time)); CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), (1.0f - time));
if ((pos.x + pos.y) == 0) if ((pos.x + pos.y) == 0)
@ -517,7 +517,7 @@ namespace cocos2d
// implementation of CCFadeOutUpTiles // implementation of CCFadeOutUpTiles
CCFadeOutUpTiles* CCFadeOutUpTiles::actionWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime time) CCFadeOutUpTiles* CCFadeOutUpTiles::actionWithSize(const ccGridSize& gridSize, ccTime time)
{ {
CCFadeOutUpTiles *pAction = new CCFadeOutUpTiles(); CCFadeOutUpTiles *pAction = new CCFadeOutUpTiles();
@ -536,7 +536,7 @@ namespace cocos2d
return pAction; return pAction;
} }
float CCFadeOutUpTiles::testFunc(cocos2d::ccGridSize pos, cocos2d::ccTime time) float CCFadeOutUpTiles::testFunc(const ccGridSize& pos, ccTime time)
{ {
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), time); CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), time);
if (n.y == 0.0f) if (n.y == 0.0f)
@ -547,7 +547,7 @@ namespace cocos2d
return powf(pos.y / n.y, 6); return powf(pos.y / n.y, 6);
} }
void CCFadeOutUpTiles::transformTile(cocos2d::ccGridSize pos, float distance) void CCFadeOutUpTiles::transformTile(const ccGridSize& pos, float distance)
{ {
ccQuad3 coords = originalTile(pos); ccQuad3 coords = originalTile(pos);
CCPoint step = m_pTarget->getGrid()->getStep(); CCPoint step = m_pTarget->getGrid()->getStep();
@ -561,7 +561,7 @@ namespace cocos2d
} }
// implementation of CCFadeOutDownTiles // implementation of CCFadeOutDownTiles
CCFadeOutDownTiles* CCFadeOutDownTiles::actionWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime time) CCFadeOutDownTiles* CCFadeOutDownTiles::actionWithSize(const ccGridSize& gridSize, ccTime time)
{ {
CCFadeOutDownTiles *pAction = new CCFadeOutDownTiles(); CCFadeOutDownTiles *pAction = new CCFadeOutDownTiles();
@ -580,7 +580,7 @@ namespace cocos2d
return pAction; return pAction;
} }
float CCFadeOutDownTiles::testFunc(cocos2d::ccGridSize pos, cocos2d::ccTime time) float CCFadeOutDownTiles::testFunc(const ccGridSize& pos, ccTime time)
{ {
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), (1.0f - time)); CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), (1.0f - time));
if (pos.y == 0) if (pos.y == 0)
@ -592,7 +592,7 @@ namespace cocos2d
} }
// implementation of TurnOffTiles // implementation of TurnOffTiles
CCTurnOffTiles* CCTurnOffTiles::actionWithSize(ccGridSize size, ccTime d) CCTurnOffTiles* CCTurnOffTiles::actionWithSize(const ccGridSize& size, ccTime d)
{ {
CCTurnOffTiles* pAction = new CCTurnOffTiles(); CCTurnOffTiles* pAction = new CCTurnOffTiles();
if (pAction->initWithSize(size, d)) if (pAction->initWithSize(size, d))
@ -606,7 +606,7 @@ namespace cocos2d
return pAction; return pAction;
} }
CCTurnOffTiles* CCTurnOffTiles::actionWithSeed(int s, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) CCTurnOffTiles* CCTurnOffTiles::actionWithSeed(int s, const ccGridSize& gridSize, ccTime duration)
{ {
CCTurnOffTiles *pAction = new CCTurnOffTiles(); CCTurnOffTiles *pAction = new CCTurnOffTiles();
@ -625,7 +625,7 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCTurnOffTiles::initWithSeed(int s, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) bool CCTurnOffTiles::initWithSeed(int s, const ccGridSize& gridSize, ccTime duration)
{ {
if (CCTiledGrid3DAction::initWithSize(gridSize, duration)) if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{ {
@ -638,7 +638,7 @@ namespace cocos2d
return false; return false;
} }
CCObject* CCTurnOffTiles::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCTurnOffTiles::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCTurnOffTiles* pCopy = NULL; CCTurnOffTiles* pCopy = NULL;
@ -677,12 +677,12 @@ namespace cocos2d
} }
} }
void CCTurnOffTiles::turnOnTile(cocos2d::ccGridSize pos) void CCTurnOffTiles::turnOnTile(const ccGridSize& pos)
{ {
setTile(pos, originalTile(pos)); setTile(pos, originalTile(pos));
} }
void CCTurnOffTiles::turnOffTile(cocos2d::ccGridSize pos) void CCTurnOffTiles::turnOffTile(const ccGridSize& pos)
{ {
ccQuad3 coords; ccQuad3 coords;
@ -712,7 +712,7 @@ namespace cocos2d
shuffle(m_pTilesOrder, m_nTilesCount); shuffle(m_pTilesOrder, m_nTilesCount);
} }
void CCTurnOffTiles::update(cocos2d::ccTime time) void CCTurnOffTiles::update(ccTime time)
{ {
unsigned int i, l, t; unsigned int i, l, t;
@ -736,7 +736,7 @@ namespace cocos2d
// implementation of CCWavesTiles3D // implementation of CCWavesTiles3D
CCWavesTiles3D* CCWavesTiles3D::actionWithWaves(int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) CCWavesTiles3D* CCWavesTiles3D::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{ {
CCWavesTiles3D *pAction = new CCWavesTiles3D(); CCWavesTiles3D *pAction = new CCWavesTiles3D();
@ -755,7 +755,7 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCWavesTiles3D::initWithWaves(int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) bool CCWavesTiles3D::initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{ {
if (CCTiledGrid3DAction::initWithSize(gridSize, duration)) if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{ {
@ -769,7 +769,7 @@ namespace cocos2d
return false; return false;
} }
CCObject* CCWavesTiles3D::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCWavesTiles3D::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCWavesTiles3D* pCopy = NULL; CCWavesTiles3D* pCopy = NULL;
@ -791,7 +791,7 @@ namespace cocos2d
return pCopy; return pCopy;
} }
void CCWavesTiles3D::update(cocos2d::ccTime time) void CCWavesTiles3D::update(ccTime time)
{ {
int i, j; int i, j;
@ -814,7 +814,7 @@ namespace cocos2d
// implementation of CCJumpTiles3D // implementation of CCJumpTiles3D
CCJumpTiles3D* CCJumpTiles3D::actionWithJumps(int j, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) CCJumpTiles3D* CCJumpTiles3D::actionWithJumps(int j, float amp, const ccGridSize& gridSize, ccTime duration)
{ {
CCJumpTiles3D *pAction = new CCJumpTiles3D(); CCJumpTiles3D *pAction = new CCJumpTiles3D();
@ -833,7 +833,7 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCJumpTiles3D::initWithJumps(int j, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) bool CCJumpTiles3D::initWithJumps(int j, float amp, const ccGridSize& gridSize, ccTime duration)
{ {
if (CCTiledGrid3DAction::initWithSize(gridSize, duration)) if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{ {
@ -847,7 +847,7 @@ namespace cocos2d
return false; return false;
} }
CCObject* CCJumpTiles3D::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCJumpTiles3D::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCJumpTiles3D* pCopy = NULL; CCJumpTiles3D* pCopy = NULL;
@ -868,7 +868,7 @@ namespace cocos2d
return pCopy; return pCopy;
} }
void CCJumpTiles3D::update(cocos2d::ccTime time) void CCJumpTiles3D::update(ccTime time)
{ {
int i, j; int i, j;
@ -903,7 +903,7 @@ namespace cocos2d
// implementation of CCSplitRows // implementation of CCSplitRows
CCSplitRows* CCSplitRows::actionWithRows(int nRows, cocos2d::ccTime duration) CCSplitRows* CCSplitRows::actionWithRows(int nRows, ccTime duration)
{ {
CCSplitRows *pAction = new CCSplitRows(); CCSplitRows *pAction = new CCSplitRows();
@ -922,14 +922,14 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCSplitRows::initWithRows(int nRows, cocos2d::ccTime duration) bool CCSplitRows::initWithRows(int nRows, ccTime duration)
{ {
m_nRows = nRows; m_nRows = nRows;
return CCTiledGrid3DAction::initWithSize(ccg(1, nRows), duration); return CCTiledGrid3DAction::initWithSize(ccg(1, nRows), duration);
} }
CCObject* CCSplitRows::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCSplitRows::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCSplitRows* pCopy = NULL; CCSplitRows* pCopy = NULL;
@ -957,7 +957,7 @@ namespace cocos2d
m_winSize = CCDirector::sharedDirector()->getWinSizeInPixels(); m_winSize = CCDirector::sharedDirector()->getWinSizeInPixels();
} }
void CCSplitRows::update(cocos2d::ccTime time) void CCSplitRows::update(ccTime time)
{ {
int j; int j;
@ -982,7 +982,7 @@ namespace cocos2d
// implementation of CCSplitCols // implementation of CCSplitCols
CCSplitCols* CCSplitCols::actionWithCols(int nCols, cocos2d::ccTime duration) CCSplitCols* CCSplitCols::actionWithCols(int nCols, ccTime duration)
{ {
CCSplitCols *pAction = new CCSplitCols(); CCSplitCols *pAction = new CCSplitCols();
@ -1001,13 +1001,13 @@ namespace cocos2d
return pAction; return pAction;
} }
bool CCSplitCols::initWithCols(int nCols, cocos2d::ccTime duration) bool CCSplitCols::initWithCols(int nCols, ccTime duration)
{ {
m_nCols = nCols; m_nCols = nCols;
return CCTiledGrid3DAction::initWithSize(ccg(nCols, 1), duration); return CCTiledGrid3DAction::initWithSize(ccg(nCols, 1), duration);
} }
CCObject* CCSplitCols::copyWithZone(cocos2d::CCZone *pZone) CCObject* CCSplitCols::copyWithZone(CCZone *pZone)
{ {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCSplitCols* pCopy = NULL; CCSplitCols* pCopy = NULL;
@ -1034,7 +1034,7 @@ namespace cocos2d
m_winSize = CCDirector::sharedDirector()->getWinSizeInPixels(); m_winSize = CCDirector::sharedDirector()->getWinSizeInPixels();
} }
void CCSplitCols::update(cocos2d::ccTime time) void CCSplitCols::update(ccTime time)
{ {
int i; int i;

View File

@ -104,7 +104,7 @@ bool CCAtlasNode::initWithTileFile(const char *tile, unsigned int tileWidth, uns
void CCAtlasNode::calculateMaxItems() void CCAtlasNode::calculateMaxItems()
{ {
CCSize s = m_pTextureAtlas->getTexture()->getContentSizeInPixels(); const CCSize& s = m_pTextureAtlas->getTexture()->getContentSizeInPixels();
m_uItemsPerColumn = (int)(s.height / m_uItemHeight); m_uItemsPerColumn = (int)(s.height / m_uItemHeight);
m_uItemsPerRow = (int)(s.width / m_uItemWidth); m_uItemsPerRow = (int)(s.width / m_uItemWidth);
} }
@ -151,7 +151,7 @@ void CCAtlasNode::draw()
// CCAtlasNode - RGBA protocol // CCAtlasNode - RGBA protocol
ccColor3B CCAtlasNode:: getColor() const ccColor3B& CCAtlasNode:: getColor()
{ {
if(m_bIsOpacityModifyRGB) if(m_bIsOpacityModifyRGB)
{ {
@ -160,7 +160,7 @@ ccColor3B CCAtlasNode:: getColor()
return m_tColor; return m_tColor;
} }
void CCAtlasNode::setColor(ccColor3B color3) void CCAtlasNode::setColor(const ccColor3B& color3)
{ {
m_tColor = m_tColorUnmodified = color3; m_tColor = m_tColorUnmodified = color3;

View File

@ -243,13 +243,13 @@ void CCNode::setScaleY(float newScaleY)
} }
/// position getter /// position getter
CCPoint CCNode::getPosition() const CCPoint& CCNode::getPosition()
{ {
return m_tPosition; return m_tPosition;
} }
/// position setter /// position setter
void CCNode::setPosition(CCPoint newPosition) void CCNode::setPosition(const CCPoint& newPosition)
{ {
m_tPosition = newPosition; m_tPosition = newPosition;
if (CC_CONTENT_SCALE_FACTOR() == 1) if (CC_CONTENT_SCALE_FACTOR() == 1)
@ -267,7 +267,7 @@ void CCNode::setPosition(CCPoint newPosition)
#endif #endif
} }
void CCNode::setPositionInPixels(CCPoint newPosition) void CCNode::setPositionInPixels(const CCPoint& newPosition)
{ {
m_tPositionInPixels = newPosition; m_tPositionInPixels = newPosition;
@ -287,7 +287,7 @@ void CCNode::setPositionInPixels(CCPoint newPosition)
#endif // CC_NODE_TRANSFORM_USING_AFFINE_MATRIX #endif // CC_NODE_TRANSFORM_USING_AFFINE_MATRIX
} }
CCPoint CCNode::getPositionInPixels() const CCPoint& CCNode::getPositionInPixels()
{ {
return m_tPositionInPixels; return m_tPositionInPixels;
} }
@ -339,12 +339,12 @@ void CCNode::setIsVisible(bool var)
/// anchorPoint getter /// anchorPoint getter
CCPoint CCNode::getAnchorPoint() const CCPoint& CCNode::getAnchorPoint()
{ {
return m_tAnchorPoint; return m_tAnchorPoint;
} }
void CCNode::setAnchorPoint(CCPoint point) void CCNode::setAnchorPoint(const CCPoint& point)
{ {
if( ! CCPoint::CCPointEqualToPoint(point, m_tAnchorPoint) ) if( ! CCPoint::CCPointEqualToPoint(point, m_tAnchorPoint) )
{ {
@ -358,18 +358,18 @@ void CCNode::setAnchorPoint(CCPoint point)
} }
/// anchorPointInPixels getter /// anchorPointInPixels getter
CCPoint CCNode::getAnchorPointInPixels() const CCPoint& CCNode::getAnchorPointInPixels()
{ {
return m_tAnchorPointInPixels; return m_tAnchorPointInPixels;
} }
/// contentSize getter /// contentSize getter
CCSize CCNode::getContentSize() const CCSize& CCNode::getContentSize()
{ {
return m_tContentSize; return m_tContentSize;
} }
void CCNode::setContentSize(CCSize size) void CCNode::setContentSize(const CCSize& size)
{ {
if( ! CCSize::CCSizeEqualToSize(size, m_tContentSize) ) if( ! CCSize::CCSizeEqualToSize(size, m_tContentSize) )
{ {
@ -392,7 +392,7 @@ void CCNode::setContentSize(CCSize size)
} }
} }
void CCNode::setContentSizeInPixels(CCSize size) void CCNode::setContentSizeInPixels(const CCSize& size)
{ {
if (! CCSize::CCSizeEqualToSize(size, m_tContentSizeInPixels)) if (! CCSize::CCSizeEqualToSize(size, m_tContentSizeInPixels))
{ {
@ -416,7 +416,7 @@ void CCNode::setContentSizeInPixels(CCSize size)
} }
} }
CCSize CCNode::getContentSizeInPixels() const CCSize& CCNode::getContentSizeInPixels()
{ {
return m_tContentSizeInPixels; return m_tContentSizeInPixels;
} }
@ -1071,7 +1071,7 @@ CCAffineTransform CCNode::worldToNodeTransform(void)
return CCAffineTransformInvert(this->nodeToWorldTransform()); return CCAffineTransformInvert(this->nodeToWorldTransform());
} }
CCPoint CCNode::convertToNodeSpace(CCPoint worldPoint) CCPoint CCNode::convertToNodeSpace(const CCPoint& worldPoint)
{ {
CCPoint ret; CCPoint ret;
if(CC_CONTENT_SCALE_FACTOR() == 1) if(CC_CONTENT_SCALE_FACTOR() == 1)
@ -1088,7 +1088,7 @@ CCPoint CCNode::convertToNodeSpace(CCPoint worldPoint)
return ret; return ret;
} }
CCPoint CCNode::convertToWorldSpace(CCPoint nodePoint) CCPoint CCNode::convertToWorldSpace(const CCPoint& nodePoint)
{ {
CCPoint ret; CCPoint ret;
if(CC_CONTENT_SCALE_FACTOR() == 1) if(CC_CONTENT_SCALE_FACTOR() == 1)
@ -1105,7 +1105,7 @@ CCPoint CCNode::convertToWorldSpace(CCPoint nodePoint)
return ret; return ret;
} }
CCPoint CCNode::convertToNodeSpaceAR(CCPoint worldPoint) CCPoint CCNode::convertToNodeSpaceAR(const CCPoint& worldPoint)
{ {
CCPoint nodePoint = convertToNodeSpace(worldPoint); CCPoint nodePoint = convertToNodeSpace(worldPoint);
CCPoint anchorInPoints; CCPoint anchorInPoints;
@ -1121,7 +1121,7 @@ CCPoint CCNode::convertToNodeSpaceAR(CCPoint worldPoint)
return ccpSub(nodePoint, anchorInPoints); return ccpSub(nodePoint, anchorInPoints);
} }
CCPoint CCNode::convertToWorldSpaceAR(CCPoint nodePoint) CCPoint CCNode::convertToWorldSpaceAR(const CCPoint& nodePoint)
{ {
CCPoint anchorInPoints; CCPoint anchorInPoints;
if( CC_CONTENT_SCALE_FACTOR() == 1 ) if( CC_CONTENT_SCALE_FACTOR() == 1 )
@ -1133,10 +1133,10 @@ CCPoint CCNode::convertToWorldSpaceAR(CCPoint nodePoint)
anchorInPoints = ccpMult( m_tAnchorPointInPixels, 1/CC_CONTENT_SCALE_FACTOR() ); anchorInPoints = ccpMult( m_tAnchorPointInPixels, 1/CC_CONTENT_SCALE_FACTOR() );
} }
nodePoint = ccpAdd(nodePoint, anchorInPoints); CCPoint pt = ccpAdd(nodePoint, anchorInPoints);
return convertToWorldSpace(nodePoint); return convertToWorldSpace(pt);
} }
CCPoint CCNode::convertToWindowSpace(CCPoint nodePoint) CCPoint CCNode::convertToWindowSpace(const CCPoint& nodePoint)
{ {
CCPoint worldPoint = this->convertToWorldSpace(nodePoint); CCPoint worldPoint = this->convertToWorldSpace(nodePoint);
return CCDirector::sharedDirector()->convertToUI(worldPoint); return CCDirector::sharedDirector()->convertToUI(worldPoint);

View File

@ -37,7 +37,7 @@ CCAffineTransform __CCAffineTransformMake(CGFloat a, CGFloat b, CGFloat c, CGFlo
return t; return t;
} }
CCPoint __CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t) CCPoint __CCPointApplyAffineTransform(const CCPoint& point, const CCAffineTransform& t)
{ {
CCPoint p; CCPoint p;
p.x = (CGFloat)((double)t.a * point.x + (double)t.c * point.y + t.tx); p.x = (CGFloat)((double)t.a * point.x + (double)t.c * point.y + t.tx);
@ -45,7 +45,7 @@ CCPoint __CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t)
return p; return p;
} }
CCSize __CCSizeApplyAffineTransform(CCSize size, CCAffineTransform t) CCSize __CCSizeApplyAffineTransform(const CCSize& size, const CCAffineTransform& t)
{ {
CCSize s; CCSize s;
s.width = (CGFloat)((double)t.a * size.width + (double)t.c * size.height); s.width = (CGFloat)((double)t.a * size.width + (double)t.c * size.height);
@ -62,7 +62,7 @@ CCAffineTransform CCAffineTransformMakeIdentity()
extern const CCAffineTransform CCAffineTransformIdentity = CCAffineTransformMakeIdentity(); extern const CCAffineTransform CCAffineTransformIdentity = CCAffineTransformMakeIdentity();
CCRect CCRectApplyAffineTransform(CCRect rect, CCAffineTransform anAffineTransform) CCRect CCRectApplyAffineTransform(const CCRect& rect, const CCAffineTransform& anAffineTransform)
{ {
CGFloat top = CCRect::CCRectGetMinY(rect); CGFloat top = CCRect::CCRectGetMinY(rect);
CGFloat left = CCRect::CCRectGetMinX(rect); CGFloat left = CCRect::CCRectGetMinX(rect);
@ -82,17 +82,17 @@ CCRect CCRectApplyAffineTransform(CCRect rect, CCAffineTransform anAffineTransfo
return CCRectMake(minX, minY, (maxX - minX), (maxY - minY)); return CCRectMake(minX, minY, (maxX - minX), (maxY - minY));
} }
CCAffineTransform CCAffineTransformTranslate(CCAffineTransform t, float tx, float ty) CCAffineTransform CCAffineTransformTranslate(const CCAffineTransform& t, float tx, float ty)
{ {
return __CCAffineTransformMake(t.a, t.b, t.c, t.d, t.tx + t.a * tx + t.c * ty, t.ty + t.b * tx + t.d * ty); return __CCAffineTransformMake(t.a, t.b, t.c, t.d, t.tx + t.a * tx + t.c * ty, t.ty + t.b * tx + t.d * ty);
} }
CCAffineTransform CCAffineTransformScale(CCAffineTransform t, CGFloat sx, CGFloat sy) CCAffineTransform CCAffineTransformScale(const CCAffineTransform& t, CGFloat sx, CGFloat sy)
{ {
return __CCAffineTransformMake(t.a * sx, t.b * sx, t.c * sy, t.d * sy, t.tx, t.ty); return __CCAffineTransformMake(t.a * sx, t.b * sx, t.c * sy, t.d * sy, t.tx, t.ty);
} }
CCAffineTransform CCAffineTransformRotate(CCAffineTransform t, CGFloat anAngle) CCAffineTransform CCAffineTransformRotate(const CCAffineTransform& t, CGFloat anAngle)
{ {
float fSin = sin(anAngle); float fSin = sin(anAngle);
float fCos = cos(anAngle); float fCos = cos(anAngle);
@ -107,7 +107,7 @@ CCAffineTransform CCAffineTransformRotate(CCAffineTransform t, CGFloat anAngle)
/* Concatenate `t2' to `t1' and return the result: /* Concatenate `t2' to `t1' and return the result:
t' = t1 * t2 */ t' = t1 * t2 */
CCAffineTransform CCAffineTransformConcat(CCAffineTransform t1,CCAffineTransform t2) CCAffineTransform CCAffineTransformConcat(const CCAffineTransform& t1, const CCAffineTransform& t2)
{ {
return __CCAffineTransformMake( t1.a * t2.a + t1.b * t2.c, t1.a * t2.b + t1.b * t2.d, //a,b return __CCAffineTransformMake( t1.a * t2.a + t1.b * t2.c, t1.a * t2.b + t1.b * t2.d, //a,b
t1.c * t2.a + t1.d * t2.c, t1.c * t2.b + t1.d * t2.d, //c,d t1.c * t2.a + t1.d * t2.c, t1.c * t2.b + t1.d * t2.d, //c,d
@ -116,12 +116,12 @@ CCAffineTransform CCAffineTransformConcat(CCAffineTransform t1,CCAffineTransform
} }
/* Return true if `t1' and `t2' are equal, false otherwise. */ /* Return true if `t1' and `t2' are equal, false otherwise. */
bool CCAffineTransformEqualToTransform(CCAffineTransform t1,CCAffineTransform t2) bool CCAffineTransformEqualToTransform(const CCAffineTransform& t1, const CCAffineTransform& t2)
{ {
return (t1.a == t2.a && t1.b == t2.b && t1.c == t2.c && t1.d == t2.d && t1.tx == t2.tx && t1.ty == t2.ty); return (t1.a == t2.a && t1.b == t2.b && t1.c == t2.c && t1.d == t2.d && t1.tx == t2.tx && t1.ty == t2.ty);
} }
CCAffineTransform CCAffineTransformInvert(CCAffineTransform t) CCAffineTransform CCAffineTransformInvert(const CCAffineTransform& t)
{ {
float determinant = 1 / (t.a * t.d - t.b * t.c); float determinant = 1 / (t.a * t.d - t.b * t.c);

View File

@ -46,7 +46,7 @@ namespace cocos2d
ccglGenFramebuffers(1, &m_fbo); ccglGenFramebuffers(1, &m_fbo);
} }
void CCGrabber::grab(cocos2d::CCTexture2D *pTexture) void CCGrabber::grab(CCTexture2D *pTexture)
{ {
// If the gles version is lower than GLES_VER_1_0, // If the gles version is lower than GLES_VER_1_0,
// all the functions in CCGrabber return directly. // all the functions in CCGrabber return directly.
@ -74,7 +74,7 @@ namespace cocos2d
ccglBindFramebuffer(CC_GL_FRAMEBUFFER, m_oldFBO); ccglBindFramebuffer(CC_GL_FRAMEBUFFER, m_oldFBO);
} }
void CCGrabber::beforeRender(cocos2d::CCTexture2D *pTexture) void CCGrabber::beforeRender(CCTexture2D *pTexture)
{ {
CC_UNUSED_PARAM(pTexture); CC_UNUSED_PARAM(pTexture);
// If the gles version is lower than GLES_VER_1_0, // If the gles version is lower than GLES_VER_1_0,

View File

@ -35,7 +35,7 @@ namespace cocos2d
{ {
// implementation of CCGridBase // implementation of CCGridBase
CCGridBase* CCGridBase::gridWithSize(cocos2d::ccGridSize gridSize) CCGridBase* CCGridBase::gridWithSize(const ccGridSize& gridSize)
{ {
CCGridBase *pGridBase = new CCGridBase(); CCGridBase *pGridBase = new CCGridBase();
@ -54,7 +54,7 @@ namespace cocos2d
return pGridBase; return pGridBase;
} }
CCGridBase* CCGridBase::gridWithSize(ccGridSize gridSize, CCTexture2D *texture, bool flipped) CCGridBase* CCGridBase::gridWithSize(const ccGridSize& gridSize, CCTexture2D *texture, bool flipped)
{ {
CCGridBase *pGridBase = new CCGridBase(); CCGridBase *pGridBase = new CCGridBase();
@ -73,7 +73,7 @@ namespace cocos2d
return pGridBase; return pGridBase;
} }
bool CCGridBase::initWithSize(ccGridSize gridSize, CCTexture2D *pTexture, bool bFlipped) bool CCGridBase::initWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
{ {
bool bRet = true; bool bRet = true;
@ -85,7 +85,7 @@ namespace cocos2d
CC_SAFE_RETAIN(m_pTexture); CC_SAFE_RETAIN(m_pTexture);
m_bIsTextureFlipped = bFlipped; m_bIsTextureFlipped = bFlipped;
CCSize texSize = m_pTexture->getContentSizeInPixels(); const CCSize& texSize = m_pTexture->getContentSizeInPixels();
m_obStep.x = texSize.width / m_sGridSize.x; m_obStep.x = texSize.width / m_sGridSize.x;
m_obStep.y = texSize.height / m_sGridSize.y; m_obStep.y = texSize.height / m_sGridSize.y;
@ -105,7 +105,7 @@ namespace cocos2d
return bRet; return bRet;
} }
bool CCGridBase::initWithSize(ccGridSize gridSize) bool CCGridBase::initWithSize(const ccGridSize& gridSize)
{ {
CCDirector *pDirector = CCDirector::sharedDirector(); CCDirector *pDirector = CCDirector::sharedDirector();
CCSize s = pDirector->getWinSizeInPixels(); CCSize s = pDirector->getWinSizeInPixels();
@ -254,7 +254,7 @@ namespace cocos2d
if (pTarget->getCamera()->getDirty()) if (pTarget->getCamera()->getDirty())
{ {
CCPoint offset = pTarget->getAnchorPointInPixels(); const CCPoint& offset = pTarget->getAnchorPointInPixels();
// //
// XXX: Camera should be applied in the AnchorPoint // XXX: Camera should be applied in the AnchorPoint
@ -289,7 +289,7 @@ namespace cocos2d
// implementation of CCGrid3D // implementation of CCGrid3D
CCGrid3D* CCGrid3D::gridWithSize(ccGridSize gridSize, CCTexture2D *pTexture, bool bFlipped) CCGrid3D* CCGrid3D::gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
{ {
CCGrid3D *pRet= new CCGrid3D(); CCGrid3D *pRet= new CCGrid3D();
@ -309,7 +309,7 @@ namespace cocos2d
return pRet; return pRet;
} }
CCGrid3D* CCGrid3D::gridWithSize(ccGridSize gridSize) CCGrid3D* CCGrid3D::gridWithSize(const ccGridSize& gridSize)
{ {
CCGrid3D *pRet= new CCGrid3D(); CCGrid3D *pRet= new CCGrid3D();
@ -424,7 +424,7 @@ namespace cocos2d
memcpy(m_pOriginalVertices, m_pVertices, (m_sGridSize.x+1) * (m_sGridSize.y+1) * sizeof(ccVertex3F)); memcpy(m_pOriginalVertices, m_pVertices, (m_sGridSize.x+1) * (m_sGridSize.y+1) * sizeof(ccVertex3F));
} }
ccVertex3F CCGrid3D::vertex(ccGridSize pos) ccVertex3F CCGrid3D::vertex(const ccGridSize& pos)
{ {
int index = (pos.x * (m_sGridSize.y+1) + pos.y) * 3; int index = (pos.x * (m_sGridSize.y+1) + pos.y) * 3;
float *vertArray = (float*)m_pVertices; float *vertArray = (float*)m_pVertices;
@ -434,7 +434,7 @@ namespace cocos2d
return vert; return vert;
} }
ccVertex3F CCGrid3D::originalVertex(cocos2d::ccGridSize pos) ccVertex3F CCGrid3D::originalVertex(const ccGridSize& pos)
{ {
int index = (pos.x * (m_sGridSize.y+1) + pos.y) * 3; int index = (pos.x * (m_sGridSize.y+1) + pos.y) * 3;
float *vertArray = (float*)m_pOriginalVertices; float *vertArray = (float*)m_pOriginalVertices;
@ -444,7 +444,7 @@ namespace cocos2d
return vert; return vert;
} }
void CCGrid3D::setVertex(ccGridSize pos, ccVertex3F vertex) void CCGrid3D::setVertex(const ccGridSize& pos, const ccVertex3F& vertex)
{ {
int index = (pos.x * (m_sGridSize.y + 1) + pos.y) * 3; int index = (pos.x * (m_sGridSize.y + 1) + pos.y) * 3;
float *vertArray = (float*)m_pVertices; float *vertArray = (float*)m_pVertices;
@ -472,7 +472,7 @@ namespace cocos2d
CC_SAFE_FREE(m_pIndices); CC_SAFE_FREE(m_pIndices);
} }
CCTiledGrid3D* CCTiledGrid3D::gridWithSize(cocos2d::ccGridSize gridSize, cocos2d::CCTexture2D *pTexture, bool bFlipped) CCTiledGrid3D* CCTiledGrid3D::gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
{ {
CCTiledGrid3D *pRet= new CCTiledGrid3D(); CCTiledGrid3D *pRet= new CCTiledGrid3D();
@ -492,7 +492,7 @@ namespace cocos2d
return pRet; return pRet;
} }
CCTiledGrid3D* CCTiledGrid3D::gridWithSize(cocos2d::ccGridSize gridSize) CCTiledGrid3D* CCTiledGrid3D::gridWithSize(const ccGridSize& gridSize)
{ {
CCTiledGrid3D *pRet= new CCTiledGrid3D(); CCTiledGrid3D *pRet= new CCTiledGrid3D();
@ -604,14 +604,14 @@ namespace cocos2d
memcpy(m_pOriginalVertices, m_pVertices, numQuads * 12 * sizeof(GLfloat)); memcpy(m_pOriginalVertices, m_pVertices, numQuads * 12 * sizeof(GLfloat));
} }
void CCTiledGrid3D::setTile(cocos2d::ccGridSize pos, cocos2d::ccQuad3 coords) void CCTiledGrid3D::setTile(const ccGridSize& pos, const ccQuad3& coords)
{ {
int idx = (m_sGridSize.y * pos.x + pos.y) * 4 * 3; int idx = (m_sGridSize.y * pos.x + pos.y) * 4 * 3;
float *vertArray = (float*)m_pVertices; float *vertArray = (float*)m_pVertices;
memcpy(&vertArray[idx], &coords, sizeof(ccQuad3)); memcpy(&vertArray[idx], &coords, sizeof(ccQuad3));
} }
ccQuad3 CCTiledGrid3D::originalTile(ccGridSize pos) ccQuad3 CCTiledGrid3D::originalTile(const ccGridSize& pos)
{ {
int idx = (m_sGridSize.y * pos.x + pos.y) * 4 * 3; int idx = (m_sGridSize.y * pos.x + pos.y) * 4 * 3;
float *vertArray = (float*)m_pOriginalVertices; float *vertArray = (float*)m_pOriginalVertices;
@ -622,7 +622,7 @@ namespace cocos2d
return ret; return ret;
} }
ccQuad3 CCTiledGrid3D::tile(cocos2d::ccGridSize pos) ccQuad3 CCTiledGrid3D::tile(const ccGridSize& pos)
{ {
int idx = (m_sGridSize.y * pos.x + pos.y) * 4 * 3; int idx = (m_sGridSize.y * pos.x + pos.y) * 4 * 3;
float *vertArray = (float*)m_pVertices; float *vertArray = (float*)m_pVertices;

View File

@ -52,19 +52,19 @@ namespace cocos2d
inline void setReuseGrid(int nReuseGrid) { m_nReuseGrid = nReuseGrid; } inline void setReuseGrid(int nReuseGrid) { m_nReuseGrid = nReuseGrid; }
/** size of the grid */ /** size of the grid */
inline ccGridSize getGridSize(void) { return m_sGridSize; } inline const ccGridSize& getGridSize(void) { return m_sGridSize; }
inline void setGridSize(ccGridSize gridSize) { m_sGridSize = gridSize; } inline void setGridSize(const ccGridSize& gridSize) { m_sGridSize = gridSize; }
/** pixels between the grids */ /** pixels between the grids */
inline CCPoint getStep(void) { return m_obStep; } inline const CCPoint& getStep(void) { return m_obStep; }
inline void setStep(CCPoint step) { m_obStep = step; } inline void setStep(const CCPoint& step) { m_obStep = step; }
/** is texture flipped */ /** is texture flipped */
inline bool isTextureFlipped(void) { return m_bIsTextureFlipped; } inline bool isTextureFlipped(void) { return m_bIsTextureFlipped; }
void setIsTextureFlipped(bool bFlipped); void setIsTextureFlipped(bool bFlipped);
bool initWithSize(ccGridSize gridSize, CCTexture2D *pTexture, bool bFlipped); bool initWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
bool initWithSize(ccGridSize gridSize); bool initWithSize(const ccGridSize& gridSize);
void beforeDraw(void); void beforeDraw(void);
void afterDraw(CCNode *pTarget); void afterDraw(CCNode *pTarget);
@ -73,8 +73,8 @@ namespace cocos2d
virtual void calculateVertexPoints(void); virtual void calculateVertexPoints(void);
public: public:
static CCGridBase* gridWithSize(ccGridSize gridSize, CCTexture2D *texture, bool flipped); static CCGridBase* gridWithSize(const ccGridSize& gridSize, CCTexture2D *texture, bool flipped);
static CCGridBase* gridWithSize(ccGridSize gridSize); static CCGridBase* gridWithSize(const ccGridSize& gridSize);
void set2DProjection(void); void set2DProjection(void);
void set3DProjection(void); void set3DProjection(void);
@ -100,19 +100,19 @@ namespace cocos2d
~CCGrid3D(void); ~CCGrid3D(void);
/** returns the vertex at a given position */ /** returns the vertex at a given position */
ccVertex3F vertex(ccGridSize pos); ccVertex3F vertex(const ccGridSize& pos);
/** returns the original (non-transformed) vertex at a given position */ /** returns the original (non-transformed) vertex at a given position */
ccVertex3F originalVertex(ccGridSize pos); ccVertex3F originalVertex(const ccGridSize& pos);
/** sets a new vertex at a given position */ /** sets a new vertex at a given position */
void setVertex(ccGridSize pos, ccVertex3F vertex); void setVertex(const ccGridSize& pos, const ccVertex3F& vertex);
virtual void blit(void); virtual void blit(void);
virtual void reuse(void); virtual void reuse(void);
virtual void calculateVertexPoints(void); virtual void calculateVertexPoints(void);
public: public:
static CCGrid3D* gridWithSize(ccGridSize gridSize, CCTexture2D *pTexture, bool bFlipped); static CCGrid3D* gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
static CCGrid3D* gridWithSize(ccGridSize gridSize); static CCGrid3D* gridWithSize(const ccGridSize& gridSize);
protected: protected:
GLvoid *m_pTexCoordinates; GLvoid *m_pTexCoordinates;
@ -131,19 +131,19 @@ namespace cocos2d
~CCTiledGrid3D(void); ~CCTiledGrid3D(void);
/** returns the tile at the given position */ /** returns the tile at the given position */
ccQuad3 tile(ccGridSize pos); ccQuad3 tile(const ccGridSize& pos);
/** returns the original tile (untransformed) at the given position */ /** returns the original tile (untransformed) at the given position */
ccQuad3 originalTile(ccGridSize pos); ccQuad3 originalTile(const ccGridSize& pos);
/** sets a new tile */ /** sets a new tile */
void setTile(ccGridSize pos, ccQuad3 coords); void setTile(const ccGridSize& pos, const ccQuad3& coords);
virtual void blit(void); virtual void blit(void);
virtual void reuse(void); virtual void reuse(void);
virtual void calculateVertexPoints(void); virtual void calculateVertexPoints(void);
public: public:
static CCTiledGrid3D* gridWithSize(ccGridSize gridSize, CCTexture2D *pTexture, bool bFlipped); static CCTiledGrid3D* gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
static CCTiledGrid3D* gridWithSize(ccGridSize gridSize); static CCTiledGrid3D* gridWithSize(const ccGridSize& gridSize);
protected: protected:
GLvoid *m_pTexCoordinates; GLvoid *m_pTexCoordinates;

View File

@ -219,7 +219,7 @@ public:
bool initWithTarget(CCNode *pFollowedNode); bool initWithTarget(CCNode *pFollowedNode);
/** initializes the action with a set boundary */ /** initializes the action with a set boundary */
bool initWithTarget(CCNode *pFollowedNode, CCRect rect); bool initWithTarget(CCNode *pFollowedNode, const CCRect& rect);
virtual CCObject* copyWithZone(CCZone *pZone); virtual CCObject* copyWithZone(CCZone *pZone);
virtual void step(ccTime dt); virtual void step(ccTime dt);
@ -231,7 +231,7 @@ public:
static CCFollow* actionWithTarget(CCNode *pFollowedNode); static CCFollow* actionWithTarget(CCNode *pFollowedNode);
/** creates the action with a set boundary */ /** creates the action with a set boundary */
static CCFollow* actionWithTarget(CCNode *pFollowedNode, CCRect rect); static CCFollow* actionWithTarget(CCNode *pFollowedNode, const CCRect& rect);
protected: protected:
// node to follow // node to follow

View File

@ -41,13 +41,13 @@ namespace cocos2d
virtual CCActionInterval* reverse(void); virtual CCActionInterval* reverse(void);
/** initializes the action with size and duration */ /** initializes the action with size and duration */
virtual bool initWithSize(ccGridSize gridSize, ccTime duration); virtual bool initWithSize(const ccGridSize& gridSize, ccTime duration);
/** returns the grid */ /** returns the grid */
virtual CCGridBase* getGrid(void); virtual CCGridBase* getGrid(void);
public: public:
/** creates the action with size and duration */ /** creates the action with size and duration */
static CCGridAction* actionWithSize(ccGridSize gridSize, ccTime duration); static CCGridAction* actionWithSize(const ccGridSize& gridSize, ccTime duration);
protected: protected:
ccGridSize m_sGridSize; ccGridSize m_sGridSize;
@ -63,15 +63,15 @@ namespace cocos2d
/** returns the grid */ /** returns the grid */
virtual CCGridBase* getGrid(void); virtual CCGridBase* getGrid(void);
/** returns the vertex than belongs to certain position in the grid */ /** returns the vertex than belongs to certain position in the grid */
ccVertex3F vertex(ccGridSize pos); ccVertex3F vertex(const ccGridSize& pos);
/** returns the non-transformed vertex than belongs to certain position in the grid */ /** returns the non-transformed vertex than belongs to certain position in the grid */
ccVertex3F originalVertex(ccGridSize pos); ccVertex3F originalVertex(const ccGridSize& pos);
/** sets a new vertex to a certain position of the grid */ /** sets a new vertex to a certain position of the grid */
void setVertex(ccGridSize pos, ccVertex3F vertex); void setVertex(const ccGridSize& pos, const ccVertex3F& vertex);
public: public:
/** creates the action with size and duration */ /** creates the action with size and duration */
static CCGrid3DAction* actionWithSize(ccGridSize gridSize, ccTime duration); static CCGrid3DAction* actionWithSize(const ccGridSize& gridSize, ccTime duration);
}; };
/** @brief Base class for CCTiledGrid3D actions */ /** @brief Base class for CCTiledGrid3D actions */
@ -79,18 +79,18 @@ namespace cocos2d
{ {
public: public:
/** returns the tile that belongs to a certain position of the grid */ /** returns the tile that belongs to a certain position of the grid */
ccQuad3 tile(ccGridSize pos); ccQuad3 tile(const ccGridSize& pos);
/** returns the non-transformed tile that belongs to a certain position of the grid */ /** returns the non-transformed tile that belongs to a certain position of the grid */
ccQuad3 originalTile(ccGridSize pos); ccQuad3 originalTile(const ccGridSize& pos);
/** sets a new tile to a certain position of the grid */ /** sets a new tile to a certain position of the grid */
void setTile(ccGridSize pos, ccQuad3 coords); void setTile(const ccGridSize& pos, const ccQuad3& coords);
/** returns the grid */ /** returns the grid */
virtual CCGridBase* getGrid(void); virtual CCGridBase* getGrid(void);
public: public:
/** creates the action with size and duration */ /** creates the action with size and duration */
static CCTiledGrid3DAction* actionWithSize(ccGridSize gridSize, ccTime duration); static CCTiledGrid3DAction* actionWithSize(const ccGridSize& gridSize, ccTime duration);
}; };
/** @brief CCAccelDeccelAmplitude action */ /** @brief CCAccelDeccelAmplitude action */

View File

@ -42,14 +42,14 @@ namespace cocos2d
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; } inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** init the action */ /** init the action */
bool initWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration); bool initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time); virtual void update(ccTime time);
public: public:
/** create the action */ /** create the action */
static CCWaves3D* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration); static CCWaves3D* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
protected: protected:
int m_nWaves; int m_nWaves;
@ -63,7 +63,7 @@ namespace cocos2d
public: public:
/** initializes the action with duration */ /** initializes the action with duration */
bool initWithDuration(ccTime duration); bool initWithDuration(ccTime duration);
virtual bool initWithSize(ccGridSize gridSize, ccTime duration); virtual bool initWithSize(const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time); virtual void update(ccTime time);
@ -93,17 +93,17 @@ namespace cocos2d
/** Set lens center position */ /** Set lens center position */
inline void setLensEffect(float fLensEffect) { m_fLensEffect = fLensEffect; } inline void setLensEffect(float fLensEffect) { m_fLensEffect = fLensEffect; }
inline CCPoint getPosition(void) { return m_position; } inline const CCPoint& getPosition(void) { return m_position; }
void setPosition(CCPoint position); void setPosition(const CCPoint& position);
/** initializes the action with center position, radius, a grid size and duration */ /** initializes the action with center position, radius, a grid size and duration */
bool initWithPosition(CCPoint pos, float r, ccGridSize gridSize, ccTime duration); bool initWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time); virtual void update(ccTime time);
public: public:
/** creates the action with center position, radius, a grid size and duration */ /** creates the action with center position, radius, a grid size and duration */
static CCLens3D* actionWithPosition(CCPoint pos, float r, ccGridSize gridSize, ccTime duration); static CCLens3D* actionWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, ccTime duration);
protected: protected:
/* lens center position */ /* lens center position */
CCPoint m_position; CCPoint m_position;
@ -122,9 +122,9 @@ namespace cocos2d
{ {
public: public:
/** get center position */ /** get center position */
inline CCPoint getPosition(void) { return m_position; } inline const CCPoint& getPosition(void) { return m_position; }
/** set center position */ /** set center position */
void setPosition(CCPoint position); void setPosition(const CCPoint& position);
inline float getAmplitude(void) { return m_fAmplitude; } inline float getAmplitude(void) { return m_fAmplitude; }
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; } inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
@ -133,15 +133,15 @@ namespace cocos2d
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; } inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** initializes the action with radius, number of waves, amplitude, a grid size and duration */ /** initializes the action with radius, number of waves, amplitude, a grid size and duration */
bool initWithPosition(CCPoint pos, float r, int wav, float amp, bool initWithPosition(const CCPoint& pos, float r, int wav, float amp,
ccGridSize gridSize, ccTime duration); const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time); virtual void update(ccTime time);
public: public:
/** creates the action with radius, number of waves, amplitude, a grid size and duration */ /** creates the action with radius, number of waves, amplitude, a grid size and duration */
static CCRipple3D* actionWithPosition(CCPoint pos, float r, int wav, float amp, static CCRipple3D* actionWithPosition(const CCPoint& pos, float r, int wav, float amp,
ccGridSize gridSize, ccTime duration); const ccGridSize& gridSize, ccTime duration);
protected: protected:
/* center position */ /* center position */
CCPoint m_position; CCPoint m_position;
@ -159,13 +159,13 @@ namespace cocos2d
{ {
public: public:
/** initializes the action with a range, shake Z vertices, a grid and duration */ /** initializes the action with a range, shake Z vertices, a grid and duration */
bool initWithRange(int range, bool shakeZ, ccGridSize gridSize, ccTime duration); bool initWithRange(int range, bool shakeZ, const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time); virtual void update(ccTime time);
public: public:
/** creates the action with a range, shake Z vertices, a grid and duration */ /** creates the action with a range, shake Z vertices, a grid and duration */
static CCShaky3D* actionWithRange(int range, bool shakeZ, ccGridSize gridSize, ccTime duration); static CCShaky3D* actionWithRange(int range, bool shakeZ, const ccGridSize& gridSize, ccTime duration);
protected: protected:
int m_nRandrange; int m_nRandrange;
@ -183,13 +183,13 @@ namespace cocos2d
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; } inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** initializes the action with amplitude, a grid and duration */ /** initializes the action with amplitude, a grid and duration */
bool initWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration); bool initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time); virtual void update(ccTime time);
public: public:
/** creates the action with amplitude, a grid and duration */ /** creates the action with amplitude, a grid and duration */
static CCLiquid* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration); static CCLiquid* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
protected: protected:
int m_nWaves; int m_nWaves;
@ -208,14 +208,14 @@ namespace cocos2d
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; } inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */ /** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
bool initWithWaves(int wav, float amp, bool h, bool v, ccGridSize gridSize, bool initWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize,
ccTime duration); ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time); virtual void update(ccTime time);
public: public:
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */ /** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
static CCWaves* actionWithWaves(int wav, float amp, bool h, bool v, ccGridSize gridSize, static CCWaves* actionWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize,
ccTime duration); ccTime duration);
protected: protected:
int m_nWaves; int m_nWaves;
@ -230,9 +230,9 @@ namespace cocos2d
{ {
public: public:
/** get twirl center */ /** get twirl center */
inline CCPoint getPosition(void) { return m_position; } inline const CCPoint& getPosition(void) { return m_position; }
/** set twirl center */ /** set twirl center */
void setPosition(CCPoint position); void setPosition(const CCPoint& position);
inline float getAmplitude(void) { return m_fAmplitude; } inline float getAmplitude(void) { return m_fAmplitude; }
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; } inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
@ -241,14 +241,14 @@ namespace cocos2d
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; } inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */ /** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
bool initWithPosition(CCPoint pos, int t, float amp, ccGridSize gridSize, bool initWithPosition(const CCPoint& pos, int t, float amp, const ccGridSize& gridSize,
ccTime duration); ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time); virtual void update(ccTime time);
public: public:
/** creates the action with center position, number of twirls, amplitude, a grid size and duration */ /** creates the action with center position, number of twirls, amplitude, a grid size and duration */
static CCTwirl* actionWithPosition(CCPoint pos, int t, float amp, ccGridSize gridSize, static CCTwirl* actionWithPosition(CCPoint pos, int t, float amp, const ccGridSize& gridSize,
ccTime duration); ccTime duration);
protected: protected:
/* twirl center */ /* twirl center */

View File

@ -157,9 +157,9 @@ namespace cocos2d {
CCPlace(){} CCPlace(){}
virtual ~CCPlace(){} virtual ~CCPlace(){}
/** creates a Place action with a position */ /** creates a Place action with a position */
static CCPlace * actionWithPosition(CCPoint pos); static CCPlace * actionWithPosition(const CCPoint& pos);
/** Initializes a Place action with a position */ /** Initializes a Place action with a position */
bool initWithPosition(CCPoint pos); bool initWithPosition(const CCPoint& pos);
//super methods //super methods
virtual void startWithTarget(CCNode *pTarget); virtual void startWithTarget(CCNode *pTarget);
virtual CCObject* copyWithZone(CCZone *pZone); virtual CCObject* copyWithZone(CCZone *pZone);
@ -202,7 +202,7 @@ namespace cocos2d {
virtual void execute(); virtual void execute();
//super methods //super methods
virtual void startWithTarget(CCNode *pTarget); virtual void startWithTarget(CCNode *pTarget);
CCObject * copyWithZone(cocos2d::CCZone *pZone); CCObject * copyWithZone(CCZone *pZone);
void registerScriptFunction(const char* pszFunctionName); void registerScriptFunction(const char* pszFunctionName);

View File

@ -285,7 +285,7 @@ class CC_DLL CCMoveTo : public CCActionInterval
{ {
public: public:
/** initializes the action */ /** initializes the action */
bool initWithDuration(ccTime duration, CCPoint position); bool initWithDuration(ccTime duration, const CCPoint& position);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget); virtual void startWithTarget(CCNode *pTarget);
@ -293,7 +293,7 @@ public:
public: public:
/** creates the action */ /** creates the action */
static CCMoveTo* actionWithDuration(ccTime duration, CCPoint position); static CCMoveTo* actionWithDuration(ccTime duration, const CCPoint& position);
protected: protected:
CCPoint m_endPosition; CCPoint m_endPosition;
@ -309,7 +309,7 @@ class CC_DLL CCMoveBy : public CCMoveTo
{ {
public: public:
/** initializes the action */ /** initializes the action */
bool initWithDuration(ccTime duration, CCPoint position); bool initWithDuration(ccTime duration, const CCPoint& position);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget); virtual void startWithTarget(CCNode *pTarget);
@ -317,7 +317,7 @@ public:
public: public:
/** creates the action */ /** creates the action */
static CCMoveBy* actionWithDuration(ccTime duration, CCPoint position); static CCMoveBy* actionWithDuration(ccTime duration, const CCPoint& position);
}; };
/** Skews a CCNode object to given angles by modifying it's skewX and skewY attributes /** Skews a CCNode object to given angles by modifying it's skewX and skewY attributes
@ -366,7 +366,7 @@ class CC_DLL CCJumpBy : public CCActionInterval
{ {
public: public:
/** initializes the action */ /** initializes the action */
bool initWithDuration(ccTime duration, CCPoint position, ccTime height, unsigned int jumps); bool initWithDuration(ccTime duration, const CCPoint& position, ccTime height, unsigned int jumps);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget); virtual void startWithTarget(CCNode *pTarget);
@ -375,7 +375,7 @@ public:
public: public:
/** creates the action */ /** creates the action */
static CCJumpBy* actionWithDuration(ccTime duration, CCPoint position, ccTime height, unsigned int jumps); static CCJumpBy* actionWithDuration(ccTime duration, const CCPoint& position, ccTime height, unsigned int jumps);
protected: protected:
CCPoint m_startPosition; CCPoint m_startPosition;
@ -394,7 +394,7 @@ public:
public: public:
/** creates the action */ /** creates the action */
static CCJumpTo* actionWithDuration(ccTime duration, CCPoint position, ccTime height, int jumps); static CCJumpTo* actionWithDuration(ccTime duration, const CCPoint& position, ccTime height, int jumps);
}; };
/** @typedef bezier configuration structure /** @typedef bezier configuration structure
@ -414,7 +414,7 @@ class CC_DLL CCBezierBy : public CCActionInterval
{ {
public: public:
/** initializes the action with a duration and a bezier configuration */ /** initializes the action with a duration and a bezier configuration */
bool initWithDuration(ccTime t, ccBezierConfig c); bool initWithDuration(ccTime t, const ccBezierConfig& c);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget); virtual void startWithTarget(CCNode *pTarget);
@ -423,7 +423,7 @@ public:
public: public:
/** creates the action with a duration and a bezier configuration */ /** creates the action with a duration and a bezier configuration */
static CCBezierBy* actionWithDuration(ccTime t, ccBezierConfig c); static CCBezierBy* actionWithDuration(ccTime t, const ccBezierConfig& c);
protected: protected:
ccBezierConfig m_sConfig; ccBezierConfig m_sConfig;
@ -441,7 +441,7 @@ public:
public: public:
/** creates the action with a duration and a bezier configuration */ /** creates the action with a duration and a bezier configuration */
static CCBezierTo* actionWithDuration(ccTime t, ccBezierConfig c); static CCBezierTo* actionWithDuration(ccTime t, const ccBezierConfig& c);
}; };
/** @brief Scales a CCNode object to a zoom factor by modifying it's scale attribute. /** @brief Scales a CCNode object to a zoom factor by modifying it's scale attribute.

View File

@ -45,7 +45,7 @@ namespace cocos2d
public: public:
/** create the action */ /** create the action */
static CCPageTurn3D* actionWithSize(ccGridSize gridSize, ccTime time); static CCPageTurn3D* actionWithSize(const ccGridSize& gridSize, ccTime time);
}; };
} }

View File

@ -34,7 +34,7 @@ namespace cocos2d
{ {
public: public:
/** initializes the action with a range, whether or not to shake Z vertices, a grid size, and duration */ /** initializes the action with a range, whether or not to shake Z vertices, a grid size, and duration */
bool initWithRange(int nRange, bool bShakeZ, ccGridSize gridSize, bool initWithRange(int nRange, bool bShakeZ, const ccGridSize& gridSize,
ccTime duration); ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
@ -42,7 +42,7 @@ namespace cocos2d
public: public:
/** creates the action with a range, whether or not to shake Z vertices, a grid size, and duration */ /** creates the action with a range, whether or not to shake Z vertices, a grid size, and duration */
static CCShakyTiles3D* actionWithRange(int nRange, bool bShakeZ, ccGridSize gridSize, static CCShakyTiles3D* actionWithRange(int nRange, bool bShakeZ, const ccGridSize& gridSize,
ccTime duration); ccTime duration);
protected: protected:
@ -55,7 +55,7 @@ namespace cocos2d
{ {
public: public:
/** initializes the action with a range, whether or not to shatter Z vertices, a grid size and duration */ /** initializes the action with a range, whether or not to shatter Z vertices, a grid size and duration */
bool initWithRange(int nRange, bool bShatterZ, ccGridSize gridSize, bool initWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize,
ccTime duration); ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
@ -63,7 +63,7 @@ namespace cocos2d
public: public:
/** creates the action with a range, whether of not to shatter Z vertices, a grid size and duration */ /** creates the action with a range, whether of not to shatter Z vertices, a grid size and duration */
static CCShatteredTiles3D* actionWithRange(int nRange, bool bShatterZ, ccGridSize gridSize, static CCShatteredTiles3D* actionWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize,
ccTime duration); ccTime duration);
protected: protected:
@ -81,10 +81,10 @@ namespace cocos2d
public: public:
~CCShuffleTiles(void); ~CCShuffleTiles(void);
/** initializes the action with a random seed, the grid size and the duration */ /** initializes the action with a random seed, the grid size and the duration */
bool initWithSeed(int s, ccGridSize gridSize, ccTime duration); bool initWithSeed(int s, const ccGridSize& gridSize, ccTime duration);
void shuffle(int *pArray, unsigned int nLen); void shuffle(int *pArray, unsigned int nLen);
ccGridSize getDelta(ccGridSize pos); ccGridSize getDelta(const ccGridSize& pos);
void placeTile(ccGridSize pos, Tile *t); void placeTile(const ccGridSize& pos, Tile *t);
virtual void startWithTarget(CCNode *pTarget); virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time); virtual void update(ccTime time);
@ -92,7 +92,7 @@ namespace cocos2d
public: public:
/** creates the action with a random seed, the grid size and the duration */ /** creates the action with a random seed, the grid size and the duration */
static CCShuffleTiles* actionWithSeed(int s, ccGridSize gridSize, ccTime duration); static CCShuffleTiles* actionWithSeed(int s, const ccGridSize& gridSize, ccTime duration);
protected: protected:
int m_nSeed; int m_nSeed;
@ -107,15 +107,15 @@ namespace cocos2d
class CC_DLL CCFadeOutTRTiles : public CCTiledGrid3DAction class CC_DLL CCFadeOutTRTiles : public CCTiledGrid3DAction
{ {
public: public:
virtual float testFunc(ccGridSize pos, ccTime time); virtual float testFunc(const ccGridSize& pos, ccTime time);
void turnOnTile(ccGridSize pos); void turnOnTile(const ccGridSize& pos);
void turnOffTile(ccGridSize pos); void turnOffTile(const ccGridSize& pos);
virtual void transformTile(ccGridSize pos, float distance); virtual void transformTile(const ccGridSize& pos, float distance);
virtual void update(ccTime time); virtual void update(ccTime time);
public: public:
/** creates the action with the grid size and the duration */ /** creates the action with the grid size and the duration */
static CCFadeOutTRTiles* actionWithSize(ccGridSize gridSize, ccTime time); static CCFadeOutTRTiles* actionWithSize(const ccGridSize& gridSize, ccTime time);
}; };
/** @brief CCFadeOutBLTiles action. /** @brief CCFadeOutBLTiles action.
@ -124,11 +124,11 @@ namespace cocos2d
class CC_DLL CCFadeOutBLTiles : public CCFadeOutTRTiles class CC_DLL CCFadeOutBLTiles : public CCFadeOutTRTiles
{ {
public: public:
virtual float testFunc(ccGridSize pos, ccTime time); virtual float testFunc(const ccGridSize& pos, ccTime time);
public: public:
/** creates the action with the grid size and the duration */ /** creates the action with the grid size and the duration */
static CCFadeOutBLTiles* actionWithSize(ccGridSize gridSize, ccTime time); static CCFadeOutBLTiles* actionWithSize(const ccGridSize& gridSize, ccTime time);
}; };
/** @brief CCFadeOutUpTiles action. /** @brief CCFadeOutUpTiles action.
@ -137,12 +137,12 @@ namespace cocos2d
class CC_DLL CCFadeOutUpTiles : public CCFadeOutTRTiles class CC_DLL CCFadeOutUpTiles : public CCFadeOutTRTiles
{ {
public: public:
virtual float testFunc(ccGridSize pos, ccTime time); virtual float testFunc(const ccGridSize& pos, ccTime time);
virtual void transformTile(ccGridSize pos, float distance); virtual void transformTile(const ccGridSize& pos, float distance);
public: public:
/** creates the action with the grid size and the duration */ /** creates the action with the grid size and the duration */
static CCFadeOutUpTiles* actionWithSize(ccGridSize gridSize, ccTime time); static CCFadeOutUpTiles* actionWithSize(const ccGridSize& gridSize, ccTime time);
}; };
/** @brief CCFadeOutDownTiles action. /** @brief CCFadeOutDownTiles action.
@ -151,11 +151,11 @@ namespace cocos2d
class CC_DLL CCFadeOutDownTiles : public CCFadeOutUpTiles class CC_DLL CCFadeOutDownTiles : public CCFadeOutUpTiles
{ {
public: public:
virtual float testFunc(ccGridSize pos, ccTime time); virtual float testFunc(const ccGridSize& pos, ccTime time);
public: public:
/** creates the action with the grid size and the duration */ /** creates the action with the grid size and the duration */
static CCFadeOutDownTiles* actionWithSize(ccGridSize gridSize, ccTime time); static CCFadeOutDownTiles* actionWithSize(const ccGridSize& gridSize, ccTime time);
}; };
/** @brief CCTurnOffTiles action. /** @brief CCTurnOffTiles action.
@ -166,10 +166,10 @@ namespace cocos2d
public: public:
~CCTurnOffTiles(void); ~CCTurnOffTiles(void);
/** initializes the action with a random seed, the grid size and the duration */ /** initializes the action with a random seed, the grid size and the duration */
bool initWithSeed(int s, ccGridSize gridSize, ccTime duration); bool initWithSeed(int s, const ccGridSize& gridSize, ccTime duration);
void shuffle(int *pArray, unsigned int nLen); void shuffle(int *pArray, unsigned int nLen);
void turnOnTile(ccGridSize pos); void turnOnTile(const ccGridSize& pos);
void turnOffTile(ccGridSize pos); void turnOffTile(const ccGridSize& pos);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget); virtual void startWithTarget(CCNode *pTarget);
@ -177,9 +177,9 @@ namespace cocos2d
public: public:
/** creates the action with the grid size and the duration */ /** creates the action with the grid size and the duration */
static CCTurnOffTiles* actionWithSize(ccGridSize size, ccTime d); static CCTurnOffTiles* actionWithSize(const ccGridSize& size, ccTime d);
/** creates the action with a random seed, the grid size and the duration */ /** creates the action with a random seed, the grid size and the duration */
static CCTurnOffTiles* actionWithSeed(int s, ccGridSize gridSize, ccTime duration); static CCTurnOffTiles* actionWithSeed(int s, const ccGridSize& gridSize, ccTime duration);
protected: protected:
int m_nSeed; int m_nSeed;
@ -200,14 +200,14 @@ namespace cocos2d
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; } inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** initializes the action with a number of waves, the waves amplitude, the grid size and the duration */ /** initializes the action with a number of waves, the waves amplitude, the grid size and the duration */
bool initWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration); bool initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time); virtual void update(ccTime time);
public: public:
/** creates the action with a number of waves, the waves amplitude, the grid size and the duration */ /** creates the action with a number of waves, the waves amplitude, the grid size and the duration */
static CCWavesTiles3D* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration); static CCWavesTiles3D* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
protected: protected:
int m_nWaves; int m_nWaves;
@ -230,13 +230,13 @@ namespace cocos2d
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; } inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** initializes the action with the number of jumps, the sin amplitude, the grid size and the duration */ /** initializes the action with the number of jumps, the sin amplitude, the grid size and the duration */
bool initWithJumps(int j, float amp, ccGridSize gridSize, ccTime duration); bool initWithJumps(int j, float amp, const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time); virtual void update(ccTime time);
public: public:
/** creates the action with the number of jumps, the sin amplitude, the grid size and the duration */ /** creates the action with the number of jumps, the sin amplitude, the grid size and the duration */
static CCJumpTiles3D* actionWithJumps(int j, float amp, ccGridSize gridSize, ccTime duration); static CCJumpTiles3D* actionWithJumps(int j, float amp, const ccGridSize& gridSize, ccTime duration);
protected: protected:
int m_nJumps; int m_nJumps;

View File

@ -36,21 +36,21 @@ struct CCAffineTransform {
CCAffineTransform __CCAffineTransformMake(CGFloat a, CGFloat b, CGFloat c, CGFloat d, CGFloat tx, CGFloat ty); CCAffineTransform __CCAffineTransformMake(CGFloat a, CGFloat b, CGFloat c, CGFloat d, CGFloat tx, CGFloat ty);
#define CCAffineTransformMake __CCAffineTransformMake #define CCAffineTransformMake __CCAffineTransformMake
CCPoint __CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t); CCPoint __CCPointApplyAffineTransform(const CCPoint& point, const CCAffineTransform& t);
#define CCPointApplyAffineTransform __CCPointApplyAffineTransform #define CCPointApplyAffineTransform __CCPointApplyAffineTransform
CCSize __CCSizeApplyAffineTransform(CCSize size, CCAffineTransform t); CCSize __CCSizeApplyAffineTransform(const CCSize& size, const CCAffineTransform& t);
#define CCSizeApplyAffineTransform __CCSizeApplyAffineTransform #define CCSizeApplyAffineTransform __CCSizeApplyAffineTransform
CCAffineTransform CCAffineTransformMakeIdentity(); CCAffineTransform CCAffineTransformMakeIdentity();
CCRect CCRectApplyAffineTransform(CCRect rect, CCAffineTransform anAffineTransform); CCRect CCRectApplyAffineTransform(const CCRect& rect, const CCAffineTransform& anAffineTransform);
CCAffineTransform CCAffineTransformTranslate(CCAffineTransform t, float tx, float ty); CCAffineTransform CCAffineTransformTranslate(const CCAffineTransform& t, float tx, float ty);
CCAffineTransform CCAffineTransformRotate(CCAffineTransform aTransform, CGFloat anAngle); CCAffineTransform CCAffineTransformRotate(const CCAffineTransform& aTransform, CGFloat anAngle);
CCAffineTransform CCAffineTransformScale(CCAffineTransform t, CGFloat sx, CGFloat sy); CCAffineTransform CCAffineTransformScale(const CCAffineTransform& t, CGFloat sx, CGFloat sy);
CCAffineTransform CCAffineTransformConcat(CCAffineTransform t1,CCAffineTransform t2); CCAffineTransform CCAffineTransformConcat(const CCAffineTransform& t1, const CCAffineTransform& t2);
bool CCAffineTransformEqualToTransform(CCAffineTransform t1,CCAffineTransform t2); bool CCAffineTransformEqualToTransform(const CCAffineTransform& t1, const CCAffineTransform& t2);
CCAffineTransform CCAffineTransformInvert(CCAffineTransform t); CCAffineTransform CCAffineTransformInvert(const CCAffineTransform& t);
extern const CCAffineTransform CCAffineTransformIdentity; extern const CCAffineTransform CCAffineTransformIdentity;
}//namespace cocos2d }//namespace cocos2d

View File

@ -97,7 +97,7 @@ namespace cocos2d {
/** Adds a frame with a texture and a rect. Internally it will create a CCSpriteFrame and it will add it. /** Adds a frame with a texture and a rect. Internally it will create a CCSpriteFrame and it will add it.
Added to facilitate the migration from v0.8 to v0.9. Added to facilitate the migration from v0.8 to v0.9.
*/ */
void addFrameWithTexture(CCTexture2D* pobTexture, CCRect rect); void addFrameWithTexture(CCTexture2D* pobTexture, const CCRect& rect);
bool init(void); bool init(void);

View File

@ -65,7 +65,7 @@ protected:
CC_PROPERTY(bool, m_bIsOpacityModifyRGB, IsOpacityModifyRGB) CC_PROPERTY(bool, m_bIsOpacityModifyRGB, IsOpacityModifyRGB)
CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc); CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc);
CC_PROPERTY(GLubyte, m_cOpacity, Opacity); CC_PROPERTY(GLubyte, m_cOpacity, Opacity);
CC_PROPERTY(ccColor3B, m_tColor, Color); CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color);
// quads to draw // quads to draw
CC_PROPERTY(unsigned int, m_uQuadsToDraw, QuadsToDraw); CC_PROPERTY(unsigned int, m_uQuadsToDraw, QuadsToDraw);

View File

@ -231,17 +231,17 @@ public:
CCSize getDisplaySizeInPixels(void); CCSize getDisplaySizeInPixels(void);
/** changes the projection size */ /** changes the projection size */
void reshapeProjection(CCSize newWindowSize); void reshapeProjection(const CCSize& newWindowSize);
/** converts a UIKit coordinate to an OpenGL coordinate /** converts a UIKit coordinate to an OpenGL coordinate
Useful to convert (multi) touches coordinates to the current layout (portrait or landscape) Useful to convert (multi) touches coordinates to the current layout (portrait or landscape)
*/ */
CCPoint convertToGL(CCPoint obPoint); CCPoint convertToGL(const CCPoint& obPoint);
/** converts an OpenGL coordinate to a UIKit coordinate /** converts an OpenGL coordinate to a UIKit coordinate
Useful to convert node points to window points for calls such as glScissor Useful to convert node points to window points for calls such as glScissor
*/ */
CCPoint convertToUI(CCPoint obPoint); CCPoint convertToUI(const CCPoint& obPoint);
/// XXX: missing description /// XXX: missing description
float getZEye(void); float getZEye(void);

View File

@ -48,7 +48,7 @@ THE SOFTWARE.
namespace cocos2d { namespace cocos2d {
/** draws a point given x and y coordinate measured in points */ /** draws a point given x and y coordinate measured in points */
void CC_DLL ccDrawPoint( CCPoint point ); void CC_DLL ccDrawPoint( const CCPoint& point );
/** draws an array of points. /** draws an array of points.
@since v0.7.2 @since v0.7.2
@ -56,7 +56,7 @@ void CC_DLL ccDrawPoint( CCPoint point );
void CC_DLL ccDrawPoints( const CCPoint *points, unsigned int numberOfPoints ); void CC_DLL ccDrawPoints( const CCPoint *points, unsigned int numberOfPoints );
/** draws a line given the origin and destination point measured in points */ /** draws a line given the origin and destination point measured in points */
void CC_DLL ccDrawLine( CCPoint origin, CCPoint destination ); void CC_DLL ccDrawLine( const CCPoint& origin, const CCPoint& destination );
/** draws a poligon given a pointer to CCPoint coordiantes and the number of vertices measured in points. /** draws a poligon given a pointer to CCPoint coordiantes and the number of vertices measured in points.
The polygon can be closed or open The polygon can be closed or open
@ -64,17 +64,17 @@ The polygon can be closed or open
void CC_DLL ccDrawPoly( const CCPoint *vertices, int numOfVertices, bool closePolygon ); void CC_DLL ccDrawPoly( const CCPoint *vertices, int numOfVertices, bool closePolygon );
/** draws a circle given the center, radius and number of segments. */ /** draws a circle given the center, radius and number of segments. */
void CC_DLL ccDrawCircle( CCPoint center, float radius, float angle, int segments, bool drawLineToCenter); void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, int segments, bool drawLineToCenter);
/** draws a quad bezier path /** draws a quad bezier path
@since v0.8 @since v0.8
*/ */
void CC_DLL ccDrawQuadBezier(CCPoint origin, CCPoint control, CCPoint destination, int segments); void CC_DLL ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, int segments);
/** draws a cubic bezier path /** draws a cubic bezier path
@since v0.8 @since v0.8
*/ */
void CC_DLL ccDrawCubicBezier(CCPoint origin, CCPoint control1, CCPoint control2, CCPoint destination, int segments); void CC_DLL ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, int segments);
}//namespace cocos2d }//namespace cocos2d
#endif // __CCDRAWING_PRIMITIVES__ #endif // __CCDRAWING_PRIMITIVES__

View File

@ -148,7 +148,7 @@ namespace cocos2d{
/** conforms to CCRGBAProtocol protocol */ /** conforms to CCRGBAProtocol protocol */
CC_PROPERTY(GLubyte, m_cOpacity, Opacity) CC_PROPERTY(GLubyte, m_cOpacity, Opacity)
/** conforms to CCRGBAProtocol protocol */ /** conforms to CCRGBAProtocol protocol */
CC_PROPERTY(ccColor3B, m_tColor, Color) CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color)
/** conforms to CCRGBAProtocol protocol */ /** conforms to CCRGBAProtocol protocol */
CC_PROPERTY(bool, m_bIsOpacityModifyRGB, IsOpacityModifyRGB) CC_PROPERTY(bool, m_bIsOpacityModifyRGB, IsOpacityModifyRGB)
protected: protected:
@ -179,7 +179,7 @@ namespace cocos2d{
virtual void setString(const char *label); virtual void setString(const char *label);
virtual const char* getString(void); virtual const char* getString(void);
virtual void setCString(const char *label); virtual void setCString(const char *label);
virtual void setAnchorPoint(CCPoint var); virtual void setAnchorPoint(const CCPoint& var);
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; } virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
virtual CCLabelProtocol* convertToLabelProtocol() { return (CCLabelProtocol*)this; } virtual CCLabelProtocol* convertToLabelProtocol() { return (CCLabelProtocol*)this; }
#if CC_LABELBMFONT_DEBUG_DRAW #if CC_LABELBMFONT_DEBUG_DRAW

View File

@ -42,11 +42,11 @@ namespace cocos2d{
virtual ~CCLabelTTF(); virtual ~CCLabelTTF();
char * description(); char * description();
/** creates a CCLabelTTF from a fontname, alignment, dimension and font size */ /** creates a CCLabelTTF from a fontname, alignment, dimension and font size */
static CCLabelTTF * labelWithString(const char *label, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize); static CCLabelTTF * labelWithString(const char *label, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
/** creates a CCLabelTTF from a fontname and font size */ /** creates a CCLabelTTF from a fontname and font size */
static CCLabelTTF * labelWithString(const char *label, const char *fontName, float fontSize); static CCLabelTTF * labelWithString(const char *label, const char *fontName, float fontSize);
/** initializes the CCLabelTTF with a font name, alignment, dimension and font size */ /** initializes the CCLabelTTF with a font name, alignment, dimension and font size */
bool initWithString(const char *label, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize); bool initWithString(const char *label, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
/** initializes the CCLabelTTF with a font name and font size */ /** initializes the CCLabelTTF with a font name and font size */
bool initWithString(const char *label, const char *fontName, float fontSize); bool initWithString(const char *label, const char *fontName, float fontSize);

View File

@ -161,17 +161,17 @@ public:
virtual ~CCLayerColor(); virtual ~CCLayerColor();
virtual void draw(); virtual void draw();
virtual void setContentSize(CCSize var); virtual void setContentSize(const CCSize& var);
/** creates a CCLayer with color, width and height in Points */ /** creates a CCLayer with color, width and height in Points */
static CCLayerColor * layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height); static CCLayerColor * layerWithColorWidthHeight(const 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. */
static CCLayerColor * layerWithColor(ccColor4B color); static CCLayerColor * layerWithColor(const ccColor4B& color);
/** initializes a CCLayer with color, width and height in Points */ /** initializes a CCLayer with color, width and height in Points */
virtual bool initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height); virtual bool initWithColorWidthHeight(const ccColor4B& color, GLfloat width, GLfloat height);
/** initializes a CCLayer with color. Width and height are the window size. */ /** initializes a CCLayer with color. Width and height are the window size. */
virtual bool initWithColor(ccColor4B color); virtual bool initWithColor(const ccColor4B& color);
/** change width in Points*/ /** change width in Points*/
void changeWidth(GLfloat w); void changeWidth(GLfloat w);
@ -184,8 +184,8 @@ public:
/** Opacity: conforms to CCRGBAProtocol protocol */ /** Opacity: conforms to CCRGBAProtocol protocol */
CC_PROPERTY(GLubyte, m_cOpacity, Opacity) CC_PROPERTY(GLubyte, m_cOpacity, Opacity)
/** Opacity: conforms to CCRGBAProtocol protocol */ /** Color: conforms to CCRGBAProtocol protocol */
CC_PROPERTY(ccColor3B, m_tColor, Color) CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color)
/** BlendFunction. Conforms to CCBlendProtocol protocol */ /** BlendFunction. Conforms to CCBlendProtocol protocol */
CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc) CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc)
@ -223,22 +223,22 @@ class CC_DLL CCLayerGradient : public CCLayerColor
{ {
public: public:
/** Creates a full-screen CCLayer with a gradient between start and end. */ /** Creates a full-screen CCLayer with a gradient between start and end. */
static CCLayerGradient* layerWithColor(ccColor4B start, ccColor4B end); static CCLayerGradient* layerWithColor(const ccColor4B& start, const ccColor4B& end);
/** Creates a full-screen CCLayer with a gradient between start and end in the direction of v. */ /** Creates a full-screen CCLayer with a gradient between start and end in the direction of v. */
static CCLayerGradient* layerWithColor(ccColor4B start, ccColor4B end, CCPoint v); static CCLayerGradient* layerWithColor(const ccColor4B& start, const ccColor4B& end, const CCPoint& v);
/** Initializes the CCLayer with a gradient between start and end. */ /** Initializes the CCLayer with a gradient between start and end. */
virtual bool initWithColor(ccColor4B start, ccColor4B end); virtual bool initWithColor(const ccColor4B& start, const ccColor4B& end);
/** Initializes the CCLayer with a gradient between start and end in the direction of v. */ /** Initializes the CCLayer with a gradient between start and end in the direction of v. */
virtual bool initWithColor(ccColor4B start, ccColor4B end, CCPoint v); virtual bool initWithColor(const ccColor4B& start, const ccColor4B& end, const CCPoint& v);
CC_PROPERTY(ccColor3B, m_startColor, StartColor) CC_PROPERTY_PASS_BY_REF(ccColor3B, m_startColor, StartColor)
CC_PROPERTY(ccColor3B, m_endColor, EndColor) CC_PROPERTY_PASS_BY_REF(ccColor3B, m_endColor, EndColor)
CC_PROPERTY(GLubyte, m_cStartOpacity, StartOpacity) CC_PROPERTY(GLubyte, m_cStartOpacity, StartOpacity)
CC_PROPERTY(GLubyte, m_cEndOpacity, EndOpacity) CC_PROPERTY(GLubyte, m_cEndOpacity, EndOpacity)
CC_PROPERTY(CCPoint, m_AlongVector, Vector) CC_PROPERTY_PASS_BY_REF(CCPoint, m_AlongVector, Vector)
/** Whether or not the interpolation will be compressed in order to display all the colors of the gradient both in canonical and non canonical vectors /** Whether or not the interpolation will be compressed in order to display all the colors of the gradient both in canonical and non canonical vectors
Default: YES Default: YES

View File

@ -49,6 +49,10 @@ namespace cocos2d{
*/ */
class CC_DLL CCMenu : public CCLayer, public CCRGBAProtocol class CC_DLL CCMenu : public CCLayer, public CCRGBAProtocol
{ {
/** Color: conforms with CCRGBAProtocol protocol */
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color);
/** Opacity: conforms with CCRGBAProtocol protocol */
CC_PROPERTY(GLubyte, m_cOpacity, Opacity);
public: public:
CCMenu() CCMenu()
: m_cOpacity(0) : m_cOpacity(0)
@ -117,19 +121,12 @@ namespace cocos2d{
*/ */
virtual void onExit(); virtual void onExit();
virtual void setOpacity(GLubyte opacity);
virtual GLubyte getOpacity(void);
virtual ccColor3B getColor(void);
virtual void setColor(ccColor3B color);
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; } virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
protected: protected:
CCMenuItem* itemForTouch(CCTouch * touch); CCMenuItem* itemForTouch(CCTouch * touch);
tCCMenuState m_eState; tCCMenuState m_eState;
GLubyte m_cOpacity;
CCMenuItem *m_pSelectedItem; CCMenuItem *m_pSelectedItem;
ccColor3B m_tColor;
}; };
} }

View File

@ -93,7 +93,7 @@ namespace cocos2d{
class CC_DLL CCMenuItemLabel : public CCMenuItem, public CCRGBAProtocol class CC_DLL CCMenuItemLabel : public CCMenuItem, public CCRGBAProtocol
{ {
/** the color that will be used to disable the item */ /** the color that will be used to disable the item */
CC_PROPERTY(ccColor3B, m_tDisabledColor, DisabledColor); CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tDisabledColor, DisabledColor);
/** Label that is rendered. It can be any CCNode that implements the CCLabelProtocol */ /** Label that is rendered. It can be any CCNode that implements the CCLabelProtocol */
CC_PROPERTY(CCNode*, m_pLabel, Label); CC_PROPERTY(CCNode*, m_pLabel, Label);
public: public:
@ -120,8 +120,8 @@ namespace cocos2d{
virtual void setIsEnabled(bool enabled); virtual void setIsEnabled(bool enabled);
virtual void setOpacity(GLubyte opacity); virtual void setOpacity(GLubyte opacity);
virtual GLubyte getOpacity(); virtual GLubyte getOpacity();
virtual void setColor(ccColor3B color); virtual void setColor(const ccColor3B& color);
virtual ccColor3B getColor(); virtual const ccColor3B& getColor();
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; } virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
protected: protected:
@ -223,8 +223,8 @@ namespace cocos2d{
/** initializes a menu item with a normal, selected and disabled image with target/selector */ /** initializes a menu item with a normal, selected and disabled image with target/selector */
bool initFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, SelectorProtocol* target, SEL_MenuHandler selector); bool initFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, SelectorProtocol* target, SEL_MenuHandler selector);
// super methods // super methods
virtual void setColor(ccColor3B color); virtual void setColor(const ccColor3B& color);
virtual ccColor3B getColor(); virtual const ccColor3B& getColor();
virtual void setOpacity(GLubyte opacity); virtual void setOpacity(GLubyte opacity);
virtual GLubyte getOpacity(); virtual GLubyte getOpacity();
@ -272,7 +272,7 @@ namespace cocos2d{
/** conforms with CCRGBAProtocol protocol */ /** conforms with CCRGBAProtocol protocol */
CC_PROPERTY(GLubyte, m_cOpacity, Opacity); CC_PROPERTY(GLubyte, m_cOpacity, Opacity);
/** conforms with CCRGBAProtocol protocol */ /** conforms with CCRGBAProtocol protocol */
CC_PROPERTY(ccColor3B, m_tColor, Color); CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color);
/** returns the selected item */ /** returns the selected item */
CC_PROPERTY(unsigned int, m_uSelectedIndex, SelectedIndex); CC_PROPERTY(unsigned int, m_uSelectedIndex, SelectedIndex);
/** CCMutableArray that contains the subitems. You can add/remove items in runtime, and you can replace the array with a new one. /** CCMutableArray that contains the subitems. You can add/remove items in runtime, and you can replace the array with a new one.

View File

@ -64,10 +64,10 @@ public:
{} {}
virtual ~CCMotionStreak(){} virtual ~CCMotionStreak(){}
/** creates the a MotionStreak. The image will be loaded using the TextureMgr. */ /** creates the a MotionStreak. The image will be loaded using the TextureMgr. */
static CCMotionStreak * streakWithFade(float fade, float seg, const char *imagePath, float width, float length, ccColor4B color); static CCMotionStreak * streakWithFade(float fade, float seg, const char *imagePath, float width, float length, const ccColor4B& color);
/** initializes a MotionStreak. The file will be loaded using the TextureMgr. */ /** initializes a MotionStreak. The file will be loaded using the TextureMgr. */
bool initWithFade(float fade, float seg, const char *imagePath, float width, float length, ccColor4B color); bool initWithFade(float fade, float seg, const char *imagePath, float width, float length, const ccColor4B& color);
/** polling function */ /** polling function */
void update(ccTime delta); void update(ccTime delta);

View File

@ -325,6 +325,22 @@ public:
return m_array.rbegin(); return m_array.rbegin();
} }
CCMutableArrayIterator getLastValidIterator(void)
{
CCMutableArrayIterator iter;
CCMutableArrayIterator ret;
for (iter = m_array.begin(); iter != m_array.end(); ++iter)
{
ret = iter;
if (! (*iter))
{
break;
}
}
return ret;
}
/* /*
* end is a keyword of lua, so should use other name * end is a keyword of lua, so should use other name
* to export to lua * to export to lua

View File

@ -138,8 +138,8 @@ namespace cocos2d {
CC_PROPERTY(float, m_fScaleY, ScaleY) CC_PROPERTY(float, m_fScaleY, ScaleY)
/** Position (x,y) of the node in OpenGL coordinates. (0,0) is the left-bottom corner. */ /** Position (x,y) of the node in OpenGL coordinates. (0,0) is the left-bottom corner. */
CC_PROPERTY(CCPoint, m_tPosition, Position) CC_PROPERTY_PASS_BY_REF(CCPoint, m_tPosition, Position)
CC_PROPERTY(CCPoint, m_tPositionInPixels, PositionInPixels) CC_PROPERTY_PASS_BY_REF(CCPoint, m_tPositionInPixels, PositionInPixels)
/** The X skew angle of the node in degrees. /** The X skew angle of the node in degrees.
This angle describes the shear distortion in the X direction. This angle describes the shear distortion in the X direction.
@ -174,26 +174,26 @@ namespace cocos2d {
The default anchorPoint is (0.5,0.5), so it starts in the center of the node. The default anchorPoint is (0.5,0.5), so it starts in the center of the node.
@since v0.8 @since v0.8
*/ */
CC_PROPERTY(CCPoint, m_tAnchorPoint, AnchorPoint) CC_PROPERTY_PASS_BY_REF(CCPoint, m_tAnchorPoint, AnchorPoint)
/** 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
*/ */
CC_PROPERTY_READONLY(CCPoint, m_tAnchorPointInPixels, AnchorPointInPixels) CC_PROPERTY_READONLY_PASS_BY_REF(CCPoint, 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.
All nodes has a size. Layer and Scene has the same size of the screen. All nodes has a size. Layer and Scene has the same size of the screen.
@since v0.8 @since v0.8
*/ */
CC_PROPERTY(CCSize, m_tContentSize, ContentSize) CC_PROPERTY_PASS_BY_REF(CCSize, m_tContentSize, ContentSize)
/** The untransformed size of the node in Pixels /** The untransformed size of the node in Pixels
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.
All nodes has a size. Layer and Scene has the same size of the screen. All nodes has a size. Layer and Scene has the same size of the screen.
@since v0.8 @since v0.8
*/ */
CC_PROPERTY(CCSize, m_tContentSizeInPixels, ContentSizeInPixels) CC_PROPERTY_PASS_BY_REF(CCSize, m_tContentSizeInPixels, ContentSizeInPixels)
/** whether or not the node is running */ /** whether or not the node is running */
CC_PROPERTY_READONLY(bool, m_bIsRunning, IsRunning) CC_PROPERTY_READONLY(bool, m_bIsRunning, IsRunning)
@ -246,7 +246,7 @@ namespace cocos2d {
void arrayMakeObjectsPerformSelector(CCArray* pArray, callbackFunc func); void arrayMakeObjectsPerformSelector(CCArray* pArray, callbackFunc func);
CCPoint convertToWindowSpace(CCPoint nodePoint); CCPoint convertToWindowSpace(const CCPoint& nodePoint);
public: public:
@ -515,21 +515,21 @@ namespace cocos2d {
/** Converts a Point to node (local) space coordinates. The result is in Points. /** Converts a Point to node (local) space coordinates. The result is in Points.
@since v0.7.1 @since v0.7.1
*/ */
CCPoint convertToNodeSpace(CCPoint worldPoint); CCPoint convertToNodeSpace(const CCPoint& worldPoint);
/** Converts a Point to world space coordinates. The result is in Points. /** Converts a Point to world space coordinates. The result is in Points.
@since v0.7.1 @since v0.7.1
*/ */
CCPoint convertToWorldSpace(CCPoint nodePoint); CCPoint convertToWorldSpace(const CCPoint& nodePoint);
/** Converts a Point to node (local) space coordinates. The result is in Points. /** Converts a Point to node (local) space coordinates. The result is in Points.
treating the returned/received node point as anchor relative. treating the returned/received node point as anchor relative.
@since v0.7.1 @since v0.7.1
*/ */
CCPoint convertToNodeSpaceAR(CCPoint worldPoint); CCPoint convertToNodeSpaceAR(const CCPoint& worldPoint);
/** Converts a local Point to world space coordinates.The result is in Points. /** Converts a local Point to world space coordinates.The result is in Points.
treating the returned/received node point as anchor relative. treating the returned/received node point as anchor relative.
@since v0.7.1 @since v0.7.1
*/ */
CCPoint convertToWorldSpaceAR(CCPoint nodePoint); CCPoint convertToWorldSpaceAR(const CCPoint& nodePoint);
/** convenience methods which take a CCTouch instead of CCPoint /** convenience methods which take a CCTouch instead of CCPoint
@since v0.7.1 @since v0.7.1

View File

@ -50,7 +50,7 @@ namespace cocos2d {
CCParallaxNode(); CCParallaxNode();
virtual ~CCParallaxNode(); virtual ~CCParallaxNode();
static CCParallaxNode * node(); static CCParallaxNode * node();
virtual void addChild(CCNode * child, unsigned int z, CCPoint parallaxRatio, CCPoint positionOffset); virtual void addChild(CCNode * child, unsigned int z, const CCPoint& parallaxRatio, const CCPoint& positionOffset);
// super methods // super methods
virtual void addChild(CCNode * child, unsigned int zOrder, int tag); virtual void addChild(CCNode * child, unsigned int zOrder, int tag);
virtual void removeChild(CCNode* child, bool cleanup); virtual void removeChild(CCNode* child, bool cleanup);

View File

@ -237,9 +237,9 @@ protected:
/** How many seconds the emitter wil run. -1 means 'forever' */ /** How many seconds the emitter wil run. -1 means 'forever' */
CC_PROPERTY(float, m_fDuration, Duration) CC_PROPERTY(float, m_fDuration, Duration)
/** sourcePosition of the emitter */ /** sourcePosition of the emitter */
CC_PROPERTY(CCPoint, m_tSourcePosition, SourcePosition) CC_PROPERTY_PASS_BY_REF(CCPoint, m_tSourcePosition, SourcePosition)
/** Position variance of the emitter */ /** Position variance of the emitter */
CC_PROPERTY(CCPoint, m_tPosVar, PosVar) CC_PROPERTY_PASS_BY_REF(CCPoint, m_tPosVar, PosVar)
/** life, and life variation of each particle */ /** life, and life variation of each particle */
CC_PROPERTY(float, m_fLife, Life) CC_PROPERTY(float, m_fLife, Life)
/** life variance of each particle */ /** life variance of each particle */
@ -252,8 +252,8 @@ protected:
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
public: public:
// mode A // mode A
virtual CCPoint getGravity(); virtual const CCPoint& getGravity();
virtual void setGravity(CCPoint g); virtual void setGravity(const CCPoint& g);
virtual float getSpeed(); virtual float getSpeed();
virtual void setSpeed(float speed); virtual void setSpeed(float speed);
virtual float getSpeedVar(); virtual float getSpeedVar();
@ -290,13 +290,13 @@ public:
/** end size variance in pixels of each particle */ /** end size variance in pixels of each particle */
CC_PROPERTY(float, m_fEndSizeVar, EndSizeVar) CC_PROPERTY(float, m_fEndSizeVar, EndSizeVar)
/** start color of each particle */ /** start color of each particle */
CC_PROPERTY(ccColor4F, m_tStartColor, StartColor) CC_PROPERTY_PASS_BY_REF(ccColor4F, m_tStartColor, StartColor)
/** start color variance of each particle */ /** start color variance of each particle */
CC_PROPERTY(ccColor4F, m_tStartColorVar, StartColorVar) CC_PROPERTY_PASS_BY_REF(ccColor4F, m_tStartColorVar, StartColorVar)
/** end color and end color variation of each particle */ /** end color and end color variation of each particle */
CC_PROPERTY(ccColor4F, m_tEndColor, EndColor) CC_PROPERTY_PASS_BY_REF(ccColor4F, m_tEndColor, EndColor)
/** end color variance of each particle */ /** end color variance of each particle */
CC_PROPERTY(ccColor4F, m_tEndColorVar, EndColorVar) CC_PROPERTY_PASS_BY_REF(ccColor4F, m_tEndColorVar, EndColorVar)
//* initial angle of each particle //* initial angle of each particle
CC_PROPERTY(float, m_fStartSpin, StartSpin) CC_PROPERTY(float, m_fStartSpin, StartSpin)
//* initial angle of each particle //* initial angle of each particle
@ -372,7 +372,7 @@ public:
bool isFull(); bool isFull();
//! should be overriden by subclasses //! should be overriden by subclasses
virtual void updateQuadWithParticle(tCCParticle* particle, CCPoint newPosition); virtual void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
//! should be overriden by subclasses //! should be overriden by subclasses
virtual void postStep(); virtual void postStep();

View File

@ -60,7 +60,7 @@ public:
// super methods // super methods
virtual bool initWithTotalParticles(unsigned int numberOfParticles); virtual bool initWithTotalParticles(unsigned int numberOfParticles);
virtual void updateQuadWithParticle(tCCParticle* particle, CCPoint newPosition); virtual void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
virtual void postStep(); virtual void postStep();
virtual void draw(); virtual void draw();
virtual void setStartSpin(float var); virtual void setStartSpin(float var);

View File

@ -71,7 +71,7 @@ public:
void initIndices(); void initIndices();
/** initilizes the texture with a rectangle measured Points */ /** initilizes the texture with a rectangle measured Points */
void initTexCoordsWithRect(CCRect rect); void initTexCoordsWithRect(const CCRect& rect);
/** Sets a new CCSpriteFrame as particle. /** Sets a new CCSpriteFrame as particle.
WARNING: this method is experimental. Use setTexture:withRect instead. WARNING: this method is experimental. Use setTexture:withRect instead.
@ -82,11 +82,11 @@ public:
/** Sets a new texture with a rect. The rect is in Points. /** Sets a new texture with a rect. The rect is in Points.
@since v0.99.4 @since v0.99.4
*/ */
void setTextureWithRect(CCTexture2D *texture, CCRect rect); void setTextureWithRect(CCTexture2D *texture, const CCRect& rect);
// super methods // super methods
virtual bool initWithTotalParticles(unsigned int numberOfParticles); virtual bool initWithTotalParticles(unsigned int numberOfParticles);
virtual void setTexture(CCTexture2D* texture); virtual void setTexture(CCTexture2D* texture);
virtual void updateQuadWithParticle(tCCParticle* particle, CCPoint newPosition); virtual void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
virtual void postStep(); virtual void postStep();
virtual void draw(); virtual void draw();
}; };

View File

@ -81,7 +81,7 @@ public:
static CCProgressTimer* progressWithTexture(CCTexture2D *pTexture); static CCProgressTimer* progressWithTexture(CCTexture2D *pTexture);
protected: protected:
ccVertex2F vertexFromTexCoord(CCPoint texCoord); ccVertex2F vertexFromTexCoord(const CCPoint& texCoord);
void updateProgress(void); void updateProgress(void);
void updateBar(void); void updateBar(void);
void updateRadial(void); void updateRadial(void);

View File

@ -39,12 +39,12 @@ public:
/** sets Color /** sets Color
@since v0.8 @since v0.8
*/ */
virtual void setColor(ccColor3B color) = 0; virtual void setColor(const ccColor3B& color) = 0;
/** returns the color /** returns the color
@since v0.8 @since v0.8
*/ */
virtual ccColor3B getColor(void) = 0; virtual const ccColor3B& getColor(void) = 0;
// returns the opacity // returns the opacity
virtual GLubyte getOpacity(void) = 0; virtual GLubyte getOpacity(void) = 0;

View File

@ -56,27 +56,27 @@ class CC_DLL CCRibbon : public CCNode, public CCTextureProtocol
/** GL blendind function */ /** GL blendind function */
CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc) CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc)
/** color used by the Ribbon (RGBA) */ /** color used by the Ribbon (RGBA) */
CC_PROPERTY(ccColor4B, m_tColor, Color) CC_PROPERTY_PASS_BY_REF(ccColor4B, m_tColor, Color)
public: public:
CCRibbon() : m_pTexture(0), m_pSegments(0), m_pDeletedSegments(0){} CCRibbon() : m_pTexture(0), m_pSegments(0), m_pDeletedSegments(0){}
virtual ~CCRibbon(); virtual ~CCRibbon();
/** creates the ribbon */ /** creates the ribbon */
static CCRibbon * ribbonWithWidth(float w, const char *path, float length, ccColor4B color, float fade); static CCRibbon * ribbonWithWidth(float w, const char *path, float length, const ccColor4B& color, float fade);
/** init the ribbon */ /** init the ribbon */
bool initWithWidth(float w, const char *path, float length, ccColor4B color, float fade); bool initWithWidth(float w, const char *path, float length, const ccColor4B& color, float fade);
/** add a point to the ribbon */ /** add a point to the ribbon */
void addPointAt(CCPoint location, float width); void addPointAt(CCPoint location, float width);
/** polling function */ /** polling function */
void update(ccTime delta); void update(ccTime delta);
/** determine side of line */ /** determine side of line */
float sideOfLine(CCPoint p, CCPoint l1, CCPoint l2); float sideOfLine(const CCPoint& p, const CCPoint& l1, const CCPoint& l2);
// super method // super method
virtual void draw(); virtual void draw();
private: private:
/** rotates a point around 0, 0 */ /** rotates a point around 0, 0 */
CCPoint rotatePoint(CCPoint vec, float rotation); CCPoint rotatePoint(const CCPoint& vec, float rotation);
protected: protected:
CCMutableArray<CCRibbonSegment*> *m_pSegments; CCMutableArray<CCRibbonSegment*> *m_pSegments;
CCMutableArray<CCRibbonSegment*> *m_pDeletedSegments; CCMutableArray<CCRibbonSegment*> *m_pDeletedSegments;
@ -115,7 +115,7 @@ public:
char * description(); char * description();
bool init(); bool init();
void reset(); void reset();
void draw(float curTime, float fadeTime, ccColor4B color); void draw(float curTime, float fadeTime, const ccColor4B& color);
}; };
} // namespace cocos2d } // namespace cocos2d

View File

@ -92,6 +92,10 @@ typedef enum {
*/ */
class CC_DLL CCSprite : public CCNode, public CCTextureProtocol, public CCRGBAProtocol class CC_DLL CCSprite : public CCNode, public CCTextureProtocol, public CCRGBAProtocol
{ {
/** Opacity: conforms to CCRGBAProtocol protocol */
CC_PROPERTY(GLubyte, m_nOpacity, Opacity)
/** Color: conforms with CCRGBAProtocol protocol */
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_sColor, Color);
public: public:
virtual void draw(void); virtual void draw(void);
@ -117,7 +121,7 @@ public:
inline void setAtlasIndex(unsigned int uAtlasIndex) { m_uAtlasIndex = uAtlasIndex; } inline void setAtlasIndex(unsigned int uAtlasIndex) { m_uAtlasIndex = uAtlasIndex; }
/** returns the rect of the CCSprite in points */ /** returns the rect of the CCSprite in points */
inline CCRect getTextureRect(void) { return m_obRect; } inline const CCRect& getTextureRect(void) { return m_obRect; }
/** whether or not the Sprite is rendered using a CCSpriteBatchNode */ /** whether or not the Sprite is rendered using a CCSpriteBatchNode */
inline bool isUsesBatchNode(void) { return m_bUsesBatchNode; } inline bool isUsesBatchNode(void) { return m_bUsesBatchNode; }
@ -146,7 +150,7 @@ public:
/** Get offset position of the sprite. Calculated automatically by editors like Zwoptex. /** Get offset position of the sprite. Calculated automatically by editors like Zwoptex.
@since v0.99.0 @since v0.99.0
*/ */
inline CCPoint getOffsetPositionInPixels(void) { return m_obOffsetPositionInPixels; } inline const CCPoint& getOffsetPositionInPixels(void) { return m_obOffsetPositionInPixels; }
/** conforms to CCTextureProtocol protocol */ /** conforms to CCTextureProtocol protocol */
inline ccBlendFunc getBlendFunc(void) { return m_sBlendFunc; } inline ccBlendFunc getBlendFunc(void) { return m_sBlendFunc; }
@ -163,10 +167,10 @@ public:
/** Creates an sprite with a texture and a rect. /** Creates an sprite with a texture and a rect.
The offset will be (0,0). The offset will be (0,0).
*/ */
static CCSprite* spriteWithTexture(CCTexture2D *pTexture, CCRect rect); static CCSprite* spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect);
/** Creates an sprite with a texture, a rect and offset. */ /** Creates an sprite with a texture, a rect and offset. */
static CCSprite* spriteWithTexture(CCTexture2D *pTexture, CCRect rect, CCPoint offset); static CCSprite* spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect, const CCPoint& offset);
/** Creates an sprite with an sprite frame. */ /** Creates an sprite with an sprite frame. */
static CCSprite* spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame); static CCSprite* spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
@ -187,11 +191,11 @@ public:
/** Creates an sprite with an image filename and a rect. /** Creates an sprite with an image filename and a rect.
The offset will be (0,0). The offset will be (0,0).
*/ */
static CCSprite* spriteWithFile(const char *pszFileName, CCRect rect); static CCSprite* spriteWithFile(const char *pszFileName, const CCRect& rect);
/** Creates an sprite with an CCBatchNode and a rect /** Creates an sprite with an CCBatchNode and a rect
*/ */
static CCSprite* spriteWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rect); static CCSprite* spriteWithBatchNode(CCSpriteBatchNode *batchNode, const CCRect& rect);
public: public:
bool init(void); bool init(void);
@ -206,8 +210,8 @@ public:
virtual void addChild(CCNode *pChild, int zOrder, int tag); virtual void addChild(CCNode *pChild, int zOrder, int tag);
virtual void setDirtyRecursively(bool bValue); virtual void setDirtyRecursively(bool bValue);
virtual void setPosition(CCPoint pos); virtual void setPosition(const CCPoint& pos);
virtual void setPositionInPixels(CCPoint pos); virtual void setPositionInPixels(const CCPoint& pos);
virtual void setRotation(float fRotation); virtual void setRotation(float fRotation);
virtual void setSkewX(float sx); virtual void setSkewX(float sx);
virtual void setSkewY(float sy); virtual void setSkewY(float sy);
@ -215,7 +219,7 @@ public:
virtual void setScaleY(float fScaleY); virtual void setScaleY(float fScaleY);
virtual void setScale(float fScale); virtual void setScale(float fScale);
virtual void setVertexZ(float fVertexZ); virtual void setVertexZ(float fVertexZ);
virtual void setAnchorPoint(CCPoint anchor); virtual void setAnchorPoint(const CCPoint& anchor);
virtual void setIsRelativeAnchorPoint(bool bRelative); virtual void setIsRelativeAnchorPoint(bool bRelative);
virtual void setIsVisible(bool bVisible); virtual void setIsVisible(bool bVisible);
void setFlipX(bool bFlipX); void setFlipX(bool bFlipX);
@ -240,11 +244,6 @@ public:
void updateColor(void); void updateColor(void);
// RGBAProtocol // RGBAProtocol
/** opacity: conforms to CCRGBAProtocol protocol */ /** opacity: conforms to CCRGBAProtocol protocol */
virtual GLubyte getOpacity(void);
virtual void setOpacity(GLubyte opacity);
/** RGB colors: conforms to CCRGBAProtocol protocol */
virtual ccColor3B getColor(void);
virtual void setColor(ccColor3B color3);
virtual void setIsOpacityModifyRGB(bool bValue); virtual void setIsOpacityModifyRGB(bool bValue);
virtual bool getIsOpacityModifyRGB(void); virtual bool getIsOpacityModifyRGB(void);
@ -263,7 +262,7 @@ public:
/** Initializes an sprite with a texture and a rect. /** Initializes an sprite with a texture and a rect.
The offset will be (0,0). The offset will be (0,0).
*/ */
bool initWithTexture(CCTexture2D *pTexture, CCRect rect); bool initWithTexture(CCTexture2D *pTexture, const CCRect& rect);
// Initializes an sprite with an sprite frame. // Initializes an sprite with an sprite frame.
bool initWithSpriteFrame(CCSpriteFrame *pSpriteFrame); bool initWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
@ -284,15 +283,15 @@ public:
/** Initializes an sprite with an image filename, and a rect. /** Initializes an sprite with an image filename, and a rect.
The offset will be (0,0). The offset will be (0,0).
*/ */
bool initWithFile(const char *pszFilename, CCRect rect); bool initWithFile(const char *pszFilename, const CCRect& rect);
/** Initializes an sprite with an CCSpriteBatchNode and a rect in points */ /** Initializes an sprite with an CCSpriteBatchNode and a rect in points */
bool initWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rect); bool initWithBatchNode(CCSpriteBatchNode *batchNode, const CCRect& rect);
/** Initializes an sprite with an CCSpriteBatchNode and a rect in pixels /** Initializes an sprite with an CCSpriteBatchNode and a rect in pixels
@since v0.99.5 @since v0.99.5
*/ */
bool initWithBatchNodeRectInPixels(CCSpriteBatchNode *batchNode, CCRect rect); bool initWithBatchNodeRectInPixels(CCSpriteBatchNode *batchNode, const CCRect& rect);
// BatchNode methods // BatchNode methods
@ -305,11 +304,11 @@ public:
void useSelfRender(void); void useSelfRender(void);
/** updates the texture rect of the CCSprite in points. */ /** updates the texture rect of the CCSprite in points. */
void setTextureRect(CCRect rect); void setTextureRect(const CCRect& rect);
/** updates the texture rect, rectRotated and untrimmed size of the CCSprite in pixels /** updates the texture rect, rectRotated and untrimmed size of the CCSprite in pixels
*/ */
void setTextureRectInPixels(CCRect rect, bool rotated, CCSize size); void setTextureRectInPixels(const CCRect& rect, bool rotated, const CCSize& size);
/** tell the sprite to use batch node render. /** tell the sprite to use batch node render.
@since v0.99.0 @since v0.99.0
@ -336,7 +335,7 @@ public:
void setDisplayFrameWithAnimationName(const char *animationName, int frameIndex); void setDisplayFrameWithAnimationName(const char *animationName, int frameIndex);
protected: protected:
void updateTextureCoords(CCRect rect); void updateTextureCoords(const CCRect& rect);
void updateBlendFunc(void); void updateBlendFunc(void);
void getTransformValues(struct transformValues_ *tv); // optimization void getTransformValues(struct transformValues_ *tv); // optimization
@ -378,8 +377,6 @@ protected:
ccV3F_C4B_T2F_Quad m_sQuad; ccV3F_C4B_T2F_Quad m_sQuad;
// opacity and RGB protocol // opacity and RGB protocol
GLubyte m_nOpacity;
ccColor3B m_sColor;
ccColor3B m_sColorUnmodified; ccColor3B m_sColorUnmodified;
bool m_bOpacityModifyRGB; bool m_bOpacityModifyRGB;

View File

@ -53,26 +53,26 @@ class CC_DLL CCSpriteFrame : public CCObject
public: public:
// attributes // attributes
inline CCRect getRectInPixels(void) { return m_obRectInPixels; } inline const CCRect& getRectInPixels(void) { return m_obRectInPixels; }
void setRectInPixels(CCRect rectInPixels); void setRectInPixels(const CCRect& rectInPixels);
inline bool isRotated(void) { return m_bRotated; } inline bool isRotated(void) { return m_bRotated; }
inline void setRotated(bool bRotated) { m_bRotated = bRotated; } inline void setRotated(bool bRotated) { m_bRotated = bRotated; }
/** get rect of the frame */ /** get rect of the frame */
inline CCRect getRect(void) { return m_obRect; } inline const CCRect& getRect(void) { return m_obRect; }
/** set rect of the frame */ /** set rect of the frame */
void setRect(CCRect rect); void setRect(const CCRect& rect);
/** get offset of the frame */ /** get offset of the frame */
inline CCPoint getOffsetInPixels(void) { return m_obOffsetInPixels; } inline const CCPoint& getOffsetInPixels(void) { return m_obOffsetInPixels; }
/** set offset of the frame */ /** set offset of the frame */
inline void setOffsetInPixels(CCPoint offsetInPixels) { m_obOffsetInPixels = offsetInPixels; } inline void setOffsetInPixels(const CCPoint& offsetInPixels) { m_obOffsetInPixels = offsetInPixels; }
/** get original size of the trimmed image */ /** get original size of the trimmed image */
inline CCSize getOriginalSizeInPixels(void) { return m_obOriginalSizeInPixels; } inline const CCSize& getOriginalSizeInPixels(void) { return m_obOriginalSizeInPixels; }
/** set original size of the trimmed image */ /** set original size of the trimmed image */
inline void setOriginalSizeInPixels(CCSize sizeInPixels) { m_obOriginalSizeInPixels = sizeInPixels; } inline void setOriginalSizeInPixels(const CCSize& sizeInPixels) { m_obOriginalSizeInPixels = sizeInPixels; }
/** get texture of the frame */ /** get texture of the frame */
inline CCTexture2D* getTexture(void) { return m_pobTexture; } inline CCTexture2D* getTexture(void) { return m_pobTexture; }
@ -91,23 +91,23 @@ public:
/** Create a CCSpriteFrame with a texture, rect in points. /** Create a CCSpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed. It is assumed that the frame was not trimmed.
*/ */
static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, CCRect rect); static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, const CCRect& rect);
/** Create a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. /** Create a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in points of the frame before being trimmed. The originalSize is the size in points of the frame before being trimmed.
*/ */
static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, CCRect rect, bool rotated, CCPoint offset, CCSize originalSize); static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
public: public:
/** Initializes a CCSpriteFrame with a texture, rect in points. /** Initializes a CCSpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed. It is assumed that the frame was not trimmed.
*/ */
bool initWithTexture(CCTexture2D* pobTexture, CCRect rect); bool initWithTexture(CCTexture2D* pobTexture, const CCRect& rect);
/** Initializes a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. /** Initializes a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in points of the frame before being trimmed. The originalSize is the size in points of the frame before being trimmed.
*/ */
bool initWithTexture(CCTexture2D* pobTexture, CCRect rect, bool rotated, CCPoint offset, CCSize originalSize); bool initWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
protected: protected:
CCRect m_obRectInPixels; CCRect m_obRectInPixels;
bool m_bRotated; bool m_bRotated;

View File

@ -63,9 +63,9 @@ namespace cocos2d {
class CC_DLL CCTMXLayer : public CCSpriteBatchNode class CC_DLL CCTMXLayer : public CCSpriteBatchNode
{ {
/** size of the layer in tiles */ /** size of the layer in tiles */
CC_SYNTHESIZE(CCSize, m_tLayerSize, LayerSize); CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tLayerSize, LayerSize);
/** size of the map's tile (could be differnt from the tile's size) */ /** size of the map's tile (could be differnt from the tile's size) */
CC_SYNTHESIZE(CCSize, m_tMapTileSize, MapTileSize); CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tMapTileSize, MapTileSize);
/** pointer to the map of tiles */ /** pointer to the map of tiles */
CC_SYNTHESIZE(unsigned int*, m_pTiles, Tiles); CC_SYNTHESIZE(unsigned int*, m_pTiles, Tiles);
/** Tilset information for the layer */ /** Tilset information for the layer */
@ -95,25 +95,25 @@ namespace cocos2d {
- layer->removeChild(sprite, cleanup); - layer->removeChild(sprite, cleanup);
- or layer->removeTileAt(ccp(x,y)); - or layer->removeTileAt(ccp(x,y));
*/ */
CCSprite* tileAt(CCPoint tileCoordinate); CCSprite* tileAt(const CCPoint& tileCoordinate);
/** returns the tile gid at a given tile coordinate. /** returns the tile gid at a given tile coordinate.
if it returns 0, it means that the tile is empty. if it returns 0, it means that the tile is empty.
This method requires the the tile map has not been previously released (eg. don't call layer->releaseMap()) This method requires the the tile map has not been previously released (eg. don't call layer->releaseMap())
*/ */
unsigned int tileGIDAt(CCPoint tileCoordinate); unsigned int tileGIDAt(const CCPoint& tileCoordinate);
/** sets the tile gid (gid = tile global id) at a given tile coordinate. /** sets the tile gid (gid = tile global id) at a given tile coordinate.
The Tile GID can be obtained by using the method "tileGIDAt" or by using the TMX editor -> Tileset Mgr +1. The Tile GID can be obtained by using the method "tileGIDAt" or by using the TMX editor -> Tileset Mgr +1.
If a tile is already placed at that position, then it will be removed. If a tile is already placed at that position, then it will be removed.
*/ */
void setTileGID(unsigned int gid, CCPoint tileCoordinate); void setTileGID(unsigned int gid, const CCPoint& tileCoordinate);
/** removes a tile at given tile coordinate */ /** removes a tile at given tile coordinate */
void removeTileAt(CCPoint tileCoordinate); void removeTileAt(const CCPoint& tileCoordinate);
/** returns the position in pixels of a given tile coordinate */ /** returns the position in pixels of a given tile coordinate */
CCPoint positionAt(CCPoint tileCoordinate); CCPoint positionAt(const CCPoint& tileCoordinate);
/** return the value for the specific property name */ /** return the value for the specific property name */
CCString *propertyNamed(const char *propertyName); CCString *propertyNamed(const char *propertyName);
@ -132,20 +132,20 @@ namespace cocos2d {
inline const char* getLayerName(){ return m_sLayerName.c_str(); } inline const char* getLayerName(){ return m_sLayerName.c_str(); }
inline void setLayerName(const char *layerName){ m_sLayerName = layerName; } inline void setLayerName(const char *layerName){ m_sLayerName = layerName; }
private: private:
CCPoint positionForIsoAt(CCPoint pos); CCPoint positionForIsoAt(const CCPoint& pos);
CCPoint positionForOrthoAt(CCPoint pos); CCPoint positionForOrthoAt(const CCPoint& pos);
CCPoint positionForHexAt(CCPoint pos); CCPoint positionForHexAt(const CCPoint& pos);
CCPoint calculateLayerOffset(CCPoint offset); CCPoint calculateLayerOffset(const CCPoint& offset);
/* optimization methos */ /* optimization methos */
CCSprite* appendTileForGID(unsigned int gid, CCPoint pos); CCSprite* appendTileForGID(unsigned int gid, const CCPoint& pos);
CCSprite* insertTileForGID(unsigned int gid, CCPoint pos); CCSprite* insertTileForGID(unsigned int gid, const CCPoint& pos);
CCSprite* updateTileForGID(unsigned int gid, CCPoint pos); CCSprite* updateTileForGID(unsigned int gid, const CCPoint& pos);
/* The layer recognizes some special properties, like cc_vertez */ /* The layer recognizes some special properties, like cc_vertez */
void parseInternalProperties(); void parseInternalProperties();
int vertexZForPos(CCPoint pos); int vertexZForPos(const CCPoint& pos);
// index // index
unsigned int atlasIndexForExistantZ(unsigned int z); unsigned int atlasIndexForExistantZ(unsigned int z);

View File

@ -40,7 +40,7 @@ namespace cocos2d {
class CC_DLL CCTMXObjectGroup : public CCObject class CC_DLL CCTMXObjectGroup : public CCObject
{ {
/** offset position of child objects */ /** offset position of child objects */
CC_SYNTHESIZE(CCPoint, m_tPositionOffset, PositionOffset); CC_SYNTHESIZE_PASS_BY_REF(CCPoint, m_tPositionOffset, PositionOffset);
/** list of properties stored in a dictionary */ /** list of properties stored in a dictionary */
CC_PROPERTY(CCStringToStringDictionary*, m_pProperties, Properties); CC_PROPERTY(CCStringToStringDictionary*, m_pProperties, Properties);
/** array of the objects */ /** array of the objects */

View File

@ -103,9 +103,9 @@ namespace cocos2d {
class CC_DLL CCTMXTiledMap : public CCNode class CC_DLL CCTMXTiledMap : public CCNode
{ {
/** the map's size property measured in tiles */ /** the map's size property measured in tiles */
CC_SYNTHESIZE(CCSize, m_tMapSize, MapSize); CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tMapSize, MapSize);
/** the tiles's size property measured in pixels */ /** the tiles's size property measured in pixels */
CC_SYNTHESIZE(CCSize, m_tTileSize, TileSize); CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tTileSize, TileSize);
/** map orientation */ /** map orientation */
CC_SYNTHESIZE(int, m_nMapOrientation, MapOrientation); CC_SYNTHESIZE(int, m_nMapOrientation, MapOrientation);
/** object groups */ /** object groups */

View File

@ -134,9 +134,9 @@ namespace cocos2d {
/// map orientation /// map orientation
CC_SYNTHESIZE(int, m_nOrientation, Orientation); CC_SYNTHESIZE(int, m_nOrientation, Orientation);
/// map width & height /// map width & height
CC_SYNTHESIZE(CCSize, m_tMapSize, MapSize); CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tMapSize, MapSize);
/// tiles width & height /// tiles width & height
CC_SYNTHESIZE(CCSize, m_tTileSize, TileSize); CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tTileSize, TileSize);
/// Layers /// Layers
CC_PROPERTY(CCMutableArray<CCTMXLayerInfo*>*, m_pLayers, Layers); CC_PROPERTY(CCMutableArray<CCTMXLayerInfo*>*, m_pLayers, Layers);
/// tilesets /// tilesets

View File

@ -98,11 +98,11 @@ public:
//char * description(); //char * description();
/** creates a CCTextFieldTTF from a fontname, alignment, dimension and font size */ /** creates a CCTextFieldTTF from a fontname, alignment, dimension and font size */
static CCTextFieldTTF * textFieldWithPlaceHolder(const char *placeholder, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize); static CCTextFieldTTF * textFieldWithPlaceHolder(const char *placeholder, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
/** creates a CCLabelTTF from a fontname and font size */ /** creates a CCLabelTTF from a fontname and font size */
static CCTextFieldTTF * textFieldWithPlaceHolder(const char *placeholder, const char *fontName, float fontSize); static CCTextFieldTTF * textFieldWithPlaceHolder(const char *placeholder, const char *fontName, float fontSize);
/** initializes the CCTextFieldTTF with a font name, alignment, dimension and font size */ /** initializes the CCTextFieldTTF with a font name, alignment, dimension and font size */
bool initWithPlaceHolder(const char *placeholder, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize); bool initWithPlaceHolder(const char *placeholder, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
/** initializes the CCTextFieldTTF with a font name and font size */ /** initializes the CCTextFieldTTF with a font name and font size */
bool initWithPlaceHolder(const char *placeholder, const char *fontName, float fontSize); bool initWithPlaceHolder(const char *placeholder, const char *fontName, float fontSize);
@ -122,7 +122,7 @@ public:
CC_SYNTHESIZE(CCTextFieldDelegate *, m_pDelegate, Delegate); CC_SYNTHESIZE(CCTextFieldDelegate *, m_pDelegate, Delegate);
CC_SYNTHESIZE_READONLY(int, m_nCharCount, CharCount); CC_SYNTHESIZE_READONLY(int, m_nCharCount, CharCount);
CC_SYNTHESIZE(ccColor3B, m_ColorSpaceHolder, ColorSpaceHolder); CC_SYNTHESIZE_PASS_BY_REF(ccColor3B, m_ColorSpaceHolder, ColorSpaceHolder);
// input text property // input text property
public: public:

View File

@ -108,7 +108,7 @@ class CC_DLL CCTexture2D : public CCObject
CC_PROPERTY_READONLY(GLuint, m_uName, Name) CC_PROPERTY_READONLY(GLuint, m_uName, Name)
/** content size */ /** content size */
CC_PROPERTY_READONLY(CCSize, m_tContentSize, ContentSizeInPixels) CC_PROPERTY_READONLY_PASS_BY_REF(CCSize, m_tContentSize, ContentSizeInPixels)
/** texture max S */ /** texture max S */
CC_PROPERTY(GLfloat, m_fMaxS, MaxS) CC_PROPERTY(GLfloat, m_fMaxS, MaxS)
/** texture max T */ /** texture max T */
@ -127,16 +127,16 @@ public:
void* keepData(void *data, unsigned int length); void* keepData(void *data, unsigned int length);
/** Intializes with a texture2d with data */ /** Intializes with a texture2d with data */
bool initWithData(const void* data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, CCSize contentSize); bool initWithData(const void* data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, const CCSize& contentSize);
/** /**
Drawing extensions to make it easy to draw basic quads using a CCTexture2D object. Drawing extensions to make it easy to draw basic quads using a CCTexture2D object.
These functions require GL_TEXTURE_2D and both GL_VERTEX_ARRAY and GL_TEXTURE_COORD_ARRAY client states to be enabled. These functions require GL_TEXTURE_2D and both GL_VERTEX_ARRAY and GL_TEXTURE_COORD_ARRAY client states to be enabled.
*/ */
/** draws a texture at a given point */ /** draws a texture at a given point */
void drawAtPoint(CCPoint point); void drawAtPoint(const CCPoint& point);
/** draws a texture inside a rect */ /** draws a texture inside a rect */
void drawInRect(CCRect rect); void drawInRect(const CCRect& rect);
/** /**
Extensions to make it easy to create a CCTexture2D object from an image file. Extensions to make it easy to create a CCTexture2D object from an image file.
@ -150,7 +150,7 @@ public:
Note that the generated textures are of type A8 - use the blending mode (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). Note that the generated textures are of type A8 - use the blending mode (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA).
*/ */
/** Initializes a texture from a string with dimensions, alignment, font name and font size */ /** Initializes a texture from a string with dimensions, alignment, font name and font size */
bool initWithString(const char *text, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize); bool initWithString(const char *text, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
/** Initializes a texture from a string with font name and font size */ /** Initializes a texture from a string with font name and font size */
bool initWithString(const char *text, const char *fontName, float fontSize); bool initWithString(const char *text, const char *fontName, float fontSize);

View File

@ -182,8 +182,8 @@ public:
~VolatileTexture(); ~VolatileTexture();
static void addImageTexture(CCTexture2D *tt, const char* imageFileName, CCImage::EImageFormat format); static void addImageTexture(CCTexture2D *tt, const char* imageFileName, CCImage::EImageFormat format);
static void addStringTexture(CCTexture2D *tt, const char* text, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize); static void addStringTexture(CCTexture2D *tt, const char* text, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
static void addDataTexture(CCTexture2D *tt, void* data, CCTexture2DPixelFormat pixelFormat, CCSize contentSize); static void addDataTexture(CCTexture2D *tt, void* data, CCTexture2DPixelFormat pixelFormat, const CCSize& contentSize);
static void removeTexture(CCTexture2D *t); static void removeTexture(CCTexture2D *t);
static void reloadAllTextures(); static void reloadAllTextures();

View File

@ -66,17 +66,17 @@ namespace cocos2d {
/** returns a tile from position x,y. /** returns a tile from position x,y.
For the moment only channel R is used For the moment only channel R is used
*/ */
ccColor3B tileAt(ccGridSize position); ccColor3B tileAt(const ccGridSize& position);
/** sets a tile at position x,y. /** sets a tile at position x,y.
For the moment only channel R is used For the moment only channel R is used
*/ */
void setTile(ccColor3B tile, ccGridSize position); void setTile(const ccColor3B& tile, const ccGridSize& position);
/** dealloc the map from memory */ /** dealloc the map from memory */
void releaseMap(); void releaseMap();
private: private:
void loadTGAfile(const char *file); void loadTGAfile(const char *file);
void calculateItemsToRender(); void calculateItemsToRender();
void updateAtlasValueAt(ccGridSize pos, ccColor3B value, unsigned int index); void updateAtlasValueAt(const ccGridSize& pos, const ccColor3B& value, unsigned int index);
void updateAtlasValues(); void updateAtlasValues();
protected: protected:

View File

@ -408,9 +408,9 @@ public:
/** creates the transition with a duration and with an RGB color /** creates the transition with a duration and with an RGB color
* Example: FadeTransition::transitionWithDuration(2, scene, ccc3(255,0,0); // red color * Example: FadeTransition::transitionWithDuration(2, scene, ccc3(255,0,0); // red color
*/ */
static CCTransitionFade* transitionWithDuration(ccTime duration,CCScene* scene, ccColor3B color = ccBLACK); static CCTransitionFade* transitionWithDuration(ccTime duration,CCScene* scene, const ccColor3B& color = ccBLACK);
/** initializes the transition with a duration and with an RGB color */ /** initializes the transition with a duration and with an RGB color */
virtual bool initWithDuration(ccTime t, CCScene*scene ,ccColor3B color); virtual bool initWithDuration(ccTime t, CCScene*scene ,const ccColor3B& color);
virtual bool initWithDuration(ccTime t,CCScene* scene); virtual bool initWithDuration(ccTime t,CCScene* scene);
virtual void onEnter(); virtual void onEnter();
@ -494,7 +494,7 @@ class CC_DLL CCTransitionFadeTR : public CCTransitionScene , public CCTransition
public: public:
CCTransitionFadeTR(); CCTransitionFadeTR();
virtual ~CCTransitionFadeTR(); virtual ~CCTransitionFadeTR();
virtual CCActionInterval* actionWithSize(ccGridSize size); virtual CCActionInterval* actionWithSize(const ccGridSize& size);
virtual void onEnter(); virtual void onEnter();
virtual CCActionInterval* easeActionWithAction(CCActionInterval * action); virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);
@ -513,7 +513,7 @@ class CC_DLL CCTransitionFadeBL : public CCTransitionFadeTR
public: public:
CCTransitionFadeBL(); CCTransitionFadeBL();
virtual ~CCTransitionFadeBL(); virtual ~CCTransitionFadeBL();
virtual CCActionInterval* actionWithSize(ccGridSize size); virtual CCActionInterval* actionWithSize(const ccGridSize& size);
public: public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeBL) DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeBL)
@ -527,7 +527,7 @@ class CC_DLL CCTransitionFadeUp : public CCTransitionFadeTR
public: public:
CCTransitionFadeUp(); CCTransitionFadeUp();
virtual ~CCTransitionFadeUp(); virtual ~CCTransitionFadeUp();
virtual CCActionInterval* actionWithSize(ccGridSize size); virtual CCActionInterval* actionWithSize(const ccGridSize& size);
public: public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeUp) DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeUp)
@ -541,7 +541,7 @@ class CC_DLL CCTransitionFadeDown : public CCTransitionFadeTR
public: public:
CCTransitionFadeDown(); CCTransitionFadeDown();
virtual ~CCTransitionFadeDown(); virtual ~CCTransitionFadeDown();
virtual CCActionInterval* actionWithSize(ccGridSize size); virtual CCActionInterval* actionWithSize(const ccGridSize& size);
public: public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeDown) DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeDown)

View File

@ -63,7 +63,7 @@ public:
*/ */
virtual bool initWithDuration(ccTime t,CCScene* scene,bool backwards); virtual bool initWithDuration(ccTime t,CCScene* scene,bool backwards);
CCActionInterval* actionWithSize(ccGridSize vector); CCActionInterval* actionWithSize(const ccGridSize& vector);
virtual void onEnter(); virtual void onEnter();

View File

@ -145,7 +145,7 @@ namespace cocos2d{
{ {
CCAtlasNode::draw(); CCAtlasNode::draw();
CCSize s = this->getContentSize(); const CCSize& s = this->getContentSize();
CCPoint vertices[4]={ CCPoint vertices[4]={
ccp(0,0),ccp(s.width,0), ccp(0,0),ccp(s.width,0),
ccp(s.width,s.height),ccp(0,s.height), ccp(s.width,s.height),ccp(0,s.height),

View File

@ -568,7 +568,7 @@ namespace cocos2d{
} }
//LabelBMFont - CCRGBAProtocol protocol //LabelBMFont - CCRGBAProtocol protocol
void CCLabelBMFont::setColor(ccColor3B var) void CCLabelBMFont::setColor(const ccColor3B& var)
{ {
m_tColor = var; m_tColor = var;
if (m_pChildren && m_pChildren->count() != 0) if (m_pChildren && m_pChildren->count() != 0)
@ -583,7 +583,7 @@ namespace cocos2d{
} }
} } } }
} }
ccColor3B CCLabelBMFont::getColor() const ccColor3B& CCLabelBMFont::getColor()
{ {
return m_tColor; return m_tColor;
} }
@ -636,7 +636,7 @@ namespace cocos2d{
} }
// LabelBMFont - AnchorPoint // LabelBMFont - AnchorPoint
void CCLabelBMFont::setAnchorPoint(CCPoint point) void CCLabelBMFont::setAnchorPoint(const CCPoint& point)
{ {
if( ! CCPoint::CCPointEqualToPoint(point, m_tAnchorPoint) ) if( ! CCPoint::CCPointEqualToPoint(point, m_tAnchorPoint) )
{ {
@ -650,7 +650,7 @@ namespace cocos2d{
void CCLabelBMFont::draw() void CCLabelBMFont::draw()
{ {
CCSpriteBatchNode::draw(); CCSpriteBatchNode::draw();
CCSize s = this->getContentSize(); const CCSize& s = this->getContentSize();
CCPoint vertices[4]={ CCPoint vertices[4]={
ccp(0,0),ccp(s.width,0), ccp(0,0),ccp(s.width,0),
ccp(s.width,s.height),ccp(0,s.height), ccp(s.width,s.height),ccp(0,s.height),

View File

@ -42,7 +42,7 @@ namespace cocos2d{
CC_SAFE_DELETE(m_pString); CC_SAFE_DELETE(m_pString);
} }
CCLabelTTF * CCLabelTTF::labelWithString(const char *label, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize) CCLabelTTF * CCLabelTTF::labelWithString(const char *label, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
{ {
CCLabelTTF *pRet = new CCLabelTTF(); CCLabelTTF *pRet = new CCLabelTTF();
if(pRet && pRet->initWithString(label, dimensions, alignment, fontName, fontSize)) if(pRet && pRet->initWithString(label, dimensions, alignment, fontName, fontSize))
@ -65,7 +65,7 @@ namespace cocos2d{
return NULL; return NULL;
} }
bool CCLabelTTF::initWithString(const char *label, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize) bool CCLabelTTF::initWithString(const char *label, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
{ {
assert(label != NULL); assert(label != NULL);
if (CCSprite::init()) if (CCSprite::init())

View File

@ -260,7 +260,7 @@ bool CCLayer::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
return true; return true;
} }
void CCLayer::ccTouchesBegan(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent) void CCLayer::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)
{ {
if (isScriptHandlerExist(CCTOUCHBEGAN)) if (isScriptHandlerExist(CCTOUCHBEGAN))
{ {
@ -322,13 +322,13 @@ void CCLayerColor::setOpacity(GLubyte var)
} }
/// color getter /// color getter
ccColor3B CCLayerColor::getColor() const ccColor3B& CCLayerColor::getColor()
{ {
return m_tColor; return m_tColor;
} }
/// color setter /// color setter
void CCLayerColor::setColor(ccColor3B var) void CCLayerColor::setColor(const ccColor3B& var)
{ {
m_tColor = var; m_tColor = var;
updateColor(); updateColor();
@ -347,7 +347,7 @@ void CCLayerColor::setBlendFunc(ccBlendFunc var)
} }
CCLayerColor * CCLayerColor::layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height) CCLayerColor * CCLayerColor::layerWithColorWidthHeight(const ccColor4B& color, GLfloat width, GLfloat height)
{ {
CCLayerColor * pLayer = new CCLayerColor(); CCLayerColor * pLayer = new CCLayerColor();
if( pLayer && pLayer->initWithColorWidthHeight(color,width,height)) if( pLayer && pLayer->initWithColorWidthHeight(color,width,height))
@ -358,7 +358,7 @@ CCLayerColor * CCLayerColor::layerWithColorWidthHeight(ccColor4B color, GLfloat
CC_SAFE_DELETE(pLayer); CC_SAFE_DELETE(pLayer);
return NULL; return NULL;
} }
CCLayerColor * CCLayerColor::layerWithColor(ccColor4B color) CCLayerColor * CCLayerColor::layerWithColor(const ccColor4B& color)
{ {
CCLayerColor * pLayer = new CCLayerColor(); CCLayerColor * pLayer = new CCLayerColor();
if(pLayer && pLayer->initWithColor(color)) if(pLayer && pLayer->initWithColor(color))
@ -370,7 +370,7 @@ CCLayerColor * CCLayerColor::layerWithColor(ccColor4B color)
return NULL; return NULL;
} }
bool CCLayerColor::initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height) bool CCLayerColor::initWithColorWidthHeight(const ccColor4B& color, GLfloat width, GLfloat height)
{ {
// default blend function // default blend function
m_tBlendFunc.src = CC_BLEND_SRC; m_tBlendFunc.src = CC_BLEND_SRC;
@ -392,7 +392,7 @@ bool CCLayerColor::initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfl
return true; return true;
} }
bool CCLayerColor::initWithColor(ccColor4B color) bool CCLayerColor::initWithColor(const ccColor4B& color)
{ {
CCSize s = CCDirector::sharedDirector()->getWinSize(); CCSize s = CCDirector::sharedDirector()->getWinSize();
this->initWithColorWidthHeight(color, s.width, s.height); this->initWithColorWidthHeight(color, s.width, s.height);
@ -400,7 +400,7 @@ bool CCLayerColor::initWithColor(ccColor4B color)
} }
/// override contentSize /// override contentSize
void CCLayerColor::setContentSize(CCSize size) void CCLayerColor::setContentSize(const CCSize& size)
{ {
m_pSquareVertices[1].x = size.width * CC_CONTENT_SCALE_FACTOR(); m_pSquareVertices[1].x = size.width * CC_CONTENT_SCALE_FACTOR();
m_pSquareVertices[2].y = size.height * CC_CONTENT_SCALE_FACTOR(); m_pSquareVertices[2].y = size.height * CC_CONTENT_SCALE_FACTOR();
@ -472,7 +472,7 @@ void CCLayerColor::draw()
// //
// CCLayerGradient // CCLayerGradient
// //
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end) CCLayerGradient* CCLayerGradient::layerWithColor(const ccColor4B& start, const ccColor4B& end)
{ {
CCLayerGradient * pLayer = new CCLayerGradient(); CCLayerGradient * pLayer = new CCLayerGradient();
if( pLayer && pLayer->initWithColor(start, end)) if( pLayer && pLayer->initWithColor(start, end))
@ -484,7 +484,7 @@ CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end)
return NULL; return NULL;
} }
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end, CCPoint v) CCLayerGradient* CCLayerGradient::layerWithColor(const ccColor4B& start, const ccColor4B& end, const CCPoint& v)
{ {
CCLayerGradient * pLayer = new CCLayerGradient(); CCLayerGradient * pLayer = new CCLayerGradient();
if( pLayer && pLayer->initWithColor(start, end, v)) if( pLayer && pLayer->initWithColor(start, end, v))
@ -496,12 +496,12 @@ CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end,
return NULL; return NULL;
} }
bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end) bool CCLayerGradient::initWithColor(const ccColor4B& start, const ccColor4B& end)
{ {
return initWithColor(start, end, ccp(0, -1)); return initWithColor(start, end, ccp(0, -1));
} }
bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end, CCPoint v) bool CCLayerGradient::initWithColor(const ccColor4B& start, const ccColor4B& end, const CCPoint& v)
{ {
m_endColor.r = end.r; m_endColor.r = end.r;
m_endColor.g = end.g; m_endColor.g = end.g;
@ -511,10 +511,9 @@ bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end, CCPoint v)
m_cStartOpacity = start.a; m_cStartOpacity = start.a;
m_AlongVector = v; m_AlongVector = v;
start.a = 255;
m_bCompressedInterpolation = true; m_bCompressedInterpolation = true;
return CCLayerColor::initWithColor(start); return CCLayerColor::initWithColor(ccc4(start.r, start.g, start.b, 255));
} }
void CCLayerGradient::updateColor() void CCLayerGradient::updateColor()
@ -573,23 +572,23 @@ void CCLayerGradient::updateColor()
m_pSquareColors[3].a = (GLubyte) (E.a + (S.a - E.a) * ((c - u.x - u.y) / (2.0f * c))); m_pSquareColors[3].a = (GLubyte) (E.a + (S.a - E.a) * ((c - u.x - u.y) / (2.0f * c)));
} }
ccColor3B CCLayerGradient::getStartColor() const ccColor3B& CCLayerGradient::getStartColor()
{ {
return m_tColor; return m_tColor;
} }
void CCLayerGradient::setStartColor(ccColor3B colors) void CCLayerGradient::setStartColor(const ccColor3B& color)
{ {
setColor(colors); setColor(color);
} }
void CCLayerGradient::setEndColor(ccColor3B colors) void CCLayerGradient::setEndColor(const ccColor3B& color)
{ {
m_endColor = colors; m_endColor = color;
updateColor(); updateColor();
} }
ccColor3B CCLayerGradient::getEndColor() const ccColor3B& CCLayerGradient::getEndColor()
{ {
return m_endColor; return m_endColor;
} }
@ -616,13 +615,13 @@ GLubyte CCLayerGradient::getEndOpacity()
return m_cEndOpacity; return m_cEndOpacity;
} }
void CCLayerGradient::setVector(CCPoint var) void CCLayerGradient::setVector(const CCPoint& var)
{ {
m_AlongVector = var; m_AlongVector = var;
updateColor(); updateColor();
} }
CCPoint CCLayerGradient::getVector() const CCPoint& CCLayerGradient::getVector()
{ {
return m_AlongVector; return m_AlongVector;
} }

View File

@ -1035,7 +1035,7 @@ CCTransitionFade::~CCTransitionFade()
} }
CCTransitionFade * CCTransitionFade::transitionWithDuration(ccTime duration, CCScene *scene, ccColor3B color) CCTransitionFade * CCTransitionFade::transitionWithDuration(ccTime duration, CCScene *scene, const ccColor3B& color)
{ {
CCTransitionFade * pTransition = new CCTransitionFade(); CCTransitionFade * pTransition = new CCTransitionFade();
pTransition->initWithDuration(duration, scene, color); pTransition->initWithDuration(duration, scene, color);
@ -1043,7 +1043,7 @@ CCTransitionFade * CCTransitionFade::transitionWithDuration(ccTime duration, CCS
return pTransition; return pTransition;
} }
bool CCTransitionFade::initWithDuration(ccTime duration, CCScene *scene, ccColor3B color) bool CCTransitionFade::initWithDuration(ccTime duration, CCScene *scene, const ccColor3B& color)
{ {
if (CCTransitionScene::initWithDuration(duration, scene)) if (CCTransitionScene::initWithDuration(duration, scene))
{ {
@ -1350,7 +1350,7 @@ void CCTransitionFadeTR::onEnter()
} }
CCActionInterval* CCTransitionFadeTR::actionWithSize(ccGridSize size) CCActionInterval* CCTransitionFadeTR::actionWithSize(const ccGridSize& size)
{ {
return CCFadeOutTRTiles::actionWithSize(size, m_fDuration); return CCFadeOutTRTiles::actionWithSize(size, m_fDuration);
} }
@ -1374,7 +1374,7 @@ CCTransitionFadeBL::~CCTransitionFadeBL()
{ {
} }
CCActionInterval* CCTransitionFadeBL::actionWithSize(ccGridSize size) CCActionInterval* CCTransitionFadeBL::actionWithSize(const ccGridSize& size)
{ {
return CCFadeOutBLTiles::actionWithSize(size, m_fDuration); return CCFadeOutBLTiles::actionWithSize(size, m_fDuration);
} }
@ -1391,7 +1391,7 @@ CCTransitionFadeUp::~CCTransitionFadeUp()
{ {
} }
CCActionInterval* CCTransitionFadeUp::actionWithSize(ccGridSize size) CCActionInterval* CCTransitionFadeUp::actionWithSize(const ccGridSize& size)
{ {
return CCFadeOutUpTiles::actionWithSize(size, m_fDuration); return CCFadeOutUpTiles::actionWithSize(size, m_fDuration);
} }
@ -1408,7 +1408,7 @@ CCTransitionFadeDown::~CCTransitionFadeDown()
{ {
} }
CCActionInterval* CCTransitionFadeDown::actionWithSize(ccGridSize size) CCActionInterval* CCTransitionFadeDown::actionWithSize(const ccGridSize& size)
{ {
return CCFadeOutDownTiles::actionWithSize(size, m_fDuration); return CCFadeOutDownTiles::actionWithSize(size, m_fDuration);
} }

View File

@ -116,7 +116,7 @@ void CCTransitionPageTurn::onEnter()
} }
CCActionInterval* CCTransitionPageTurn:: actionWithSize(ccGridSize vector) CCActionInterval* CCTransitionPageTurn:: actionWithSize(const ccGridSize& vector)
{ {
if( m_bBack ) if( m_bBack )
{ {

View File

@ -573,7 +573,7 @@ namespace cocos2d{
return m_cOpacity; return m_cOpacity;
} }
void CCMenu::setColor(cocos2d::ccColor3B var) void CCMenu::setColor(const ccColor3B& var)
{ {
m_tColor = var; m_tColor = var;
@ -595,12 +595,12 @@ namespace cocos2d{
} }
} }
ccColor3B CCMenu::getColor(void) const ccColor3B& CCMenu::getColor(void)
{ {
return m_tColor; return m_tColor;
} }
CCMenuItem* CCMenu::itemForTouch(cocos2d::CCTouch *touch) CCMenuItem* CCMenu::itemForTouch(CCTouch *touch)
{ {
CCPoint touchLocation = touch->locationInView(touch->view()); CCPoint touchLocation = touch->locationInView(touch->view());
touchLocation = CCDirector::sharedDirector()->convertToGL(touchLocation); touchLocation = CCDirector::sharedDirector()->convertToGL(touchLocation);

View File

@ -132,11 +132,11 @@ namespace cocos2d{
// //
//CCMenuItemLabel //CCMenuItemLabel
// //
ccColor3B CCMenuItemLabel::getDisabledColor() const ccColor3B& CCMenuItemLabel::getDisabledColor()
{ {
return m_tDisabledColor; return m_tDisabledColor;
} }
void CCMenuItemLabel::setDisabledColor(ccColor3B var) void CCMenuItemLabel::setDisabledColor(const ccColor3B& var)
{ {
m_tDisabledColor = var; m_tDisabledColor = var;
} }
@ -258,11 +258,11 @@ namespace cocos2d{
{ {
return m_pLabel->convertToRGBAProtocol()->getOpacity(); return m_pLabel->convertToRGBAProtocol()->getOpacity();
} }
void CCMenuItemLabel::setColor(ccColor3B color) void CCMenuItemLabel::setColor(const ccColor3B& color)
{ {
m_pLabel->convertToRGBAProtocol()->setColor(color); m_pLabel->convertToRGBAProtocol()->setColor(color);
} }
ccColor3B CCMenuItemLabel::getColor() const ccColor3B& CCMenuItemLabel::getColor()
{ {
return m_pLabel->convertToRGBAProtocol()->getColor(); return m_pLabel->convertToRGBAProtocol()->getColor();
} }
@ -452,7 +452,7 @@ namespace cocos2d{
m_pDisabledImage->convertToRGBAProtocol()->setOpacity(opacity); m_pDisabledImage->convertToRGBAProtocol()->setOpacity(opacity);
} }
} }
void CCMenuItemSprite::setColor(ccColor3B color) void CCMenuItemSprite::setColor(const ccColor3B& color)
{ {
m_pNormalImage->convertToRGBAProtocol()->setColor(color); m_pNormalImage->convertToRGBAProtocol()->setColor(color);
m_pSelectedImage->convertToRGBAProtocol()->setColor(color); m_pSelectedImage->convertToRGBAProtocol()->setColor(color);
@ -466,7 +466,7 @@ namespace cocos2d{
{ {
return m_pNormalImage->convertToRGBAProtocol()->getOpacity(); return m_pNormalImage->convertToRGBAProtocol()->getOpacity();
} }
ccColor3B CCMenuItemSprite::getColor() const ccColor3B& CCMenuItemSprite::getColor()
{ {
return m_pNormalImage->convertToRGBAProtocol()->getColor(); return m_pNormalImage->convertToRGBAProtocol()->getColor();
} }
@ -691,7 +691,7 @@ namespace cocos2d{
this->removeChildByTag(kCurrentItem, false); this->removeChildByTag(kCurrentItem, false);
CCMenuItem *item = m_pSubItems->getObjectAtIndex(m_uSelectedIndex); CCMenuItem *item = m_pSubItems->getObjectAtIndex(m_uSelectedIndex);
this->addChild(item, 0, kCurrentItem); this->addChild(item, 0, kCurrentItem);
CCSize s = item->getContentSize(); const CCSize& s = item->getContentSize();
this->setContentSize(s); this->setContentSize(s);
item->setPosition( ccp( s.width/2, s.height/2 ) ); item->setPosition( ccp( s.width/2, s.height/2 ) );
} }
@ -756,11 +756,11 @@ namespace cocos2d{
} }
} }
} }
ccColor3B CCMenuItemToggle::getColor() const ccColor3B& CCMenuItemToggle::getColor()
{ {
return m_tColor; return m_tColor;
} }
void CCMenuItemToggle::setColor(ccColor3B color) void CCMenuItemToggle::setColor(const ccColor3B& color)
{ {
m_tColor = color; m_tColor = color;
if(m_pSubItems && m_pSubItems->count() > 0) if(m_pSubItems && m_pSubItems->count() > 0)

View File

@ -38,7 +38,7 @@ namespace cocos2d {
*/ */
//implementation CCMotionStreak //implementation CCMotionStreak
CCMotionStreak * CCMotionStreak::streakWithFade(float fade, float seg, const char *imagePath, float width, float length, ccColor4B color) CCMotionStreak * CCMotionStreak::streakWithFade(float fade, float seg, const char *imagePath, float width, float length, const ccColor4B& color)
{ {
CCMotionStreak *pRet = new CCMotionStreak(); CCMotionStreak *pRet = new CCMotionStreak();
if(pRet && pRet->initWithFade(fade, seg, imagePath, width, length, color)) if(pRet && pRet->initWithFade(fade, seg, imagePath, width, length, color))
@ -50,7 +50,7 @@ CCMotionStreak * CCMotionStreak::streakWithFade(float fade, float seg, const cha
return NULL; return NULL;
} }
bool CCMotionStreak::initWithFade(float fade, float seg, const char *imagePath, float width, float length, ccColor4B color) bool CCMotionStreak::initWithFade(float fade, float seg, const char *imagePath, float width, float length, const ccColor4B& color)
{ {
m_fSegThreshold = seg; m_fSegThreshold = seg;
m_fWidth = width; m_fWidth = width;

View File

@ -56,7 +56,7 @@ bool CCProgressTimer::initWithFile(const char *pszFileName)
return this->initWithTexture(CCTextureCache::sharedTextureCache()->addImage(pszFileName)); return this->initWithTexture(CCTextureCache::sharedTextureCache()->addImage(pszFileName));
} }
CCProgressTimer* CCProgressTimer::progressWithTexture(cocos2d::CCTexture2D *pTexture) CCProgressTimer* CCProgressTimer::progressWithTexture(CCTexture2D *pTexture)
{ {
CCProgressTimer *pProgressTimer = new CCProgressTimer(); CCProgressTimer *pProgressTimer = new CCProgressTimer();
if (pProgressTimer->initWithTexture(pTexture)) if (pProgressTimer->initWithTexture(pTexture))
@ -72,7 +72,7 @@ CCProgressTimer* CCProgressTimer::progressWithTexture(cocos2d::CCTexture2D *pTex
return pProgressTimer; return pProgressTimer;
} }
bool CCProgressTimer::initWithTexture(cocos2d::CCTexture2D *pTexture) bool CCProgressTimer::initWithTexture(CCTexture2D *pTexture)
{ {
m_pSprite = CCSprite::spriteWithTexture(pTexture); m_pSprite = CCSprite::spriteWithTexture(pTexture);
CC_SAFE_RETAIN(m_pSprite); CC_SAFE_RETAIN(m_pSprite);
@ -101,7 +101,7 @@ void CCProgressTimer::setPercentage(float fPercentage)
} }
} }
void CCProgressTimer::setSprite(cocos2d::CCSprite *pSprite) void CCProgressTimer::setSprite(CCSprite *pSprite)
{ {
if (m_pSprite != pSprite) if (m_pSprite != pSprite)
{ {
@ -120,7 +120,7 @@ void CCProgressTimer::setSprite(cocos2d::CCSprite *pSprite)
} }
} }
void CCProgressTimer::setType(cocos2d::CCProgressTimerType type) void CCProgressTimer::setType(CCProgressTimerType type)
{ {
if (type != m_eType) if (type != m_eType)
{ {
@ -141,7 +141,7 @@ void CCProgressTimer::setType(cocos2d::CCProgressTimerType type)
/// ///
// @returns the vertex position from the texture coordinate // @returns the vertex position from the texture coordinate
/// ///
ccVertex2F CCProgressTimer::vertexFromTexCoord(cocos2d::CCPoint texCoord) ccVertex2F CCProgressTimer::vertexFromTexCoord(const CCPoint& texCoord)
{ {
CCPoint tmp; CCPoint tmp;
ccVertex2F ret; ccVertex2F ret;

View File

@ -166,7 +166,7 @@ void CCRenderTexture::begin()
// Save the current matrix // Save the current matrix
glPushMatrix(); glPushMatrix();
CCSize texSize = m_pTexture->getContentSizeInPixels(); const CCSize& texSize = m_pTexture->getContentSizeInPixels();
// Calculate the adjustment ratios based on the old and new projections // Calculate the adjustment ratios based on the old and new projections
CCSize size = CCDirector::sharedDirector()->getDisplaySizeInPixels(); CCSize size = CCDirector::sharedDirector()->getDisplaySizeInPixels();
@ -221,7 +221,7 @@ void CCRenderTexture::beginWithClear(float r, float g, float b, float a)
} }
// to get the rendered texture data // to get the rendered texture data
CCSize s = m_pTexture->getContentSizeInPixels(); const CCSize& s = m_pTexture->getContentSizeInPixels();
int tx = (int)s.width; int tx = (int)s.width;
int ty = (int)s.height; int ty = (int)s.height;
m_pTextureDataBuffer = new GLubyte[tx * ty * 4]; m_pTextureDataBuffer = new GLubyte[tx * ty * 4];
@ -294,7 +294,7 @@ bool CCRenderTexture::getUIImageFromBuffer(CCImage *pImage, int x, int y, int nW
return false; return false;
} }
CCSize s = m_pTexture->getContentSizeInPixels(); const CCSize& s = m_pTexture->getContentSizeInPixels();
int tx = (int)s.width; int tx = (int)s.width;
int ty = (int)s.height; int ty = (int)s.height;
@ -393,7 +393,7 @@ CCData * CCRenderTexture::getUIImageAsDataFromBuffer(int format)
// //
// CCAssert(m_ePixelFormat == kCCTexture2DPixelFormat_RGBA8888, "only RGBA8888 can be saved as image"); // CCAssert(m_ePixelFormat == kCCTexture2DPixelFormat_RGBA8888, "only RGBA8888 can be saved as image");
// //
// CCSize s = m_pTexture->getContentSizeInPixels(); // const CCSize& s = m_pTexture->getContentSizeInPixels();
// int tx = s.width; // int tx = s.width;
// int ty = s.height; // int ty = s.height;
// //

View File

@ -47,7 +47,7 @@ namespace cocos2d {
// //
// Ribbon // Ribbon
// //
CCRibbon * CCRibbon::ribbonWithWidth(float w, const char *path, float length, ccColor4B color, float fade) CCRibbon * CCRibbon::ribbonWithWidth(float w, const char *path, float length, const ccColor4B& color, float fade)
{ {
CCRibbon *pRet = new CCRibbon(); CCRibbon *pRet = new CCRibbon();
if(pRet && pRet->initWithWidth(w, path, length, color, fade)) if(pRet && pRet->initWithWidth(w, path, length, color, fade))
@ -59,7 +59,7 @@ CCRibbon * CCRibbon::ribbonWithWidth(float w, const char *path, float length, cc
return NULL; return NULL;
} }
bool CCRibbon::initWithWidth(float w, const char *path, float length, ccColor4B color, float fade) bool CCRibbon::initWithWidth(float w, const char *path, float length, const ccColor4B& color, float fade)
{ {
m_pSegments = new CCMutableArray<CCRibbonSegment*>(); m_pSegments = new CCMutableArray<CCRibbonSegment*>();
m_pDeletedSegments = new CCMutableArray<CCRibbonSegment*>(); m_pDeletedSegments = new CCMutableArray<CCRibbonSegment*>();
@ -105,12 +105,12 @@ CCRibbon::~CCRibbon()
CC_SAFE_RELEASE(m_pTexture); CC_SAFE_RELEASE(m_pTexture);
} }
CCPoint CCRibbon::rotatePoint(CCPoint vec, float rotation) CCPoint CCRibbon::rotatePoint(const CCPoint& vec, float rotation)
{ {
float xtemp = (vec.x * cosf(rotation)) - (vec.y * sinf(rotation)); CCPoint ret;
vec.y = (vec.x * sinf(rotation)) + (vec.y * cosf(rotation)); ret.x = (vec.x * cosf(rotation)) - (vec.y * sinf(rotation));
vec.x = xtemp; ret.y = (vec.x * sinf(rotation)) + (vec.y * cosf(rotation));
return vec; return ret;
} }
void CCRibbon::update(ccTime delta) void CCRibbon::update(ccTime delta)
@ -119,7 +119,7 @@ void CCRibbon::update(ccTime delta)
m_fDelta = delta; m_fDelta = delta;
} }
float CCRibbon::sideOfLine(CCPoint p, CCPoint l1, CCPoint l2) float CCRibbon::sideOfLine(const CCPoint& p, const CCPoint& l1, const CCPoint& l2)
{ {
CCPoint vp = ccpPerp(ccpSub(l1, l2)); CCPoint vp = ccpPerp(ccpSub(l1, l2));
CCPoint vx = ccpSub(p, l1); CCPoint vx = ccpSub(p, l1);
@ -327,11 +327,11 @@ ccBlendFunc CCRibbon::getBlendFunc()
return m_tBlendFunc; return m_tBlendFunc;
} }
void CCRibbon::setColor(ccColor4B var) void CCRibbon::setColor(const ccColor4B& var)
{ {
m_tColor = var; m_tColor = var;
} }
ccColor4B CCRibbon::getColor() const ccColor4B& CCRibbon::getColor()
{ {
return m_tColor; return m_tColor;
} }
@ -364,7 +364,7 @@ void CCRibbonSegment::reset()
m_bFinished = false; m_bFinished = false;
} }
void CCRibbonSegment::draw(float curTime, float fadeTime, ccColor4B color) void CCRibbonSegment::draw(float curTime, float fadeTime, const ccColor4B& color)
{ {
GLubyte r = color.r; GLubyte r = color.r;
GLubyte g = color.g; GLubyte g = color.g;

View File

@ -671,7 +671,7 @@ void CCParticleSystem::update(ccTime dt)
this->postStep(); this->postStep();
//#endif //#endif
} }
void CCParticleSystem::updateQuadWithParticle(tCCParticle* particle, CCPoint newPosition) void CCParticleSystem::updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition)
{ {
CC_UNUSED_PARAM(particle); CC_UNUSED_PARAM(particle);
CC_UNUSED_PARAM(newPosition); CC_UNUSED_PARAM(newPosition);
@ -770,12 +770,12 @@ float CCParticleSystem::getRadialAccelVar()
CCAssert( m_nEmitterMode == kCCParticleModeGravity, "Particle Mode should be Gravity"); CCAssert( m_nEmitterMode == kCCParticleModeGravity, "Particle Mode should be Gravity");
return modeA.radialAccelVar; return modeA.radialAccelVar;
} }
void CCParticleSystem::setGravity(CCPoint g) void CCParticleSystem::setGravity(const CCPoint& g)
{ {
CCAssert( m_nEmitterMode == kCCParticleModeGravity, "Particle Mode should be Gravity"); CCAssert( m_nEmitterMode == kCCParticleModeGravity, "Particle Mode should be Gravity");
modeA.gravity = g; modeA.gravity = g;
} }
CCPoint CCParticleSystem::getGravity() const CCPoint& CCParticleSystem::getGravity()
{ {
CCAssert( m_nEmitterMode == kCCParticleModeGravity, "Particle Mode should be Gravity"); CCAssert( m_nEmitterMode == kCCParticleModeGravity, "Particle Mode should be Gravity");
return modeA.gravity; return modeA.gravity;
@ -878,19 +878,19 @@ void CCParticleSystem::setDuration(float var)
{ {
m_fDuration = var; m_fDuration = var;
} }
CCPoint CCParticleSystem::getSourcePosition() const CCPoint& CCParticleSystem::getSourcePosition()
{ {
return m_tSourcePosition; return m_tSourcePosition;
} }
void CCParticleSystem::setSourcePosition(CCPoint var) void CCParticleSystem::setSourcePosition(const CCPoint& var)
{ {
m_tSourcePosition = var; m_tSourcePosition = var;
} }
CCPoint CCParticleSystem::getPosVar() const CCPoint& CCParticleSystem::getPosVar()
{ {
return m_tPosVar; return m_tPosVar;
} }
void CCParticleSystem::setPosVar(CCPoint var) void CCParticleSystem::setPosVar(const CCPoint& var)
{ {
m_tPosVar = var; m_tPosVar = var;
} }
@ -958,35 +958,35 @@ void CCParticleSystem::setEndSizeVar(float var)
{ {
m_fEndSizeVar = var; m_fEndSizeVar = var;
} }
ccColor4F CCParticleSystem::getStartColor() const ccColor4F& CCParticleSystem::getStartColor()
{ {
return m_tStartColor; return m_tStartColor;
} }
void CCParticleSystem::setStartColor(ccColor4F var) void CCParticleSystem::setStartColor(const ccColor4F& var)
{ {
m_tStartColor = var; m_tStartColor = var;
} }
ccColor4F CCParticleSystem::getStartColorVar() const ccColor4F& CCParticleSystem::getStartColorVar()
{ {
return m_tStartColorVar; return m_tStartColorVar;
} }
void CCParticleSystem::setStartColorVar(ccColor4F var) void CCParticleSystem::setStartColorVar(const ccColor4F& var)
{ {
m_tStartColorVar = var; m_tStartColorVar = var;
} }
ccColor4F CCParticleSystem::getEndColor() const ccColor4F& CCParticleSystem::getEndColor()
{ {
return m_tEndColor; return m_tEndColor;
} }
void CCParticleSystem::setEndColor(ccColor4F var) void CCParticleSystem::setEndColor(const ccColor4F& var)
{ {
m_tEndColor = var; m_tEndColor = var;
} }
ccColor4F CCParticleSystem::getEndColorVar() const ccColor4F& CCParticleSystem::getEndColorVar()
{ {
return m_tEndColorVar; return m_tEndColorVar;
} }
void CCParticleSystem::setEndColorVar(ccColor4F var) void CCParticleSystem::setEndColorVar(const ccColor4F& var)
{ {
m_tEndColorVar = var; m_tEndColorVar = var;
} }

View File

@ -75,7 +75,7 @@ CCParticleSystemPoint * CCParticleSystemPoint::particleWithFile(const char *plis
return pRet; return pRet;
} }
void CCParticleSystemPoint::updateQuadWithParticle(tCCParticle* particle, CCPoint newPosition) void CCParticleSystemPoint::updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition)
{ {
// place vertices and colos in array // place vertices and colos in array
m_pVertices[m_uParticleIdx].pos = vertex2(newPosition.x, newPosition.y); m_pVertices[m_uParticleIdx].pos = vertex2(newPosition.x, newPosition.y);

View File

@ -104,7 +104,7 @@ CCParticleSystemQuad * CCParticleSystemQuad::particleWithFile(const char *plistF
} }
// pointRect should be in Texture coordinates, not pixel coordinates // pointRect should be in Texture coordinates, not pixel coordinates
void CCParticleSystemQuad::initTexCoordsWithRect(CCRect pointRect) void CCParticleSystemQuad::initTexCoordsWithRect(const CCRect& pointRect)
{ {
// convert to pixels coords // convert to pixels coords
@ -154,7 +154,7 @@ void CCParticleSystemQuad::initTexCoordsWithRect(CCRect pointRect)
m_pQuads[i].tr.texCoords.v = top; m_pQuads[i].tr.texCoords.v = top;
} }
} }
void CCParticleSystemQuad::setTextureWithRect(CCTexture2D *texture, CCRect rect) void CCParticleSystemQuad::setTextureWithRect(CCTexture2D *texture, const CCRect& rect)
{ {
// Only update the texture if is different from the current one // Only update the texture if is different from the current one
if( !m_pTexture || texture->getName() != m_pTexture->getName() ) if( !m_pTexture || texture->getName() != m_pTexture->getName() )
@ -166,7 +166,7 @@ void CCParticleSystemQuad::setTextureWithRect(CCTexture2D *texture, CCRect rect)
} }
void CCParticleSystemQuad::setTexture(CCTexture2D* texture) void CCParticleSystemQuad::setTexture(CCTexture2D* texture)
{ {
CCSize s = texture->getContentSize(); const CCSize& s = texture->getContentSize();
this->setTextureWithRect(texture, CCRectMake(0, 0, s.width, s.height)); this->setTextureWithRect(texture, CCRectMake(0, 0, s.width, s.height));
} }
void CCParticleSystemQuad::setDisplayFrame(CCSpriteFrame *spriteFrame) void CCParticleSystemQuad::setDisplayFrame(CCSpriteFrame *spriteFrame)
@ -194,7 +194,7 @@ void CCParticleSystemQuad::initIndices()
m_pIndices[i6+3] = (GLushort) i4+3; m_pIndices[i6+3] = (GLushort) i4+3;
} }
} }
void CCParticleSystemQuad::updateQuadWithParticle(tCCParticle* particle, CCPoint newPosition) void CCParticleSystemQuad::updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition)
{ {
// colors // colors
ccV2F_C4B_T2F_Quad *quad = &(m_pQuads[m_uParticleIdx]); ccV2F_C4B_T2F_Quad *quad = &(m_pQuads[m_uParticleIdx]);

View File

@ -66,6 +66,10 @@ It's new in cocos2d-x since v0.99.5
protected: varType varName;\ protected: varType varName;\
public: virtual varType get##funName(void); public: virtual varType get##funName(void);
#define CC_PROPERTY_READONLY_PASS_BY_REF(varType, varName, funName)\
protected: varType varName;\
public: virtual const varType& get##funName(void);
/** CC_PROPERTY is used to declare a protected variable. /** CC_PROPERTY is used to declare a protected variable.
We can use getter to read the variable, and use the setter 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 varType : the type of variable.
@ -81,6 +85,11 @@ protected: varType varName;\
public: virtual varType get##funName(void);\ public: virtual varType get##funName(void);\
public: virtual void set##funName(varType var); public: virtual void set##funName(varType var);
#define CC_PROPERTY_PASS_BY_REF(varType, varName, funName)\
protected: varType varName;\
public: virtual const varType& get##funName(void);\
public: virtual void set##funName(const varType& var);
/** CC_SYNTHESIZE_READONLY is used to declare a protected variable. /** CC_SYNTHESIZE_READONLY is used to declare a protected variable.
We can use getter to read the variable. We can use getter to read the variable.
@param varType : the type of variable. @param varType : the type of variable.
@ -94,6 +103,10 @@ public: virtual void set##funName(varType var);
protected: varType varName;\ protected: varType varName;\
public: inline varType get##funName(void) const { return varName; } public: inline varType get##funName(void) const { return varName; }
#define CC_SYNTHESIZE_READONLY_PASS_BY_REF(varType, varName, funName)\
protected: varType varName;\
public: inline const varType& get##funName(void) const { return varName; }
/** CC_SYNTHESIZE is used to declare a protected variable. /** CC_SYNTHESIZE is used to declare a protected variable.
We can use getter to read the variable, and use the setter 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 varType : the type of variable.
@ -109,6 +122,11 @@ protected: varType varName;\
public: inline varType get##funName(void) const { return varName; }\ public: inline varType get##funName(void) const { return varName; }\
public: inline void set##funName(varType var){ varName = var; } public: inline void set##funName(varType var){ varName = var; }
#define CC_SYNTHESIZE_PASS_BY_REF(varType, varName, funName)\
protected: varType varName;\
public: inline const varType& get##funName(void) const { return varName; }\
public: inline void set##funName(const varType& var){ varName = var; }
#define CC_SAFE_DELETE(p) if(p) { delete p; p = 0; } #define CC_SAFE_DELETE(p) if(p) { delete p; p = 0; }
#define CC_SAFE_DELETE_ARRAY(p) if(p) { delete[] p; p = 0; } #define CC_SAFE_DELETE_ARRAY(p) if(p) { delete[] p; p = 0; }
#define CC_SAFE_FREE(p) if(p) { free(p); p = 0; } #define CC_SAFE_FREE(p) if(p) { free(p); p = 0; }

View File

@ -78,7 +78,7 @@ CCApplication& CCApplication::sharedApplication()
ccLanguageType CCApplication::getCurrentLanguage() ccLanguageType CCApplication::getCurrentLanguage()
{ {
char* pLanguageName = getCurrentLanguageJNI(); const char *pLanguageName = getCurrentLanguageJNI();
ccLanguageType ret = kLanguageEnglish; ccLanguageType ret = kLanguageEnglish;
if (0 == strcmp("zh", pLanguageName)) if (0 == strcmp("zh", pLanguageName))

View File

@ -29,8 +29,6 @@ NS_CC_BEGIN;
#define MAX_PATH 256 #define MAX_PATH 256
using namespace std;
// record the resource path // record the resource path
static string s_strResourcePath = ""; static string s_strResourcePath = "";
@ -133,15 +131,12 @@ string CCFileUtils::getWriteablePath()
{ {
// the path is: /data/data/ + package name // the path is: /data/data/ + package name
string dir("/data/data/"); string dir("/data/data/");
char* tmp = getPackageNameJNI(); const char *tmp = getPackageNameJNI();
if (tmp) if (tmp)
{ {
dir.append(tmp).append("/"); dir.append(tmp).append("/");
// release memory
delete [] tmp;
return dir; return dir;
} }
else else

View File

@ -23,6 +23,7 @@ THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "SystemInfoJni.h" #include "SystemInfoJni.h"
#include "JniHelper.h" #include "JniHelper.h"
#include "CCString.h"
#include <android/log.h> #include <android/log.h>
#include <jni.h> #include <jni.h>
@ -39,10 +40,9 @@ using namespace cocos2d;
extern "C" extern "C"
{ {
char* getPackageNameJNI() const char* getPackageNameJNI()
{ {
JniMethodInfo t; JniMethodInfo t;
char* ret = 0;
if (JniHelper::getStaticMethodInfo(t, if (JniHelper::getStaticMethodInfo(t,
"org/cocos2dx/lib/Cocos2dxActivity", "org/cocos2dx/lib/Cocos2dxActivity",
@ -50,21 +50,23 @@ extern "C"
"()Ljava/lang/String;")) "()Ljava/lang/String;"))
{ {
jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID); jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID);
ret = (char*)JniHelper::jstring2string(str).c_str(); CCString *ret = new CCString(JniHelper::jstring2string(str).c_str());
ret->autorelease();
LOGD("package name %s", ret); LOGD("package name %s", ret->m_sString.c_str());
return ret->m_sString.c_str();
} }
return ret; return 0;
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// handle get current language // handle get current language
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
char* getCurrentLanguageJNI() const char* getCurrentLanguageJNI()
{ {
JniMethodInfo t; JniMethodInfo t;
char* ret = 0;
if (JniHelper::getStaticMethodInfo(t if (JniHelper::getStaticMethodInfo(t
, "org/cocos2dx/lib/Cocos2dxActivity" , "org/cocos2dx/lib/Cocos2dxActivity"
@ -72,11 +74,14 @@ extern "C"
, "()Ljava/lang/String;")) , "()Ljava/lang/String;"))
{ {
jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID); jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID);
ret = (char*)JniHelper::jstring2string(str).c_str(); CCString *ret = new CCString(JniHelper::jstring2string(str).c_str());
ret->autorelease();
LOGD("language name %s", ret); LOGD("language name %s", ret.c_str());
return ret->m_sString.c_str();
} }
return ret; return 0;
} }
} }

View File

@ -29,8 +29,8 @@ THE SOFTWARE.
extern "C" extern "C"
{ {
extern char* getCurrentLanguageJNI(); extern const char* getCurrentLanguageJNI();
extern char* getPackageNameJNI(); extern const char* getPackageNameJNI();
} }
#endif // __ANDROID_SYSTEM_INFO_JNI_H__ #endif // __ANDROID_SYSTEM_INFO_JNI_H__

View File

@ -84,6 +84,29 @@ static AccelerometerDispatcher* s_pAccelerometerDispatcher;
accelerationCpp.z = acceleration.z; accelerationCpp.z = acceleration.z;
accelerationCpp.timestamp = acceleration.timestamp; accelerationCpp.timestamp = acceleration.timestamp;
double tmp = accelerationCpp.x;
switch ([[UIApplication sharedApplication] statusBarOrientation])
{
case UIInterfaceOrientationLandscapeRight:
accelerationCpp.x = -acceleration.y;
accelerationCpp.y = tmp;
break;
case UIInterfaceOrientationLandscapeLeft:
accelerationCpp.x = acceleration.y;
accelerationCpp.y = -tmp;
break;
case UIInterfaceOrientationPortraitUpsideDown:
accelerationCpp.x = -accelerationCpp.y;
accelerationCpp.y = -tmp;
break;
case UIInterfaceOrientationPortrait:
break;
}
for (AccelerometerDelegateWrapper *wrapper in delegateWrappers) { for (AccelerometerDelegateWrapper *wrapper in delegateWrappers) {
[wrapper didAccelerate: &accelerationCpp]; [wrapper didAccelerate: &accelerationCpp];
} }

View File

@ -101,7 +101,7 @@ namespace cocos2d
m_pobFrames->addObject(pFrame); m_pobFrames->addObject(pFrame);
} }
void CCAnimation::addFrameWithTexture(CCTexture2D *pobTexture, CCRect rect) void CCAnimation::addFrameWithTexture(CCTexture2D *pobTexture, const CCRect& rect)
{ {
CCSpriteFrame *pFrame = CCSpriteFrame::frameWithTexture(pobTexture, rect); CCSpriteFrame *pFrame = CCSpriteFrame::frameWithTexture(pobTexture, rect);
m_pobFrames->addObject(pFrame); m_pobFrames->addObject(pFrame);

View File

@ -59,7 +59,7 @@ struct transformValues_ {
bool visible; bool visible;
}; };
CCSprite* CCSprite::spriteWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rect) CCSprite* CCSprite::spriteWithBatchNode(CCSpriteBatchNode *batchNode, const CCRect& rect)
{ {
CCSprite *pobSprite = new CCSprite(); CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithBatchNode(batchNode, rect)) if (pobSprite && pobSprite->initWithBatchNode(batchNode, rect))
@ -71,7 +71,7 @@ CCSprite* CCSprite::spriteWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rec
return NULL; return NULL;
} }
bool CCSprite::initWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rect) bool CCSprite::initWithBatchNode(CCSpriteBatchNode *batchNode, const CCRect& rect)
{ {
if (initWithTexture(batchNode->getTexture(), rect)) if (initWithTexture(batchNode->getTexture(), rect))
{ {
@ -81,7 +81,7 @@ bool CCSprite::initWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rect)
return false; return false;
} }
bool CCSprite::initWithBatchNodeRectInPixels(CCSpriteBatchNode *batchNode, CCRect rect) bool CCSprite::initWithBatchNodeRectInPixels(CCSpriteBatchNode *batchNode, const CCRect& rect)
{ {
if (initWithTexture(batchNode->getTexture())) if (initWithTexture(batchNode->getTexture()))
{ {
@ -104,7 +104,7 @@ CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture)
return NULL; return NULL;
} }
CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, CCRect rect) CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect)
{ {
CCSprite *pobSprite = new CCSprite(); CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithTexture(pTexture, rect)) if (pobSprite && pobSprite->initWithTexture(pTexture, rect))
@ -116,7 +116,7 @@ CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, CCRect rect)
return NULL; return NULL;
} }
CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, CCRect rect, CCPoint offset) CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect, const CCPoint& offset)
{ {
CC_UNUSED_PARAM(pTexture); CC_UNUSED_PARAM(pTexture);
CC_UNUSED_PARAM(rect); CC_UNUSED_PARAM(rect);
@ -138,7 +138,7 @@ CCSprite* CCSprite::spriteWithFile(const char *pszFileName)
return NULL; return NULL;
} }
CCSprite* CCSprite::spriteWithFile(const char *pszFileName, CCRect rect) CCSprite* CCSprite::spriteWithFile(const char *pszFileName, const CCRect& rect)
{ {
CCSprite *pobSprite = new CCSprite(); CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithFile(pszFileName, rect)) if (pobSprite && pobSprite->initWithFile(pszFileName, rect))
@ -221,7 +221,7 @@ bool CCSprite::init(void)
return true; return true;
} }
bool CCSprite::initWithTexture(CCTexture2D *pTexture, CCRect rect) bool CCSprite::initWithTexture(CCTexture2D *pTexture, const CCRect& rect)
{ {
assert(pTexture != NULL); assert(pTexture != NULL);
// IMPORTANT: [self init] and not [super init]; // IMPORTANT: [self init] and not [super init];
@ -260,7 +260,7 @@ bool CCSprite::initWithFile(const char *pszFilename)
return false; return false;
} }
bool CCSprite::initWithFile(const char *pszFilename, CCRect rect) bool CCSprite::initWithFile(const char *pszFilename, const CCRect& rect)
{ {
assert(pszFilename != NULL); assert(pszFilename != NULL);
@ -313,7 +313,7 @@ CCSprite* CCSprite::initWithCGImage(CGImageRef pImage, const char *pszKey)
// XXX: possible bug. See issue #349. New API should be added // XXX: possible bug. See issue #349. New API should be added
CCTexture2D *pTexture = CCTextureCache::sharedTextureCache()->addCGImage(pImage, pszKey); CCTexture2D *pTexture = CCTextureCache::sharedTextureCache()->addCGImage(pImage, pszKey);
CCSize size = pTexture->getContentSize(); const CCSize& size = pTexture->getContentSize();
CCRect rect = CCRectMake(0 ,0, size.width, size.height); CCRect rect = CCRectMake(0 ,0, size.width, size.height);
return initWithTexture(texture, rect); return initWithTexture(texture, rect);
@ -356,14 +356,14 @@ void CCSprite::useBatchNode(CCSpriteBatchNode *batchNode)
m_pobBatchNode = batchNode; m_pobBatchNode = batchNode;
} }
void CCSprite::setTextureRect(CCRect rect) void CCSprite::setTextureRect(const CCRect& rect)
{ {
CCRect rectInPixels = CC_RECT_POINTS_TO_PIXELS(rect); CCRect rectInPixels = CC_RECT_POINTS_TO_PIXELS(rect);
setTextureRectInPixels(rectInPixels, false, rectInPixels.size); setTextureRectInPixels(rectInPixels, false, rectInPixels.size);
} }
void CCSprite::setTextureRectInPixels(CCRect rect, bool rotated, CCSize size) void CCSprite::setTextureRectInPixels(const CCRect& rect, bool rotated, const CCSize& size)
{ {
m_obRectInPixels = rect; m_obRectInPixels = rect;
m_obRect = CC_RECT_PIXELS_TO_POINTS(rect); m_obRect = CC_RECT_PIXELS_TO_POINTS(rect);
@ -412,7 +412,7 @@ void CCSprite::setTextureRectInPixels(CCRect rect, bool rotated, CCSize size)
} }
void CCSprite::updateTextureCoords(CCRect rect) void CCSprite::updateTextureCoords(const CCRect& rect)
{ {
CCTexture2D *tex = m_bUsesBatchNode ? m_pobTextureAtlas->getTexture() : m_pobTexture; CCTexture2D *tex = m_bUsesBatchNode ? m_pobTextureAtlas->getTexture() : m_pobTexture;
if (! tex) if (! tex)
@ -702,8 +702,8 @@ void CCSprite::draw(void)
ccDrawPoly(vertices, 4, true); ccDrawPoly(vertices, 4, true);
#elif CC_SPRITE_DEBUG_DRAW == 2 #elif CC_SPRITE_DEBUG_DRAW == 2
// draw texture box // draw texture box
CCSize s = m_obRect.size; const CCSize& s = m_obRect.size;
CCPoint offsetPix = getOffsetPositionInPixels(); const CCPoint& offsetPix = getOffsetPositionInPixels();
CCPoint vertices[4] = { CCPoint vertices[4] = {
ccp(offsetPix.x,offsetPix.y), ccp(offsetPix.x+s.width,offsetPix.y), ccp(offsetPix.x,offsetPix.y), ccp(offsetPix.x+s.width,offsetPix.y),
ccp(offsetPix.x+s.width,offsetPix.y+s.height), ccp(offsetPix.x,offsetPix.y+s.height) ccp(offsetPix.x+s.width,offsetPix.y+s.height), ccp(offsetPix.x,offsetPix.y+s.height)
@ -826,13 +826,13 @@ void CCSprite::setDirtyRecursively(bool bValue)
} \ } \
} }
void CCSprite::setPosition(CCPoint pos) void CCSprite::setPosition(const CCPoint& pos)
{ {
CCNode::setPosition(pos); CCNode::setPosition(pos);
SET_DIRTY_RECURSIVELY(); SET_DIRTY_RECURSIVELY();
} }
void CCSprite::setPositionInPixels(CCPoint pos) void CCSprite::setPositionInPixels(const CCPoint& pos)
{ {
CCNode::setPositionInPixels(pos); CCNode::setPositionInPixels(pos);
SET_DIRTY_RECURSIVELY(); SET_DIRTY_RECURSIVELY();
@ -880,7 +880,7 @@ void CCSprite::setVertexZ(float fVertexZ)
SET_DIRTY_RECURSIVELY(); SET_DIRTY_RECURSIVELY();
} }
void CCSprite::setAnchorPoint(CCPoint anchor) void CCSprite::setAnchorPoint(const CCPoint& anchor)
{ {
CCNode::setAnchorPoint(anchor); CCNode::setAnchorPoint(anchor);
SET_DIRTY_RECURSIVELY(); SET_DIRTY_RECURSIVELY();
@ -976,7 +976,7 @@ void CCSprite::setOpacity(GLubyte opacity)
updateColor(); updateColor();
} }
ccColor3B CCSprite::getColor(void) const ccColor3B& CCSprite::getColor(void)
{ {
if (m_bOpacityModifyRGB) if (m_bOpacityModifyRGB)
{ {
@ -986,7 +986,7 @@ ccColor3B CCSprite::getColor(void)
return m_sColor; return m_sColor;
} }
void CCSprite::setColor(ccColor3B color3) void CCSprite::setColor(const ccColor3B& color3)
{ {
m_sColor = m_sColorUnmodified = color3; m_sColor = m_sColorUnmodified = color3;

View File

@ -39,7 +39,7 @@ namespace cocos2d
/* /*
* creation with CCTexture2D * creation with CCTexture2D
*/ */
CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithTexture(cocos2d::CCTexture2D *tex) CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithTexture(CCTexture2D *tex)
{ {
CCSpriteBatchNode *batchNode = new CCSpriteBatchNode(); CCSpriteBatchNode *batchNode = new CCSpriteBatchNode();
batchNode->initWithTexture(tex, defaultCapacity); batchNode->initWithTexture(tex, defaultCapacity);
@ -81,7 +81,7 @@ namespace cocos2d
/* /*
* init with CCTexture2D * init with CCTexture2D
*/ */
bool CCSpriteBatchNode::initWithTexture(cocos2d::CCTexture2D *tex, unsigned int capacity) bool CCSpriteBatchNode::initWithTexture(CCTexture2D *tex, unsigned int capacity)
{ {
m_blendFunc.src = CC_BLEND_SRC; m_blendFunc.src = CC_BLEND_SRC;
m_blendFunc.dst = CC_BLEND_DST; m_blendFunc.dst = CC_BLEND_DST;

View File

@ -29,7 +29,7 @@ THE SOFTWARE.
namespace cocos2d { namespace cocos2d {
// implementation of CCSpriteFrame // implementation of CCSpriteFrame
CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D *pobTexture, CCRect rect) CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D *pobTexture, const CCRect& rect)
{ {
CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();; CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();;
pSpriteFrame->initWithTexture(pobTexture, rect); pSpriteFrame->initWithTexture(pobTexture, rect);
@ -38,7 +38,7 @@ CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D *pobTexture, CCRect r
return pSpriteFrame; return pSpriteFrame;
} }
CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D* pobTexture, CCRect rect, bool rotated, CCPoint offset, CCSize originalSize) CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize)
{ {
CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();; CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();;
pSpriteFrame->initWithTexture(pobTexture, rect, rotated, offset, originalSize); pSpriteFrame->initWithTexture(pobTexture, rect, rotated, offset, originalSize);
@ -47,13 +47,13 @@ CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D* pobTexture, CCRect r
return pSpriteFrame; return pSpriteFrame;
} }
bool CCSpriteFrame::initWithTexture(CCTexture2D* pobTexture, CCRect rect) bool CCSpriteFrame::initWithTexture(CCTexture2D* pobTexture, const CCRect& rect)
{ {
CCRect rectInPixels = CC_RECT_POINTS_TO_PIXELS(rect); CCRect rectInPixels = CC_RECT_POINTS_TO_PIXELS(rect);
return initWithTexture(pobTexture, rectInPixels, false, CCPointZero, rectInPixels.size); return initWithTexture(pobTexture, rectInPixels, false, CCPointZero, rectInPixels.size);
} }
bool CCSpriteFrame::initWithTexture(CCTexture2D* pobTexture, CCRect rect, bool rotated, CCPoint offset, CCSize originalSize) bool CCSpriteFrame::initWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize)
{ {
m_pobTexture = pobTexture; m_pobTexture = pobTexture;
@ -88,13 +88,13 @@ CCObject* CCSpriteFrame::copyWithZone(CCZone *pZone)
return pCopy; return pCopy;
} }
void CCSpriteFrame::setRect(CCRect rect) void CCSpriteFrame::setRect(const CCRect& rect)
{ {
m_obRect = rect; m_obRect = rect;
m_obRectInPixels = CC_RECT_POINTS_TO_PIXELS(m_obRect); m_obRectInPixels = CC_RECT_POINTS_TO_PIXELS(m_obRect);
} }
void CCSpriteFrame::setRectInPixels(CCRect rectInPixels) void CCSpriteFrame::setRectInPixels(const CCRect& rectInPixels)
{ {
m_obRectInPixels = rectInPixels; m_obRectInPixels = rectInPixels;
m_obRect = CC_RECT_PIXELS_TO_POINTS(rectInPixels); m_obRect = CC_RECT_PIXELS_TO_POINTS(rectInPixels);

View File

@ -69,7 +69,7 @@ CCTextFieldTTF::~CCTextFieldTTF()
// static constructor // static constructor
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
CCTextFieldTTF * CCTextFieldTTF::textFieldWithPlaceHolder(const char *placeholder, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize) CCTextFieldTTF * CCTextFieldTTF::textFieldWithPlaceHolder(const char *placeholder, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
{ {
CCTextFieldTTF *pRet = new CCTextFieldTTF(); CCTextFieldTTF *pRet = new CCTextFieldTTF();
if(pRet && pRet->initWithPlaceHolder("", dimensions, alignment, fontName, fontSize)) if(pRet && pRet->initWithPlaceHolder("", dimensions, alignment, fontName, fontSize))
@ -105,7 +105,7 @@ CCTextFieldTTF * CCTextFieldTTF::textFieldWithPlaceHolder(const char *placeholde
// initialize // initialize
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
bool CCTextFieldTTF::initWithPlaceHolder(const char *placeholder, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize) bool CCTextFieldTTF::initWithPlaceHolder(const char *placeholder, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
{ {
if (placeholder) if (placeholder)
{ {

View File

@ -102,7 +102,7 @@ GLuint CCTexture2D::getName()
return m_uName; return m_uName;
} }
CCSize CCTexture2D::getContentSizeInPixels() const CCSize& CCTexture2D::getContentSizeInPixels()
{ {
return m_tContentSize; return m_tContentSize;
} }
@ -153,7 +153,7 @@ bool CCTexture2D::getHasPremultipliedAlpha()
return m_bHasPremultipliedAlpha; return m_bHasPremultipliedAlpha;
} }
bool CCTexture2D::initWithData(const void *data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, CCSize contentSize) bool CCTexture2D::initWithData(const void *data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, const CCSize& contentSize)
{ {
glPixelStorei(GL_UNPACK_ALIGNMENT,1); glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glGenTextures(1, &m_uName); glGenTextures(1, &m_uName);
@ -441,7 +441,7 @@ bool CCTexture2D::initWithString(const char *text, const char *fontName, float f
{ {
return initWithString(text, CCSizeMake(0,0), CCTextAlignmentCenter, fontName, fontSize); return initWithString(text, CCSizeMake(0,0), CCTextAlignmentCenter, fontName, fontSize);
} }
bool CCTexture2D::initWithString(const char *text, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize) bool CCTexture2D::initWithString(const char *text, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
{ {
#if CC_ENABLE_CACHE_TEXTTURE_DATA #if CC_ENABLE_CACHE_TEXTTURE_DATA
// cache the texture data // cache the texture data
@ -462,7 +462,7 @@ bool CCTexture2D::initWithString(const char *text, CCSize dimensions, CCTextAlig
// implementation CCTexture2D (Drawing) // implementation CCTexture2D (Drawing)
void CCTexture2D::drawAtPoint(CCPoint point) void CCTexture2D::drawAtPoint(const CCPoint& point)
{ {
GLfloat coordinates[] = { GLfloat coordinates[] = {
0.0f, m_fMaxT, 0.0f, m_fMaxT,
@ -485,7 +485,7 @@ void CCTexture2D::drawAtPoint(CCPoint point)
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
} }
void CCTexture2D::drawInRect(CCRect rect) void CCTexture2D::drawInRect(const CCRect& rect)
{ {
GLfloat coordinates[] = { GLfloat coordinates[] = {
0.0f, m_fMaxT, 0.0f, m_fMaxT,

View File

@ -534,7 +534,7 @@ void VolatileTexture::addImageTexture(CCTexture2D *tt, const char* imageFileName
vt->m_FmtImage = format; vt->m_FmtImage = format;
} }
void VolatileTexture::addDataTexture(CCTexture2D *tt, void* data, CCTexture2DPixelFormat pixelFormat, CCSize contentSize) void VolatileTexture::addDataTexture(CCTexture2D *tt, void* data, CCTexture2DPixelFormat pixelFormat, const CCSize& contentSize)
{ {
if (isReloading) if (isReloading)
return; return;
@ -559,7 +559,7 @@ void VolatileTexture::addDataTexture(CCTexture2D *tt, void* data, CCTexture2DPix
vt->m_TextureSize = contentSize; vt->m_TextureSize = contentSize;
} }
void VolatileTexture::addStringTexture(CCTexture2D *tt, const char* text, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize) void VolatileTexture::addStringTexture(CCTexture2D *tt, const char* text, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
{ {
if (isReloading) if (isReloading)
return; return;

View File

@ -77,7 +77,7 @@ namespace cocos2d {
CC_UNUSED_PARAM(tag); CC_UNUSED_PARAM(tag);
CCAssert(0,"ParallaxNode: use addChild:z:parallaxRatio:positionOffset instead"); CCAssert(0,"ParallaxNode: use addChild:z:parallaxRatio:positionOffset instead");
} }
void CCParallaxNode::addChild(CCNode *child, unsigned int z, CCPoint ratio, CCPoint offset) void CCParallaxNode::addChild(CCNode *child, unsigned int z, const CCPoint& ratio, const CCPoint& offset)
{ {
CCAssert( child != NULL, "Argument must be non-nil"); CCAssert( child != NULL, "Argument must be non-nil");
CCPointObject *obj = CCPointObject::pointWithCCPoint(ratio, offset); CCPointObject *obj = CCPointObject::pointWithCCPoint(ratio, offset);

View File

@ -221,7 +221,7 @@ namespace cocos2d {
} }
// CCTMXLayer - obtaining tiles/gids // CCTMXLayer - obtaining tiles/gids
CCSprite * CCTMXLayer::tileAt(CCPoint pos) CCSprite * CCTMXLayer::tileAt(const CCPoint& pos)
{ {
CCAssert( pos.x < m_tLayerSize.width && pos.y < m_tLayerSize.height && pos.x >=0 && pos.y >=0, "TMXLayer: invalid position"); CCAssert( pos.x < m_tLayerSize.width && pos.y < m_tLayerSize.height && pos.x >=0 && pos.y >=0, "TMXLayer: invalid position");
CCAssert( m_pTiles && m_pAtlasIndexArray, "TMXLayer: the tiles map has been released"); CCAssert( m_pTiles && m_pAtlasIndexArray, "TMXLayer: the tiles map has been released");
@ -255,7 +255,7 @@ namespace cocos2d {
} }
return tile; return tile;
} }
unsigned int CCTMXLayer::tileGIDAt(CCPoint pos) unsigned int CCTMXLayer::tileGIDAt(const CCPoint& pos)
{ {
CCAssert( pos.x < m_tLayerSize.width && pos.y < m_tLayerSize.height && pos.x >=0 && pos.y >=0, "TMXLayer: invalid position"); CCAssert( pos.x < m_tLayerSize.width && pos.y < m_tLayerSize.height && pos.x >=0 && pos.y >=0, "TMXLayer: invalid position");
CCAssert( m_pTiles && m_pAtlasIndexArray, "TMXLayer: the tiles map has been released"); CCAssert( m_pTiles && m_pAtlasIndexArray, "TMXLayer: the tiles map has been released");
@ -265,7 +265,7 @@ namespace cocos2d {
} }
// CCTMXLayer - adding helper methods // CCTMXLayer - adding helper methods
CCSprite * CCTMXLayer::insertTileForGID(unsigned int gid, CCPoint pos) CCSprite * CCTMXLayer::insertTileForGID(unsigned int gid, const CCPoint& pos)
{ {
CCRect rect = m_pTileSet->rectForGID(gid); CCRect rect = m_pTileSet->rectForGID(gid);
rect = CCRect::CCRectMake(rect.origin.x / m_fContentScaleFactor, rect.origin.y / m_fContentScaleFactor, rect.size.width/ m_fContentScaleFactor, rect.size.height/ m_fContentScaleFactor); rect = CCRect::CCRectMake(rect.origin.x / m_fContentScaleFactor, rect.origin.y / m_fContentScaleFactor, rect.size.width/ m_fContentScaleFactor, rect.size.height/ m_fContentScaleFactor);
@ -315,7 +315,7 @@ namespace cocos2d {
m_pTiles[z] = gid; m_pTiles[z] = gid;
return m_pReusedTile; return m_pReusedTile;
} }
CCSprite * CCTMXLayer::updateTileForGID(unsigned int gid, CCPoint pos) CCSprite * CCTMXLayer::updateTileForGID(unsigned int gid, const CCPoint& pos)
{ {
CCRect rect = m_pTileSet->rectForGID(gid); CCRect rect = m_pTileSet->rectForGID(gid);
rect = CCRect::CCRectMake(rect.origin.x / m_fContentScaleFactor, rect.origin.y / m_fContentScaleFactor, rect.size.width/ m_fContentScaleFactor, rect.size.height/ m_fContentScaleFactor); rect = CCRect::CCRectMake(rect.origin.x / m_fContentScaleFactor, rect.origin.y / m_fContentScaleFactor, rect.size.width/ m_fContentScaleFactor, rect.size.height/ m_fContentScaleFactor);
@ -348,7 +348,7 @@ namespace cocos2d {
// used only when parsing the map. useless after the map was parsed // used only when parsing the map. useless after the map was parsed
// since lot's of assumptions are no longer true // since lot's of assumptions are no longer true
CCSprite * CCTMXLayer::appendTileForGID(unsigned int gid, CCPoint pos) CCSprite * CCTMXLayer::appendTileForGID(unsigned int gid, const CCPoint& pos)
{ {
CCRect rect = m_pTileSet->rectForGID(gid); CCRect rect = m_pTileSet->rectForGID(gid);
rect = CCRect::CCRectMake(rect.origin.x / m_fContentScaleFactor, rect.origin.y / m_fContentScaleFactor, rect.size.width/ m_fContentScaleFactor, rect.size.height/ m_fContentScaleFactor); rect = CCRect::CCRectMake(rect.origin.x / m_fContentScaleFactor, rect.origin.y / m_fContentScaleFactor, rect.size.width/ m_fContentScaleFactor, rect.size.height/ m_fContentScaleFactor);
@ -413,7 +413,7 @@ namespace cocos2d {
} }
// CCTMXLayer - adding / remove tiles // CCTMXLayer - adding / remove tiles
void CCTMXLayer::setTileGID(unsigned int gid, CCPoint pos) void CCTMXLayer::setTileGID(unsigned int gid, const CCPoint& pos)
{ {
CCAssert( pos.x < m_tLayerSize.width && pos.y < m_tLayerSize.height && pos.x >=0 && pos.y >=0, "TMXLayer: invalid position"); CCAssert( pos.x < m_tLayerSize.width && pos.y < m_tLayerSize.height && pos.x >=0 && pos.y >=0, "TMXLayer: invalid position");
CCAssert( m_pTiles && m_pAtlasIndexArray, "TMXLayer: the tiles map has been released"); CCAssert( m_pTiles && m_pAtlasIndexArray, "TMXLayer: the tiles map has been released");
@ -477,7 +477,7 @@ namespace cocos2d {
ccCArrayRemoveValueAtIndex(m_pAtlasIndexArray, atlasIndex); ccCArrayRemoveValueAtIndex(m_pAtlasIndexArray, atlasIndex);
CCSpriteBatchNode::removeChild(sprite, cleanup); CCSpriteBatchNode::removeChild(sprite, cleanup);
} }
void CCTMXLayer::removeTileAt(CCPoint pos) void CCTMXLayer::removeTileAt(const CCPoint& pos)
{ {
CCAssert( pos.x < m_tLayerSize.width && pos.y < m_tLayerSize.height && pos.x >=0 && pos.y >=0, "TMXLayer: invalid position"); CCAssert( pos.x < m_tLayerSize.width && pos.y < m_tLayerSize.height && pos.x >=0 && pos.y >=0, "TMXLayer: invalid position");
CCAssert( m_pTiles && m_pAtlasIndexArray, "TMXLayer: the tiles map has been released"); CCAssert( m_pTiles && m_pAtlasIndexArray, "TMXLayer: the tiles map has been released");
@ -527,7 +527,7 @@ namespace cocos2d {
} }
//CCTMXLayer - obtaining positions, offset //CCTMXLayer - obtaining positions, offset
CCPoint CCTMXLayer::calculateLayerOffset(CCPoint pos) CCPoint CCTMXLayer::calculateLayerOffset(const CCPoint& pos)
{ {
CCPoint ret = CCPointZero; CCPoint ret = CCPointZero;
switch( m_uLayerOrientation ) switch( m_uLayerOrientation )
@ -545,7 +545,7 @@ namespace cocos2d {
} }
return ret; return ret;
} }
CCPoint CCTMXLayer::positionAt(CCPoint pos) CCPoint CCTMXLayer::positionAt(const CCPoint& pos)
{ {
CCPoint ret = CCPointZero; CCPoint ret = CCPointZero;
switch( m_uLayerOrientation ) switch( m_uLayerOrientation )
@ -562,19 +562,19 @@ namespace cocos2d {
} }
return ret; return ret;
} }
CCPoint CCTMXLayer::positionForOrthoAt(CCPoint pos) CCPoint CCTMXLayer::positionForOrthoAt(const CCPoint& pos)
{ {
CCPoint xy = CCPointMake(pos.x * m_tMapTileSize.width, CCPoint xy = CCPointMake(pos.x * m_tMapTileSize.width,
(m_tLayerSize.height - pos.y - 1) * m_tMapTileSize.height); (m_tLayerSize.height - pos.y - 1) * m_tMapTileSize.height);
return xy; return xy;
} }
CCPoint CCTMXLayer::positionForIsoAt(CCPoint pos) CCPoint CCTMXLayer::positionForIsoAt(const CCPoint& pos)
{ {
CCPoint xy = CCPointMake(m_tMapTileSize.width /2 * ( m_tLayerSize.width + pos.x - pos.y - 1), CCPoint xy = CCPointMake(m_tMapTileSize.width /2 * ( m_tLayerSize.width + pos.x - pos.y - 1),
m_tMapTileSize.height /2 * (( m_tLayerSize.height * 2 - pos.x - pos.y) - 2)); m_tMapTileSize.height /2 * (( m_tLayerSize.height * 2 - pos.x - pos.y) - 2));
return xy; return xy;
} }
CCPoint CCTMXLayer::positionForHexAt(CCPoint pos) CCPoint CCTMXLayer::positionForHexAt(const CCPoint& pos)
{ {
float diffY = 0; float diffY = 0;
if( (int)pos.x % 2 == 1 ) if( (int)pos.x % 2 == 1 )
@ -586,7 +586,7 @@ namespace cocos2d {
(m_tLayerSize.height - pos.y - 1) * m_tMapTileSize.height + diffY); (m_tLayerSize.height - pos.y - 1) * m_tMapTileSize.height + diffY);
return xy; return xy;
} }
int CCTMXLayer::vertexZForPos(CCPoint pos) int CCTMXLayer::vertexZForPos(const CCPoint& pos)
{ {
int ret = 0; int ret = 0;
unsigned int maxVal = 0; unsigned int maxVal = 0;

View File

@ -92,7 +92,7 @@ namespace cocos2d{
m_pTMXLayers->setObject(child, layerName); m_pTMXLayers->setObject(child, layerName);
// update content size with the max size // update content size with the max size
CCSize childSize = child->getContentSize(); const CCSize& childSize = child->getContentSize();
CCSize currentSize = this->getContentSize(); CCSize currentSize = this->getContentSize();
currentSize.width = MAX( currentSize.width, childSize.width ); currentSize.width = MAX( currentSize.width, childSize.width );
currentSize.height = MAX( currentSize.height, childSize.height ); currentSize.height = MAX( currentSize.height, childSize.height );

View File

@ -130,7 +130,7 @@ namespace cocos2d {
} }
// CCTileMapAtlas - Atlas generation / updates // CCTileMapAtlas - Atlas generation / updates
void CCTileMapAtlas::setTile(ccColor3B tile, ccGridSize position) void CCTileMapAtlas::setTile(const ccColor3B& tile, const ccGridSize& position)
{ {
CCAssert( m_pTGAInfo != NULL, "tgaInfo must not be nil"); CCAssert( m_pTGAInfo != NULL, "tgaInfo must not be nil");
CCAssert( m_pPosToAtlasIndex != NULL, "posToAtlasIndex must not be nil"); CCAssert( m_pPosToAtlasIndex != NULL, "posToAtlasIndex must not be nil");
@ -164,7 +164,7 @@ namespace cocos2d {
this->updateAtlasValueAt(position, tile, num); this->updateAtlasValueAt(position, tile, num);
} }
} }
ccColor3B CCTileMapAtlas::tileAt(ccGridSize position) ccColor3B CCTileMapAtlas::tileAt(const ccGridSize& position)
{ {
CCAssert( m_pTGAInfo != NULL, "tgaInfo must not be nil"); CCAssert( m_pTGAInfo != NULL, "tgaInfo must not be nil");
CCAssert( position.x < m_pTGAInfo->width, "Invalid position.x"); CCAssert( position.x < m_pTGAInfo->width, "Invalid position.x");
@ -175,7 +175,7 @@ namespace cocos2d {
return value; return value;
} }
void CCTileMapAtlas::updateAtlasValueAt(ccGridSize pos, ccColor3B value, unsigned int index) void CCTileMapAtlas::updateAtlasValueAt(const ccGridSize& pos, const ccColor3B& value, unsigned int index)
{ {
ccV3F_C4B_T2F_Quad quad; ccV3F_C4B_T2F_Quad quad;

View File

@ -264,7 +264,7 @@ CCTouchHandler* CCTouchDispatcher::findHandler(CCTouchDelegate *pDelegate)
void CCTouchDispatcher::rearrangeHandlers(CCMutableArray<CCTouchHandler*> *pArray) void CCTouchDispatcher::rearrangeHandlers(CCMutableArray<CCTouchHandler*> *pArray)
{ {
std::sort(pArray->begin(), pArray->end(), less); std::sort(pArray->begin(), pArray->getLastValidIterator(), less);
} }
void CCTouchDispatcher::setPriority(int nPriority, CCTouchDelegate *pDelegate) void CCTouchDispatcher::setPriority(int nPriority, CCTouchDelegate *pDelegate)

View File

@ -31,7 +31,7 @@ PROJECT_NAME = cocos2d-x
# This could be handy for archiving the generated documentation or # This could be handy for archiving the generated documentation or
# if some version control system is used. # if some version control system is used.
PROJECT_NUMBER = 1.0.0-x-0.9.0 PROJECT_NUMBER = 1.0.1-x-0.9.1
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer # for a project that appears at the top of each page and should give viewer

Some files were not shown because too many files have changed in this diff Show More