Skip to content

Commit 4a355f6

Browse files
author
minggo
committed
issue cocos2d#1292:make some function names more readable
1 parent 795c810 commit 4a355f6

File tree

88 files changed

+780
-740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+780
-740
lines changed

cocos2dx/CCCamera.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class CC_DLL CCCamera : public CCObject
8484
/** sets the dirty value */
8585
inline void setDirty(bool bValue) { m_bDirty = bValue; }
8686
/** get the dirty value */
87-
inline bool getDirty(void) { return m_bDirty; }
87+
inline bool isDirty(void) { return m_bDirty; }
8888

8989
/** sets the camera in the default position */
9090
void restore(void);

cocos2dx/CCConfiguration.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -70,37 +70,37 @@ class CC_DLL CCConfiguration : public CCObject
7070
7171
@since v0.99.2
7272
*/
73-
inline bool isSupportsNPOT(void)
73+
inline bool supportsNPOT(void)
7474
{
7575
return m_bSupportsNPOT;
7676
}
7777

7878
/** Whether or not PVR Texture Compressed is supported */
79-
inline bool isSupportsPVRTC(void)
79+
inline bool supportsPVRTC(void)
8080
{
8181
return m_bSupportsPVRTC;
8282
}
8383

8484
/** Whether or not BGRA8888 textures are supported.
8585
@since v0.99.2
8686
*/
87-
inline bool isSupportsBGRA8888(void)
87+
inline bool supportsBGRA8888(void)
8888
{
8989
return m_bSupportsBGRA8888;
9090
}
9191

9292
/** Whether or not glDiscardFramebufferEXT is supported
9393
@since v0.99.2
9494
*/
95-
inline bool isSupportsDiscardFramebuffer(void)
95+
inline bool supportsDiscardFramebuffer(void)
9696
{
9797
return m_bSupportsDiscardFramebuffer;
9898
}
9999

100100
/** Whether or not shareable VAOs are supported.
101101
@since v2.0.0
102102
*/
103-
inline bool isSupportsShareableVAO(void)
103+
inline bool supportsShareableVAO(void)
104104
{
105105
return m_bSupportsShareableVAO;
106106
}

