From 978fc634be0f4c01aa765ed0ab6072462379471c Mon Sep 17 00:00:00 2001 From: Timothy Qiu Date: Thu, 1 Aug 2013 16:39:42 +0800 Subject: [PATCH] Use C++ code in C++ comments. Removed Hungarian notation from parts of the code. --- cocos2dx/CCDirector.h | 2 +- cocos2dx/CCScheduler.h | 4 ++-- cocos2dx/actions/CCActionTween.h | 8 ++++---- cocos2dx/cocoa/CCGeometry.h | 2 +- cocos2dx/include/CCDeprecated.h | 2 +- cocos2dx/layers_scenes_transitions_nodes/CCLayer.h | 6 +++--- cocos2dx/misc_nodes/CCClippingNode.h | 4 ++-- cocos2dx/misc_nodes/CCRenderTexture.h | 10 +++++----- cocos2dx/particle_nodes/CCParticleSystemQuad.h | 2 +- cocos2dx/sprite_nodes/CCAnimation.h | 2 +- cocos2dx/sprite_nodes/CCSprite.h | 2 +- cocos2dx/sprite_nodes/CCSpriteFrameCache.h | 12 ++++++------ cocos2dx/support/CCProfiling.cpp | 2 +- cocos2dx/textures/CCTextureAtlas.h | 4 ++-- cocos2dx/touch_dispatcher/CCTouchDelegateProtocol.h | 4 ++-- 15 files changed, 33 insertions(+), 33 deletions(-) diff --git a/cocos2dx/CCDirector.h b/cocos2dx/CCDirector.h index 2ad40f4d7e..d903d46afb 100644 --- a/cocos2dx/CCDirector.h +++ b/cocos2dx/CCDirector.h @@ -465,7 +465,7 @@ protected: nextScene is a weak reference. */ Scene *_nextScene; - /* If YES, then "old" scene will receive the cleanup message */ + /* If true, then "old" scene will receive the cleanup message */ bool _sendCleanupToScene; /* scheduled scenes */ diff --git a/cocos2dx/CCScheduler.h b/cocos2dx/CCScheduler.h index 3df5cd96ec..61c94b96e0 100644 --- a/cocos2dx/CCScheduler.h +++ b/cocos2dx/CCScheduler.h @@ -140,7 +140,7 @@ public: void update(float dt); /** The scheduled method will be called every 'interval' seconds. - If paused is YES, then it won't be called until it is resumed. + If paused is true, then it won't be called until it is resumed. If 'interval' is 0, it will be called every frame, but if so, it's recommended to use 'scheduleUpdateForTarget:' instead. If the selector is already scheduled, then only the interval parameter will be updated without re-scheduling it again. repeat let the action be repeated repeat + 1 times, use kRepeatForever to let the action run continuously @@ -195,7 +195,7 @@ public: void unscheduleAllWithMinPriority(int nMinPriority); /** The scheduled script callback will be called every 'interval' seconds. - If paused is YES, then it won't be called until it is resumed. + If paused is true, then it won't be called until it is resumed. If 'interval' is 0, it will be called every frame. return schedule script entry ID, used for unscheduleScriptFunc(). */ diff --git a/cocos2dx/actions/CCActionTween.h b/cocos2dx/actions/CCActionTween.h index 1122da514a..38f001b410 100644 --- a/cocos2dx/actions/CCActionTween.h +++ b/cocos2dx/actions/CCActionTween.h @@ -46,15 +46,15 @@ public: ActionTween is an action that lets you update any property of an object. For example, if you want to modify the "width" property of a target from 200 to 300 in 2 seconds, then: - id modifyWidth = [ActionTween actionWithDuration:2 key:@"width" from:200 to:300]; - [target runAction:modifyWidth]; + auto modifyWidth = ActionTween::create(2, "width", 200, 300); + target->runAction(modifyWidth); Another example: ScaleTo action could be rewritten using PropertyAction: // scaleA and scaleB are equivalents - id scaleA = [ScaleTo actionWithDuration:2 scale:3]; - id scaleB = [ActionTween actionWithDuration:2 key:@"scale" from:1 to:3]; + auto scaleA = ScaleTo::create(2, 3); // (duration, to) + auto scaleB = ActionTween::create(2, "scale", 1, 3); // (duration, key, from, to) @since v0.99.2 diff --git a/cocos2dx/cocoa/CCGeometry.h b/cocos2dx/cocoa/CCGeometry.h index ec9c285418..a8c52878b0 100644 --- a/cocos2dx/cocoa/CCGeometry.h +++ b/cocos2dx/cocoa/CCGeometry.h @@ -271,7 +271,7 @@ public: float *S, float *T); /* - returns YES if Segment A-B intersects with segment C-D + returns true if Segment A-B intersects with segment C-D @since v3.0 */ static bool isSegmentIntersect(const Point& A, const Point& B, const Point& C, const Point& D); diff --git a/cocos2dx/include/CCDeprecated.h b/cocos2dx/include/CCDeprecated.h index 71460128de..c4aea72386 100644 --- a/cocos2dx/include/CCDeprecated.h +++ b/cocos2dx/include/CCDeprecated.h @@ -357,7 +357,7 @@ CC_DEPRECATED_ATTRIBUTE static inline bool ccpLineIntersect(const Point& p1, con } /* - ccpSegmentIntersect returns YES if Segment A-B intersects with segment C-D + ccpSegmentIntersect returns true if Segment A-B intersects with segment C-D @since v1.0.0 */ CC_DEPRECATED_ATTRIBUTE static inline bool ccpSegmentIntersect(const Point& A, const Point& B, const Point& C, const Point& D) diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h index 9a9e63bc76..24df564cba 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h @@ -302,7 +302,7 @@ public: bool initWithColor(const Color4B& start, const Color4B& end, const Point& v); /** 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: true */ void setCompressedInterpolation(bool bCompressedInterpolation); bool isCompressedInterpolation() const; @@ -385,11 +385,11 @@ public: void addLayer(Layer* layer); /** switches to a certain layer indexed by n. - The current (old) layer will be removed from it's parent with 'cleanup:YES'. + The current (old) layer will be removed from it's parent with 'cleanup=true'. */ void switchTo(unsigned int n); /** release the current layer and switches to another layer indexed by n. - The current (old) layer will be removed from it's parent with 'cleanup:YES'. + The current (old) layer will be removed from it's parent with 'cleanup=true'. */ void switchToAndReleaseMe(unsigned int n); diff --git a/cocos2dx/misc_nodes/CCClippingNode.h b/cocos2dx/misc_nodes/CCClippingNode.h index 45e612c24c..e4c14308cc 100644 --- a/cocos2dx/misc_nodes/CCClippingNode.h +++ b/cocos2dx/misc_nodes/CCClippingNode.h @@ -76,9 +76,9 @@ public: GLfloat getAlphaThreshold() const; void setAlphaThreshold(GLfloat fAlphaThreshold); - /** Inverted. If this is set to YES, + /** Inverted. If this is set to true, the stencil is inverted, so the content is drawn where the stencil is NOT drawn. - This default to NO. + This default to false. */ bool isInverted() const; void setInverted(bool bInverted); diff --git a/cocos2dx/misc_nodes/CCRenderTexture.h b/cocos2dx/misc_nodes/CCRenderTexture.h index c65143baf8..87854810cb 100644 --- a/cocos2dx/misc_nodes/CCRenderTexture.h +++ b/cocos2dx/misc_nodes/CCRenderTexture.h @@ -106,12 +106,12 @@ public: CC_DEPRECATED_ATTRIBUTE Image* newCCImage(bool flipImage = true) { return newImage(flipImage); }; /** saves the texture into a file using JPEG format. The file will be saved in the Documents folder. - Returns YES if the operation is successful. + Returns true if the operation is successful. */ bool saveToFile(const char *szFilePath); /** saves the texture into a file. The format could be JPG or PNG. The file will be saved in the Documents folder. - Returns YES if the operation is successful. + Returns true if the operation is successful. */ bool saveToFile(const char *name, Image::Format format); @@ -125,7 +125,7 @@ public: */ void listenToForeground(Object *obj); - /** Valid flags: GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT. They can be OR'ed. Valid when "autoDraw is YES. */ + /** Valid flags: GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT. They can be OR'ed. Valid when "autoDraw" is true. */ inline unsigned int getClearFlags() const { return _clearFlags; }; inline void setClearFlags(unsigned int clearFlags) { _clearFlags = clearFlags; }; @@ -133,11 +133,11 @@ public: inline const Color4F& getClearColor() const { return _clearColor; }; inline void setClearColor(const Color4F &clearColor) { _clearColor = clearColor; }; - /** Value for clearDepth. Valid only when autoDraw is true. */ + /** Value for clearDepth. Valid only when "autoDraw" is true. */ inline float getClearDepth() const { return _clearDepth; }; inline void setClearDepth(float clearDepth) { _clearDepth = clearDepth; }; - /** Value for clear Stencil. Valid only when autoDraw is true */ + /** Value for clear Stencil. Valid only when "autoDraw" is true */ inline int getClearStencil() const { return _clearStencil; }; inline void setClearStencil(int clearStencil) { _clearStencil = clearStencil; }; diff --git a/cocos2dx/particle_nodes/CCParticleSystemQuad.h b/cocos2dx/particle_nodes/CCParticleSystemQuad.h index 528e1d429d..47d7d41f30 100644 --- a/cocos2dx/particle_nodes/CCParticleSystemQuad.h +++ b/cocos2dx/particle_nodes/CCParticleSystemQuad.h @@ -73,7 +73,7 @@ public: void initTexCoordsWithRect(const Rect& rect); /** Sets a new SpriteFrame as particle. - WARNING: this method is experimental. Use setTexture:withRect instead. + WARNING: this method is experimental. Use setTextureWithRect instead. @since v0.99.4 */ void setDisplayFrame(SpriteFrame *spriteFrame); diff --git a/cocos2dx/sprite_nodes/CCAnimation.h b/cocos2dx/sprite_nodes/CCAnimation.h index 054480734e..3276eda28e 100644 --- a/cocos2dx/sprite_nodes/CCAnimation.h +++ b/cocos2dx/sprite_nodes/CCAnimation.h @@ -111,7 +111,7 @@ protected: The Animation object contains AnimationFrame objects, and a possible delay between the frames. You can animate a Animation object by using the Animate action. Example: -[sprite runAction:[Animate actionWithAnimation:animation]]; + sprite->runAction(Animate::create(animation)); */ class CC_DLL Animation : public Object, public Clonable diff --git a/cocos2dx/sprite_nodes/CCSprite.h b/cocos2dx/sprite_nodes/CCSprite.h index 3a8f72700e..dd8480ea4b 100644 --- a/cocos2dx/sprite_nodes/CCSprite.h +++ b/cocos2dx/sprite_nodes/CCSprite.h @@ -294,7 +294,7 @@ public: /** * Updates the texture rect of the Sprite in points. - * It will call setTextureRect:rotated:untrimmedSize with rotated = NO, and utrimmedSize = rect.size. + * It will call setTextureRect(const Rect& rect, bool rotated, const Size& untrimmedSize) with \p rotated = false, and \p utrimmedSize = rect.size. */ virtual void setTextureRect(const Rect& rect); diff --git a/cocos2dx/sprite_nodes/CCSpriteFrameCache.h b/cocos2dx/sprite_nodes/CCSpriteFrameCache.h index f6c84ee17c..3dd9f56158 100644 --- a/cocos2dx/sprite_nodes/CCSpriteFrameCache.h +++ b/cocos2dx/sprite_nodes/CCSpriteFrameCache.h @@ -81,9 +81,9 @@ public: public: /** Adds multiple Sprite Frames from a plist file. * A texture will be loaded automatically. The texture name will composed by replacing the .plist suffix with .png - * If you want to use another texture, you should use the addSpriteFramesWithFile:texture method. + * If you want to use another texture, you should use the addSpriteFramesWithFile(const char *plist, const char *textureFileName) method. */ - void addSpriteFramesWithFile(const char *pszPlist); + void addSpriteFramesWithFile(const char *plist); /** Adds multiple Sprite Frames from a plist file. The texture will be associated with the created sprite frames. @since v0.99.5 @@ -91,12 +91,12 @@ public: void addSpriteFramesWithFile(const char* plist, const char* textureFileName); /** Adds multiple Sprite Frames from a plist file. The texture will be associated with the created sprite frames. */ - void addSpriteFramesWithFile(const char *pszPlist, Texture2D *pobTexture); + void addSpriteFramesWithFile(const char *plist, Texture2D *texture); /** Adds an sprite frame with a given name. If the name already exists, then the contents of the old name will be replaced with the new one. */ - void addSpriteFrame(SpriteFrame *pobFrame, const char *pszFrameName); + void addSpriteFrame(SpriteFrame *frame, const char *frameName); /** Purges the dictionary of loaded sprite frames. * Call this method if you receive the "Memory Warning". @@ -113,7 +113,7 @@ public: void removeUnusedSpriteFrames(void); /** Deletes an sprite frame from the sprite frame cache. */ - void removeSpriteFrameByName(const char *pszName); + void removeSpriteFrameByName(const char *name); /** Removes multiple Sprite Frames from a plist file. * Sprite Frames stored in this file will be removed. @@ -140,7 +140,7 @@ public: private: /*Adds multiple Sprite Frames with a dictionary. The texture will be associated with the created sprite frames. */ - void addSpriteFramesWithDictionary(Dictionary* pobDictionary, Texture2D *pobTexture); + void addSpriteFramesWithDictionary(Dictionary* dictionary, Texture2D *texture); /** Removes multiple Sprite Frames from Dictionary. * @since v0.99.5 diff --git a/cocos2dx/support/CCProfiling.cpp b/cocos2dx/support/CCProfiling.cpp index 3b50ff30a0..e238c45651 100644 --- a/cocos2dx/support/CCProfiling.cpp +++ b/cocos2dx/support/CCProfiling.cpp @@ -29,7 +29,7 @@ using namespace std; NS_CC_BEGIN //#pragma mark - Profiling Categories -/* set to NO the categories that you don't want to profile */ +/* set to false the categories that you don't want to profile */ bool kProfilerCategorySprite = false; bool kProfilerCategoryBatchSprite = false; bool kProfilerCategoryParticles = false; diff --git a/cocos2dx/textures/CCTextureAtlas.h b/cocos2dx/textures/CCTextureAtlas.h index ae5e13ab16..dd49f20dfa 100644 --- a/cocos2dx/textures/CCTextureAtlas.h +++ b/cocos2dx/textures/CCTextureAtlas.h @@ -129,8 +129,8 @@ public: /** resize the capacity of the TextureAtlas. * The new capacity can be lower or higher than the current one - * It returns YES if the resize was successful. - * If it fails to resize the capacity it will return NO with a new capacity of 0. + * It returns true if the resize was successful. + * If it fails to resize the capacity it will return false with a new capacity of 0. */ bool resizeCapacity(int capacity); diff --git a/cocos2dx/touch_dispatcher/CCTouchDelegateProtocol.h b/cocos2dx/touch_dispatcher/CCTouchDelegateProtocol.h index 06104df0f8..7de1235939 100644 --- a/cocos2dx/touch_dispatcher/CCTouchDelegateProtocol.h +++ b/cocos2dx/touch_dispatcher/CCTouchDelegateProtocol.h @@ -70,7 +70,7 @@ public: Using this type of delegate results in two benefits: - 1. You don't need to deal with Sets, the dispatcher does the job of splitting them. You get exactly one UITouch per call. - - 2. You can *claim* a UITouch by returning YES in ccTouchBegan. Updates of claimed + - 2. You can *claim* a UITouch by returning true in ccTouchBegan. Updates of claimed touches are sent only to the delegate(s) that claimed them. So if you get a move/ ended/canceled update you're sure it's your touch. This frees you from doing a lot of checks when doing multi-touch. @@ -82,7 +82,7 @@ public: class CC_DLL TargetedTouchDelegate : public TouchDelegate { public: - /** Return YES to claim the touch. + /** Return true to claim the touch. @since v0 */ virtual bool ccTouchBegan(Touch *pTouch, Event *pEvent) { CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);return false;};