cocos2dx/CCDirector.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ void CCDirector::popToRootScene(void)
546546
while (c > 1)
547547
{
548548
CCScene *current = (CCScene*)m_pobScenesStack->lastObject();
549-
if( current->getIsRunning() )
549+
if( current->isRunning() )
550550
{
551551
current->onExit();
552552
}

cocos2dx/actions/CCAction.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ void CCFollow::step(float dt)
331331

332332
bool CCFollow::isDone()
333333
{
334-
return ( !m_pobFollowedNode->getIsRunning() );
334+
return ( !m_pobFollowedNode->isRunning() );
335335
}
336336

337337
void CCFollow::stop()

cocos2dx/actions/CCActionInstant.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ CCShow* CCShow::create()
9191

9292
void CCShow::update(float time) {
9393
CC_UNUSED_PARAM(time);
94-
m_pTarget->setIsVisible(true);
94+
m_pTarget->setVisible(true);
9595
}
9696

9797
CCFiniteTimeAction* CCShow::reverse() {
@@ -135,7 +135,7 @@ CCHide * CCHide::create()
135135

136136
void CCHide::update(float time) {
137137
CC_UNUSED_PARAM(time);
138-
m_pTarget->setIsVisible(false);
138+
m_pTarget->setVisible(false);
139139
}
140140

141141
CCFiniteTimeAction *CCHide::reverse() {
@@ -181,7 +181,7 @@ CCToggleVisibility * CCToggleVisibility::create()
181181
void CCToggleVisibility::update(float time)
182182
{
183183
CC_UNUSED_PARAM(time);
184-
m_pTarget->setIsVisible(!m_pTarget->getIsVisible());
184+
m_pTarget->setVisible(!m_pTarget->isVisible());
185185
}
186186

187187
CCObject* CCToggleVisibility::copyWithZone(CCZone *pZone)

cocos2dx/actions/CCActionInstant.h

+4-16
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,11 @@ class CC_DLL CCCallFunc : public CCActionInstant //<NSCopying>
210210
CCCallFunc()
211211
: m_pSelectorTarget(NULL)
212212
, m_pCallFunc(NULL)
213-
214213
{
215214
}
216215
virtual ~CCCallFunc()
217216
{
218-
if (m_pSelectorTarget)
219-
{
220-
m_pSelectorTarget->release();
221-
}
217+
CC_SAFE_RELEASE(m_pSelectorTarget);
222218
}
223219
/** creates the action with the callback
224220
@warning: This interface will be deprecated in future.
@@ -252,17 +248,9 @@ class CC_DLL CCCallFunc : public CCActionInstant //<NSCopying>
252248
{
253249
if (pSel != m_pSelectorTarget)
254250
{
255-
if (m_pSelectorTarget)
256-
{
257-
m_pSelectorTarget->release();
258-
}
259-
260-
m_pSelectorTarget = pSel;
261-
262-
if (m_pSelectorTarget)
263-
{
264-
m_pSelectorTarget->retain();
265-
}
251+
CC_SAFE_RETAIN(pSel);
252+
CC_SAFE_RELEASE(m_pSelectorTarget);
253+
m_pSelectorTarget = pSel;
266254
}
267255
}
268256

cocos2dx/actions/CCActionInterval.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,7 @@ void CCBlink::update(float time)
17221722
{
17231723
float slice = 1.0f / m_nTimes;
17241724
float m = fmodf(time, slice);
1725-
m_pTarget->setIsVisible(m > slice / 2 ? true : false);
1725+
m_pTarget->setVisible(m > slice / 2 ? true : false);
17261726
}
17271727
}
17281728

cocos2dx/base_nodes/CCAtlasNode.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -184,21 +184,21 @@ void CCAtlasNode::setOpacity(GLubyte opacity)
184184
this->setColor(m_tColorUnmodified);
185185
}
186186

187-
void CCAtlasNode::setIsOpacityModifyRGB(bool bValue)
187+
void CCAtlasNode::setOpacityModifyRGB(bool bValue)
188188
{
189189
ccColor3B oldColor = this->m_tColor;
190190
m_bIsOpacityModifyRGB = bValue;
191191
this->m_tColor = oldColor;
192192
}
193193

194-
bool CCAtlasNode::getIsOpacityModifyRGB()
194+
bool CCAtlasNode::isOpacityModifyRGB()
195195
{
196196
return m_bIsOpacityModifyRGB;
197197
}
198198

199199
void CCAtlasNode::updateOpacityModifyRGB()
200200
{
201-
m_bIsOpacityModifyRGB = m_pTextureAtlas->getTexture()->getHasPremultipliedAlpha();
201+
m_bIsOpacityModifyRGB = m_pTextureAtlas->getTexture()->hasPremultipliedAlpha();
202202
}
203203

204204
// CCAtlasNode - CocosNodeTexture protocol
@@ -215,7 +215,7 @@ void CCAtlasNode::setBlendFunc(ccBlendFunc blendFunc)
215215

216216
void CCAtlasNode::updateBlendFunc()
217217
{
218-
if( ! m_pTextureAtlas->getTexture()->getHasPremultipliedAlpha() ) {
218+
if( ! m_pTextureAtlas->getTexture()->hasPremultipliedAlpha() ) {
219219
m_tBlendFunc.src = GL_SRC_ALPHA;
220220
m_tBlendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
221221
}

cocos2dx/base_nodes/CCAtlasNode.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ class CC_DLL CCAtlasNode : public CCNode, public CCRGBAProtocol, public CCTextur
6363
CC_PROPERTY(CCTextureAtlas*, m_pTextureAtlas, TextureAtlas);
6464

6565
// protocol variables
66-
CC_PROPERTY(bool, m_bIsOpacityModifyRGB, IsOpacityModifyRGB)
66+
bool m_bIsOpacityModifyRGB;
67+
bool isOpacityModifyRGB();
68+
void setOpacityModifyRGB(bool isOpacityModifyRGB);
69+
6770
CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc);
6871
CC_PROPERTY(GLubyte, m_cOpacity, Opacity);
6972
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color);

cocos2dx/base_nodes/CCNode.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -324,13 +324,13 @@ void CCNode::setGrid(CCGridBase* pGrid)
324324

325325

326326
/// isVisible getter
327-
bool CCNode::getIsVisible()
327+
bool CCNode::isVisible()
328328
{
329329
return m_bIsVisible;
330330
}
331331

332332
/// isVisible setter
333-
void CCNode::setIsVisible(bool var)
333+
void CCNode::setVisible(bool var)
334334
{
335335
m_bIsVisible = var;
336336
}
@@ -374,12 +374,11 @@ void CCNode::setContentSize(const CCSize& size)
374374
}
375375

376376
// isRunning getter
377-
bool CCNode::getIsRunning()
377+
bool CCNode::isRunning()
378378
{
379379
return m_bIsRunning;
380380
}
381381

382-
383382
/// parent getter
384383
CCNode * CCNode::getParent()
385384
{
@@ -392,12 +391,12 @@ void CCNode::setParent(CCNode * var)
392391
}
393392

394393
/// isRelativeAnchorPoint getter
395-
bool CCNode::getIgnoreAnchorPointForPosition()
394+
bool CCNode::isIgnoreAnchorPointForPosition()
396395
{
397396
return m_bIgnoreAnchorPointForPosition;
398397
}
399398
/// isRelativeAnchorPoint setter
400-
void CCNode::setIgnoreAnchorPointForPosition(bool newValue)
399+
void CCNode::ignoreAnchorPointForPosition(bool newValue)
401400
{
402401
if (newValue != m_bIgnoreAnchorPointForPosition)
403402
{

cocos2dx/base_nodes/CCNode.h

+8-3
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ class CC_DLL CCNode : public CCObject
196196
CC_PROPERTY(CCGridBase *, m_pGrid, Grid)
197197

198198
/** Whether of not the node is visible. Default is true */
199-
CC_PROPERTY(bool, m_bIsVisible, IsVisible)
199+
bool m_bIsVisible;
200+
bool isVisible();
201+
void setVisible(bool visible);
200202

201203
/** anchorPoint is the point around which all transformations and positioning manipulations take place.
202204
It's like a pin in the node where it is "attached" to its parent.
@@ -220,14 +222,17 @@ class CC_DLL CCNode : public CCObject
220222
CC_PROPERTY_PASS_BY_REF(CCSize, m_tContentSize, ContentSize)
221223

222224
/** whether or not the node is running */
223-
CC_PROPERTY_READONLY(bool, m_bIsRunning, IsRunning)
225+
bool m_bIsRunning;
226+
bool isRunning();
224227

225228
/** A weak reference to the parent */
226229
CC_PROPERTY(CCNode *, m_pParent, Parent)
227230

228231
// If ture, the Anchor Point will be (0,0) when you position the CCNode.
229232
// Used by CCLayer and CCScene
230-
CC_PROPERTY(bool, m_bIgnoreAnchorPointForPosition, IgnoreAnchorPointForPosition);
233+
bool m_bIgnoreAnchorPointForPosition;
234+
bool isIgnoreAnchorPointForPosition();
235+
void ignoreAnchorPointForPosition(bool isIgnoreAnchorPointForPosition);
231236

232237
/** A tag used to identify the node easily */
233238
CC_PROPERTY(int, m_nTag, Tag)

cocos2dx/effects/CCGrid.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ void CCGridBase::setActive(bool bActive)
178178
}
179179
}
180180

181-
void CCGridBase::setIsTextureFlipped(bool bFlipped)
181+
void CCGridBase::setTextureFlipped(bool bFlipped)
182182
{
183183
if (m_bIsTextureFlipped != bFlipped)
184184
{
@@ -228,7 +228,7 @@ void CCGridBase::afterDraw(cocos2d::CCNode *pTarget)
228228
CCDirector *director = CCDirector::sharedDirector();
229229
director->setProjection(m_directorProjection);
230230

231-
if (pTarget->getCamera()->getDirty())
231+
if (pTarget->getCamera()->isDirty())
232232
{
233233
const CCPoint& offset = pTarget->getAnchorPointInPoints();
234234

cocos2dx/effects/CCGrid.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class CCGridBase : public CCObject
6464

6565
/** is texture flipped */
6666
inline bool isTextureFlipped(void) { return m_bIsTextureFlipped; }
67-
void setIsTextureFlipped(bool bFlipped);
67+
void setTextureFlipped(bool bFlipped);
6868

6969
bool initWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
7070
bool initWithSize(const ccGridSize& gridSize);

cocos2dx/extensions/CCBReader/CCLayerLoader.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ CCLayer * CCLayerLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader)
1414

1515
void CCLayerLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
1616
if(strcmp(pPropertyName, PROPERTY_TOUCH_ENABLED) == 0) {
17-
((CCLayer *)pNode)->setIsTouchEnabled(pCheck);
17+
((CCLayer *)pNode)->setTouchEnabled(pCheck);
1818
} else if(strcmp(pPropertyName, PROPERTY_ACCELEROMETER_ENABLED) == 0) {
19-
((CCLayer *)pNode)->setIsAccelerometerEnabled(pCheck);
19+
((CCLayer *)pNode)->setAccelerometerEnabled(pCheck);
2020
} else if(strcmp(pPropertyName, PROPERTY_MOUSE_ENABLED) == 0) {
2121
// TODO XXX
2222
CCLOG("The property '%s' is not supported!", PROPERTY_MOUSE_ENABLED);

cocos2dx/extensions/CCBReader/CCNodeLoader.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -736,9 +736,9 @@ void CCNodeLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, co
736736

737737
void CCNodeLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
738738
if(strcmp(pPropertyName, PROPERTY_VISIBLE) == 0) {
739-
pNode->setIsVisible(pCheck);
739+
pNode->setVisible(pCheck);
740740
} else if(strcmp(pPropertyName, PROPERTY_IGNOREANCHORPOINTFORPOSITION) == 0) {
741-
pNode->setIgnoreAnchorPointForPosition(pCheck);
741+
pNode->ignoreAnchorPointForPosition(pCheck);
742742
} else {
743743
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
744744
}

cocos2dx/extensions/CCControlExtension/CCControl.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ GLubyte CCControl::getOpacity()
249249
}
250250

251251

252-
void CCControl::setIsOpacityModifyRGB(bool opacityModifyRGB)
252+
void CCControl::setOpacityModifyRGB(bool opacityModifyRGB)
253253
{
254254
m_bIsOpacityModifyRGB=opacityModifyRGB;
255255
CCObject* child;
@@ -259,12 +259,12 @@ void CCControl::setIsOpacityModifyRGB(bool opacityModifyRGB)
259259
CCRGBAProtocol* pNode = dynamic_cast<CCRGBAProtocol*>(child);
260260
if (pNode)
261261
{
262-
pNode->setIsOpacityModifyRGB(opacityModifyRGB);
262+
pNode->setOpacityModifyRGB(opacityModifyRGB);
263263
}
264264
}
265265
}
266266

267-
bool CCControl::getIsOpacityModifyRGB()
267+
bool CCControl::isOpacityModifyRGB()
268268
{
269269
return m_bIsOpacityModifyRGB;
270270
}

cocos2dx/extensions/CCControlExtension/CCControl.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ class CC_DLL CCControl : public CCLayer, public CCRGBAProtocol
8484
//CCRGBAProtocol
8585
CC_PROPERTY(GLubyte, m_cOpacity, Opacity);
8686
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color);
87-
CC_PROPERTY(bool, m_bIsOpacityModifyRGB, IsOpacityModifyRGB);
87+
bool m_bIsOpacityModifyRGB;
88+
bool isOpacityModifyRGB();
89+
void setOpacityModifyRGB(bool isOpacityModifyRGB);
8890

8991
/** Changes the priority of the button. The lower the number, the higher the priority. */
9092
CC_SYNTHESIZE(int, m_nDefaultTouchPriority, DefaultTouchPriority);

0 commit comments

Comments
 (0)