From 940b0ffd56b6d85d35b4ea20c45b85bc4f81b5ec Mon Sep 17 00:00:00 2001 From: Marc Lepage Date: Fri, 29 Nov 2013 12:09:38 -0500 Subject: [PATCH] Fix typos --- cocos/2d/CCNode.h | 400 +++++++++--------- cocos/2d/CCParticleBatchNode.cpp | 28 +- .../CocoStudioArmatureTest/ArmatureScene.cpp | 20 +- .../CocoStudioArmatureTest/ArmatureScene.h | 6 +- .../Classes/ParticleTest/ParticleTest.cpp | 272 ++++++------ .../CocoStudioArmatureTest.lua | 124 +++--- .../luaScript/ParticleTest/ParticleTest.lua | 6 +- 7 files changed, 428 insertions(+), 428 deletions(-) diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index 9212676669..4e036b01b2 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -158,14 +158,14 @@ public: * @lua NA */ const char* description(void) const; - + /// @} end of initializers - - - + + + /// @{ /// @name Setters & Getters for Graphic Peroperties - + /** * Sets the Z order which stands for the drawing order, and reorder this node in its parent's children array. * @@ -194,7 +194,7 @@ public: * @return The Z order. */ virtual int getZOrder() const; - + /** * Sets the real OpenGL Z vertex. * @@ -235,7 +235,7 @@ public: */ virtual float getScaleX() const; - + /** * Changes the scale factor on Y axis of this node * @@ -249,11 +249,11 @@ public: * * @see `setScaleY(float)` * - * @return The scale factor on Y axis. + * @return The scale factor on Y axis. */ virtual float getScaleY() const; - + /** * Changes both X and Y scale factor of the node. * @@ -271,7 +271,7 @@ public: * @return The scale factor of the node. */ virtual float getScale() const; - + /** * Changes both X and Y scale factor of the node. * @@ -281,7 +281,7 @@ public: * @param scaleY The scale factor on Y axis. */ virtual void setScale(float scaleX,float scaleY); - + /** * Changes the position (x,y) of the node in OpenGL coordinates * @@ -298,7 +298,7 @@ public: virtual void setPosition(const Point &position); /** * Gets the position (x,y) of the node in OpenGL coordinates - * + * * @see setPosition(const Point&) * * @return The position (x,y) of the node in OpenGL coordinates @@ -311,7 +311,7 @@ public: * Sets position in a more efficient way. * * Passing two numbers (x,y) is much efficient than passing Point object. - * This method is binded to lua and javascript. + * This method is binded to lua and javascript. * Passing a number is 10 times faster than passing a object from lua to c++ * @code @@ -339,8 +339,8 @@ public: virtual float getPositionX(void) const; virtual void setPositionY(float y); virtual float getPositionY(void) const; - - + + /** * Changes the X skew angle of the node in degrees. * @@ -360,7 +360,7 @@ public: */ virtual float getSkewX() const; - + /** * Changes the Y skew angle of the node in degrees. * @@ -380,7 +380,7 @@ public: */ virtual float getSkewY() const; - + /** * Sets the anchor point in percent. * @@ -393,7 +393,7 @@ public: * @param anchorPoint The anchor point of node. */ virtual void setAnchorPoint(const Point& anchorPoint); - /** + /** * Returns the anchor point in percent. * * @see `setAnchorPoint(const Point&)` @@ -403,15 +403,15 @@ public: virtual const Point& getAnchorPoint() const; /** * Returns the anchorPoint in absolute pixels. - * + * * @warning You can only read it. If you wish to modify it, use anchorPoint instead. * @see `getAnchorPoint()` * * @return The anchor point in absolute pixels. */ virtual const Point& getAnchorPointInPoints() const; - - + + /** * Sets the untransformed size of the node. * @@ -430,7 +430,7 @@ public: */ virtual const Size& getContentSize() const; - + /** * Sets whether the node is visible * @@ -448,13 +448,13 @@ public: */ virtual bool isVisible() const; - - /** - * Sets the rotation (angle) of the node in degrees. - * - * 0 is the default rotation angle. + + /** + * Sets the rotation (angle) of the node in degrees. + * + * 0 is the default rotation angle. * Positive values rotate node clockwise, and negative values for anti-clockwise. - * + * * @param rotation The rotation of the node in degrees. */ virtual void setRotation(float rotation); @@ -467,13 +467,13 @@ public: */ virtual float getRotation() const; - - /** + + /** * Sets the X rotation (angle) of the node in degrees which performs a horizontal rotational skew. - * - * 0 is the default rotation angle. + * + * 0 is the default rotation angle. * Positive values rotate node clockwise, and negative values for anti-clockwise. - * + * * @param rotationX The X rotation in degrees which performs a horizontal rotational skew. */ virtual void setRotationX(float rotationX); @@ -486,11 +486,11 @@ public: */ virtual float getRotationX() const; - - /** + + /** * Sets the Y rotation (angle) of the node in degrees which performs a vertical rotational skew. - * - * 0 is the default rotation angle. + * + * 0 is the default rotation angle. * Positive values rotate node clockwise, and negative values for anti-clockwise. * * @param rotationY The Y rotation in degrees. @@ -505,7 +505,7 @@ public: */ virtual float getRotationY() const; - + /** * Sets the arrival order when this node has a same ZOrder with other children. * @@ -525,9 +525,9 @@ public: * @return The arrival order. */ virtual int getOrderOfArrival() const; - - - /** @deprecated No longer needed + + + /** @deprecated No longer needed * @js NA * @lua NA */ @@ -537,7 +537,7 @@ public: * @lua NA */ CC_DEPRECATED_ATTRIBUTE int getGLServerState() const { return 0; } - + /** * Sets whether the anchor point will be (0,0) when you position this node. * @@ -556,14 +556,14 @@ public: * @return true if the anchor point will be (0,0) when you position this node. */ virtual bool isIgnoreAnchorPointForPosition() const; - + /// @} end of Setters & Getters for Graphic Peroperties - - + + /// @{ /// @name Children and Parent - - /** + + /** * Adds a child to the container with z-order as 0. * * If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately. @@ -571,7 +571,7 @@ public: * @param child A child node */ virtual void addChild(Node * child); - /** + /** * Adds a child to the container with a z-order * * If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately. @@ -580,7 +580,7 @@ public: * @param zOrder Z order for drawing priority. Please refer to setZOrder(int) */ virtual void addChild(Node * child, int zOrder); - /** + /** * Adds a child to the container with z order and tag * * If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately. @@ -616,41 +616,41 @@ public: */ virtual Array* getChildren() { return _children; } virtual const Array *getChildren() const { return _children; } - - /** + + /** * Get the amount of children. * * @return The amount of children. */ long getChildrenCount() const; - + /** * Sets the parent node * - * @param parent A pointer to the parnet node + * @param parent A pointer to the parent node */ virtual void setParent(Node* parent); /** * Returns a pointer to the parent node - * + * * @see `setParent(Node*)` * - * @returns A pointer to the parnet node + * @returns A pointer to the parent node */ virtual Node* getParent() { return _parent; } virtual const Node* getParent() const { return _parent; } - + ////// REMOVES ////// - - /** + + /** * Removes this node itself from its parent node with a cleanup. * If the node orphan, then nothing happens. * @see `removeFromParentAndCleanup(bool)` */ virtual void removeFromParent(); - /** - * Removes this node itself from its parent node. + /** + * Removes this node itself from its parent node. * If the node orphan, then nothing happens. * @param cleanup true if all actions and callbacks on this node should be removed, false otherwise. * @js removeFromParent @@ -658,28 +658,28 @@ public: */ virtual void removeFromParentAndCleanup(bool cleanup); - /** + /** * Removes a child from the container. It will also cleanup all running actions depending on the cleanup parameter. - * + * * @param child The child node which will be removed. * @param cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise. */ virtual void removeChild(Node* child, bool cleanup = true); - /** + /** * Removes a child from the container by tag value. It will also cleanup all running actions depending on the cleanup parameter - * + * * @param tag An interger number that identifies a child node - * @param cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise. + * @param cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise. */ virtual void removeChildByTag(int tag, bool cleanup = true); - /** + /** * Removes all children from the container with a cleanup. * * @see `removeAllChildrenWithCleanup(bool)` */ virtual void removeAllChildren(); - /** + /** * Removes all children from the container, and do a cleanup to all running actions depending on the cleanup parameter. * * @param cleanup true if all running actions on all children nodes should be cleanup, false oterwise. @@ -687,32 +687,32 @@ public: * @lua removeAllChildren */ virtual void removeAllChildrenWithCleanup(bool cleanup); - - /** + + /** * Reorders a child according to a new z value. * * @param child An already added child node. It MUST be already added. * @param zOrder Z order for drawing priority. Please refer to setZOrder(int) */ virtual void reorderChild(Node * child, int zOrder); - - /** + + /** * Sorts the children array once before drawing, instead of every time when a child is added or reordered. * This appraoch can improves the performance massively. - * @note Don't call this manually unless a child added needs to be removed in the same frame + * @note Don't call this manually unless a child added needs to be removed in the same frame */ virtual void sortAllChildren(); /// @} end of Children and Parent - - + + /// @{ /// @name Grid object for effects - + /** * Returns a grid object that is used when applying effects - * + * * @return A Grid object that is used when applying effects * @js NA */ @@ -728,13 +728,13 @@ public: * @param grid A Grid object that is used when applying effects */ virtual void setGrid(GridBase *grid); - + /// @} end of Grid - - + + /// @{ /// @name Tag & User data - + /** * Returns a tag that is used to identify the node easily. * @@ -777,12 +777,12 @@ public: * @param tag A interger that indentifies the node. */ virtual void setTag(int tag); - + /** * Returns a custom user data pointer * * You can set everything in UserData pointer, a data block, a structure or an object. - * + * * @return A custom user data pointer * @js NA * @lua NA @@ -798,7 +798,7 @@ public: * Sets a custom user data pointer * * You can set everything in UserData pointer, a data block, a structure or an object, etc. - * @warning Don't forget to release the memory manually, + * @warning Don't forget to release the memory manually, * especially before you change this data pointer, and before this node is autoreleased. * * @param userData A custom user data pointer @@ -806,10 +806,10 @@ public: * @lua NA */ virtual void setUserData(void *userData); - - /** + + /** * Returns a user assigned Object - * + * * Similar to userData, but instead of holding a void* it holds an object * * @return A user assigned Object @@ -817,7 +817,7 @@ public: * @lua NA */ virtual Object* getUserObject() { return _userObject; } - /** + /** * @js NA * @lua NA */ @@ -834,15 +834,15 @@ public: * @param userObject A user assigned Object */ virtual void setUserObject(Object *userObject); - + /// @} end of Tag & User Data - - + + /// @{ /// @name Shader Program /** * Return the shader program currently used for this node - * + * * @return The shader program currelty used for this node */ virtual GLProgram* getShaderProgram() { return _shaderProgram; } @@ -856,13 +856,13 @@ public: @code node->setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR)); @endcode - * + * * @param shaderProgram The shader program which fetchs from ShaderCache. */ virtual void setShaderProgram(GLProgram *shaderProgram); /// @} end of Shader Program - - + + /** * Returns a camera object that lets you move the node using a gluLookAt * @@ -875,29 +875,29 @@ public: * @return A Camera object that lets you move the node using a gluLookAt */ virtual Camera* getCamera(); - - /** + + /** * Returns whether or not the node accepts event callbacks. - * + * * Running means the node accept event callbacks like onEnter(), onExit(), update() * * @return Whether or not the node is running. */ virtual bool isRunning() const; - - /** - * Schedules for lua script. + + /** + * Schedules for lua script. * @js NA */ void scheduleUpdateWithPriorityLua(int handler, int priority); - + /// @} end Script Bindings /// @{ /// @name Event Callbacks - - /** + + /** * Event callback that is invoked every time when Node enters the 'stage'. * If the Node enters the 'stage' with a transition, this event is called when the transition starts. * During onEnter you can't access a "sister/brother" node. @@ -915,7 +915,7 @@ public: */ virtual void onEnterTransitionDidFinish(); - /** + /** * Event callback that is invoked every time the Node leaves the 'stage'. * If the Node leaves the 'stage' with a transition, this event is called when the transition finishes. * During onExit you can't access a sibling node. @@ -925,23 +925,23 @@ public: */ virtual void onExit(); - /** + /** * Event callback that is called every time the Node leaves the 'stage'. * If the Node leaves the 'stage' with a transition, this callback is called when the transition starts. * @js NA * @lua NA */ virtual void onExitTransitionDidStart(); - + /// @} end of event callbacks. - /** + /** * Stops all running actions and schedulers */ virtual void cleanup(); - /** + /** * Override this method to draw your own node. * The following GL states will be enabled by default: * - `glEnableClientState(GL_VERTEX_ARRAY);` @@ -953,19 +953,19 @@ public: */ virtual void draw(); - /** + /** * Visits this node's children and draw them recursively. */ virtual void visit(); - - /** + + /** * Returns a "local" axis aligned bounding box of the node. * The returned box is relative only to its parent. * * @note This method returns a temporaty variable, so it can't returns const Rect& * @todo Rename to `getBoundingBox()` in the future versions. - * + * * @return A "local" axis aligned boudning box of the node. */ virtual Rect getBoundingBox() const; @@ -975,7 +975,7 @@ public: virtual void setEventDispatcher(EventDispatcher* dispatcher); virtual EventDispatcher* getEventDispatcher() const { return _eventDispatcher; }; - + /// @{ /// @name Actions @@ -995,7 +995,7 @@ public: virtual ActionManager* getActionManager() { return _actionManager; } virtual const ActionManager* getActionManager() const { return _actionManager; } - /** + /** * Executes an action, and returns the action that is executed. * * This node becomes the action's target. Refer to Action::getTarget() @@ -1005,26 +1005,26 @@ public: */ Action* runAction(Action* action); - /** + /** * Stops and removes all actions from the running action list . */ void stopAllActions(); - /** + /** * Stops and removes an action from the running action list. * * @param action The action object to be removed. */ void stopAction(Action* action); - /** + /** * Removes an action from the running action list by its tag. * * @param tag A tag that indicates the action to be removed. */ void stopActionByTag(int tag); - /** + /** * Gets an action from the running action list by its tag. * * @see `setTag(int)`, `getTag()`. @@ -1033,7 +1033,7 @@ public: */ Action* getActionByTag(int tag); - /** + /** * Returns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays). * * Composable actions are counted as 1 action. Example: @@ -1049,8 +1049,8 @@ public: CC_DEPRECATED_ATTRIBUTE unsigned int numberOfRunningActions() const { return getNumberOfRunningActions(); }; /// @} end of Actions - - + + /// @{ /// @name Scheduler and Timer @@ -1070,8 +1070,8 @@ public: virtual Scheduler* getScheduler() { return _scheduler; } virtual const Scheduler* getScheduler() const { return _scheduler; } - - /** + + /** * Checks whether a selector is scheduled. * * @param selector A function selector @@ -1081,8 +1081,8 @@ public: */ bool isScheduled(SEL_SCHEDULE selector); - /** - * Schedules the "update" method. + /** + * Schedules the "update" method. * * It will use the order number 0. This method will be called every frame. * Scheduled methods with a lower order value will be called before the ones that have a higher order value. @@ -1092,8 +1092,8 @@ public: */ void scheduleUpdate(void); - /** - * Schedules the "update" method with a custom priority. + /** + * Schedules the "update" method with a custom priority. * * This selector will be called every frame. * Scheduled methods with a lower priority will be called before the ones that have a higher value. @@ -1103,7 +1103,7 @@ public: */ void scheduleUpdateWithPriority(int priority); - /* + /* * Unschedules the "update" method. * @see scheduleUpdate(); */ @@ -1127,7 +1127,7 @@ public: * @lua NA */ void schedule(SEL_SCHEDULE selector, float interval, unsigned int repeat, float delay); - + /** * Schedules a custom selector with an interval time in seconds. * @see `schedule(SEL_SCHEDULE, float, unsigned int, float)` @@ -1137,7 +1137,7 @@ public: * @lua NA */ void schedule(SEL_SCHEDULE selector, float interval); - + /** * Schedules a selector that runs only once, with a delay of 0 or larger * @see `schedule(SEL_SCHEDULE, float, unsigned int, float)` @@ -1147,7 +1147,7 @@ public: * @lua NA */ void scheduleOnce(SEL_SCHEDULE selector, float delay); - + /** * Schedules a custom selector, the scheduled selector will be ticked every frame * @see schedule(SEL_SCHEDULE, float, unsigned int, float) @@ -1156,8 +1156,8 @@ public: * @lua NA */ void schedule(SEL_SCHEDULE selector); - - /** + + /** * Unschedules a custom selector. * @see `schedule(SEL_SCHEDULE, float, unsigned int, float)` * @@ -1166,7 +1166,7 @@ public: */ void unschedule(SEL_SCHEDULE selector); - /** + /** * Unschedule all scheduled selectors: custom selectors, and the 'update' selector. * Actions are not affected by this method. * @lua NA @@ -1183,19 +1183,19 @@ public: * This method is called internally by onExit */ void pause(void); - + /** * Resumes all scheduled selectors, actions and event listeners. * This method is called internally by onEnter */ CC_DEPRECATED_ATTRIBUTE void resumeSchedulerAndActions(void); - /** + /** * Pauses all scheduled selectors, actions and event listeners.. * This method is called internally by onExit */ CC_DEPRECATED_ATTRIBUTE void pauseSchedulerAndActions(void); - - /* + + /* * Update method will be called automatically every frame if "scheduleUpdate" is called, and the node is "live" */ virtual void update(float delta); @@ -1204,7 +1204,7 @@ public: /// @{ /// @name Transformations - + /** * Performs OpenGL view-matrix transformation based on position, scale, rotation and other attributes. */ @@ -1223,8 +1223,8 @@ public: * e.g., `batchNode->addChild(myCustomNode)`, while you can only addChild(sprite) before. */ virtual void updateTransform(); - - /** + + /** * Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates. * The matrix is in Pixels. */ @@ -1233,7 +1233,7 @@ public: /** @deprecated use getNodeToParentTransform() instead */ CC_DEPRECATED_ATTRIBUTE inline virtual AffineTransform nodeToParentTransform() const { return getNodeToParentTransform(); } - /** + /** * Returns the matrix that transform parent's space coordinates to the node's (local) space coordinates. * The matrix is in Pixels. */ @@ -1242,7 +1242,7 @@ public: /** @deprecated Use getParentToNodeTransform() instead */ CC_DEPRECATED_ATTRIBUTE inline virtual AffineTransform parentToNodeTransform() const { return getParentToNodeTransform(); } - /** + /** * Returns the world affine transform matrix. The matrix is in Pixels. */ virtual AffineTransform getNodeToWorldTransform() const; @@ -1250,7 +1250,7 @@ public: /** @deprecated Use getNodeToWorldTransform() instead */ CC_DEPRECATED_ATTRIBUTE inline virtual AffineTransform nodeToWorldTransform() const { return getNodeToWorldTransform(); } - /** + /** * Returns the inverse world affine transform matrix. The matrix is in Pixels. */ virtual AffineTransform getWorldToNodeTransform() const; @@ -1259,43 +1259,43 @@ public: CC_DEPRECATED_ATTRIBUTE inline virtual AffineTransform worldToNodeTransform() const { return getWorldToNodeTransform(); } /// @} end of Transformations - - + + /// @{ /// @name Coordinate Converters - - /** + + /** * Converts a Point to node (local) space coordinates. The result is in Points. */ Point convertToNodeSpace(const Point& worldPoint) const; - - /** + + /** * Converts a Point to world space coordinates. The result is in Points. */ Point convertToWorldSpace(const Point& nodePoint) const; - - /** + + /** * Converts a Point to node (local) space coordinates. The result is in Points. * treating the returned/received node point as anchor relative. */ Point convertToNodeSpaceAR(const Point& worldPoint) const; - - /** + + /** * Converts a local Point to world space coordinates.The result is in Points. * treating the returned/received node point as anchor relative. */ Point convertToWorldSpaceAR(const Point& nodePoint) const; - /** + /** * convenience methods which take a Touch instead of Point */ Point convertTouchToNodeSpace(Touch * touch) const; - /** + /** * converts a Touch (world coordinates) into a local coordinate. This method is AR (Anchor Relative). */ Point convertTouchToNodeSpaceAR(Touch * touch) const; - + /** * Sets the additional transform. * @@ -1345,51 +1345,51 @@ public: @endcode */ void setAdditionalTransform(const AffineTransform& additionalTransform); - + /// @} end of Coordinate Converters /// @{ /// @name component functions - /** + /** * gets a component by its name */ Component* getComponent(const char *pName); - - /** + + /** * adds a component */ virtual bool addComponent(Component *pComponent); - - /** - * removes a component by its name + + /** + * removes a component by its name */ virtual bool removeComponent(const char *pName); - + /** * removes all components */ virtual void removeAllComponents(); /// @} end of component functions - - + + #ifdef CC_USE_PHYSICS /** * set the PhysicsBody that let the sprite effect with physics */ void setPhysicsBody(PhysicsBody* body); - + /** * get the PhysicsBody the sprite have */ PhysicsBody* getPhysicsBody() const; - + /** * update rotation and position from physics body */ virtual void updatePhysicsTransform(); #endif - + protected: // Nodes should be created using create(); Node(); @@ -1398,35 +1398,35 @@ protected: /// lazy allocs void childrenAlloc(void); - + /// helper that reorder a child void insertChild(Node* child, int z); - + /// Removes a child, call child->onExit(), do cleanup, remove it from children array. void detachChild(Node *child, long index, bool doCleanup); - + /// Convert cocos2d coordinates to UI windows coordinate. Point convertToWindowSpace(const Point& nodePoint) const; float _rotationX; ///< rotation angle on x-axis float _rotationY; ///< rotation angle on y-axis - + float _scaleX; ///< scaling factor on x-axis float _scaleY; ///< scaling factor on y-axis - + float _vertexZ; ///< OpenGL real Z vertex - + Point _position; ///< position of the node - + float _skewX; ///< skew angle on x-axis float _skewY; ///< skew angle on y-axis - + Point _anchorPointInPoints; ///< anchor point in points Point _anchorPoint; ///< anchor point normalized (NOT in points) - + Size _contentSize; ///< untransformed size of the node - + // "cache" variables are allowed to be mutable mutable AffineTransform _additionalTransform; ///< transform mutable AffineTransform _transform; ///< transform @@ -1436,45 +1436,45 @@ protected: mutable bool _inverseDirty; ///< inverse transform dirty flag Camera *_camera; ///< a camera - + GridBase *_grid; ///< a grid - + int _ZOrder; ///< z-order value that affects the draw order - + Array *_children; ///< array of children nodes Node *_parent; ///< weak reference to parent node - + int _tag; ///< a tag. Can be any number you assigned just to identify this node - + void *_userData; ///< A user assingned void pointer, Can be point to any cpp object Object *_userObject; ///< A user assigned Object - + GLProgram *_shaderProgram; ///< OpenGL shader int _orderOfArrival; ///< used to preserve sequence while sorting children with the same zOrder - + Scheduler *_scheduler; ///< scheduler used to schedule timers and updates - + ActionManager *_actionManager; ///< a pointer to ActionManager singleton, which is used to handle all the actions - + EventDispatcher* _eventDispatcher; ///< event dispatcher used to dispatch all kinds of events - + bool _running; ///< is running - + bool _visible; ///< is this node visible - + bool _ignoreAnchorPointForPosition; ///< true if the Anchor Point will be (0,0) when you position the Node, false otherwise. ///< Used by Layer and Scene. - + bool _reorderChildDirty; ///< children order dirty flag bool _isTransitionFinished; ///< flag to indicate whether the transition was finished - + int _scriptHandler; ///< script handler for onEnter() & onExit(), used in Javascript binding and Lua binding. int _updateScriptHandler; ///< script handler for update() callback per frame, which is invoked from lua & javascript. ccScriptType _scriptType; ///< type of script binding, lua or javascript - + ComponentContainer *_componentContainer; ///< Dictionary of components - + #ifdef CC_USE_PHYSICS PhysicsBody* _physicsBody; ///< the physicsBody the node have #endif @@ -1486,11 +1486,11 @@ private: //#pragma mark - NodeRGBA /** NodeRGBA is a subclass of Node that implements the RGBAProtocol protocol. - + All features from Node are valid, plus the following new features: - opacity - RGB colors - + Opacity/Color propagates into children that conform to the RGBAProtocol if cascadeOpacity/cascadeColor is enabled. @since v2.1 */ @@ -1504,14 +1504,14 @@ public: virtual void updateDisplayedOpacity(GLubyte parentOpacity) override; virtual bool isCascadeOpacityEnabled() const override; virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled) override; - + virtual const Color3B& getColor(void) const override; virtual const Color3B& getDisplayedColor() const override; virtual void setColor(const Color3B& color) override; virtual void updateDisplayedColor(const Color3B& parentColor) override; virtual bool isCascadeColorEnabled() const override; virtual void setCascadeColorEnabled(bool cascadeColorEnabled) override; - + virtual void setOpacityModifyRGB(bool bValue) override {CC_UNUSED_PARAM(bValue);}; virtual bool isOpacityModifyRGB() const override { return false; }; diff --git a/cocos/2d/CCParticleBatchNode.cpp b/cocos/2d/CCParticleBatchNode.cpp index 0d1eccae48..a6d1fff5cb 100644 --- a/cocos/2d/CCParticleBatchNode.cpp +++ b/cocos/2d/CCParticleBatchNode.cpp @@ -102,7 +102,7 @@ bool ParticleBatchNode::initWithTexture(Texture2D *tex, int capacity) _blendFunc = BlendFunc::ALPHA_PREMULTIPLIED; setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR)); - + return true; } @@ -144,7 +144,7 @@ void ParticleBatchNode::visit() transform(); draw(); - + if ( _grid && _grid->isActive()) { _grid->afterDraw(this); @@ -171,12 +171,12 @@ void ParticleBatchNode::addChild(Node * aChild, int zOrder, int tag) ParticleSystem* child = static_cast(aChild); CCASSERT( child->getTexture()->getName() == _textureAtlas->getTexture()->getName(), "CCParticleSystem is not using the same texture id"); // If this is the 1st children, then copy blending function - if( _children->count() == 0 ) + if( _children->count() == 0 ) { setBlendFunc(child->getBlendFunc()); } - CCASSERT( _blendFunc.src == child->getBlendFunc().src && _blendFunc.dst == child->getBlendFunc().dst, "Can't add a PaticleSystem that uses a different blending function"); + CCASSERT( _blendFunc.src == child->getBlendFunc().src && _blendFunc.dst == child->getBlendFunc().dst, "Can't add a ParticleSystem that uses a different blending function"); //no lazy sorting, so don't call super addChild, call helper instead unsigned int pos = addChildHelper(child,zOrder,tag); @@ -184,7 +184,7 @@ void ParticleBatchNode::addChild(Node * aChild, int zOrder, int tag) //get new atlasIndex int atlasIndex = 0; - if (pos != 0) + if (pos != 0) { ParticleSystem* p = (ParticleSystem*)_children->getObjectAtIndex(pos-1); atlasIndex = p->getAtlasIndex() + p->getTotalParticles(); @@ -210,7 +210,7 @@ unsigned int ParticleBatchNode::addChildHelper(ParticleSystem* child, int z, int CCASSERT( child != NULL, "Argument must be non-nil"); CCASSERT( child->getParent() == NULL, "child already added. It can't be added again"); - if( ! _children ) + if( ! _children ) { _children = new Array(); _children->initWithCapacity(4); @@ -226,7 +226,7 @@ unsigned int ParticleBatchNode::addChildHelper(ParticleSystem* child, int z, int child->setParent(this); - if( _running ) + if( _running ) { child->onEnter(); child->onEnterTransitionDidFinish(); @@ -243,7 +243,7 @@ void ParticleBatchNode::reorderChild(Node * aChild, int zOrder) ParticleSystem* child = static_cast(aChild); - if( zOrder == child->getZOrder() ) + if( zOrder == child->getZOrder() ) { return; } @@ -275,7 +275,7 @@ void ParticleBatchNode::reorderChild(Node * aChild, int zOrder) for( int i=0;i < _children->count();i++) { ParticleSystem* pNode = (ParticleSystem*)_children->getObjectAtIndex(i); - if( pNode == child ) + if( pNode == child ) { newAtlasIndex = child->getAtlasIndex(); break; @@ -300,12 +300,12 @@ void ParticleBatchNode::getCurrentIndex(unsigned int* oldIndex, unsigned int* ne int minusOne = 0; unsigned int count = _children->count(); - for( unsigned int i=0; i < count; i++ ) + for( unsigned int i=0; i < count; i++ ) { Node* pNode = (Node *)_children->getObjectAtIndex(i); // new index - if( pNode->getZOrder() > z && ! foundNewIdx ) + if( pNode->getZOrder() > z && ! foundNewIdx ) { *newIndex = i; foundNewIdx = true; @@ -317,7 +317,7 @@ void ParticleBatchNode::getCurrentIndex(unsigned int* oldIndex, unsigned int* ne } // current index - if( child == pNode ) + if( child == pNode ) { *oldIndex = i; foundCurrentIdx = true; @@ -347,7 +347,7 @@ unsigned int ParticleBatchNode::searchNewPositionInChildrenForZ(int z) { unsigned int count = _children->count(); - for( unsigned int i=0; i < count; i++ ) + for( unsigned int i=0; i < count; i++ ) { Node *child = (Node *)_children->getObjectAtIndex(i); if (child->getZOrder() > z) @@ -364,7 +364,7 @@ void ParticleBatchNode::removeChild(Node* aChild, bool cleanup) // explicit nil handling if (aChild == NULL) return; - + CCASSERT( dynamic_cast(aChild) != NULL, "CCParticleBatchNode only supports QuadParticleSystems as children"); CCASSERT(_children->containsObject(aChild), "CCParticleBatchNode doesn't contain the sprite. Can't remove it"); diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp index 65cd9044ef..8bd9af7a80 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp @@ -184,7 +184,7 @@ void ArmatureTestLayer::onExit() removeAllChildren(); backItem = restartItem = nextItem = nullptr; - + Layer::onExit(); } @@ -371,7 +371,7 @@ void TestPerformance::onEnter() decrease->setColor(Color3B(0,200,20)); MenuItemFont *increase = MenuItemFont::create(" + ", CC_CALLBACK_1(TestPerformance::onIncrease, this)); increase->setColor(Color3B(0,200,20)); - + Menu *menu = Menu::create(decrease, increase, nullptr); menu->alignItemsHorizontally(); menu->setPosition(Point(VisibleRect::getVisibleRect().size.width/2, VisibleRect::getVisibleRect().size.height-100)); @@ -404,7 +404,7 @@ void TestPerformance::onDecrease(Object* pSender) { removeArmatureFromParent(ArmaturePerformanceTag + armatureCount); armatureCount --; - refreshTitile(); + refreshTitle(); } } void TestPerformance::addArmature(int number) @@ -423,7 +423,7 @@ void TestPerformance::addArmature(int number) armature->release(); } - refreshTitile(); + refreshTitle(); } void TestPerformance::addArmatureToParent(cocostudio::Armature *armature) { @@ -433,7 +433,7 @@ void TestPerformance::removeArmatureFromParent(int tag) { removeChildByTag(ArmaturePerformanceTag + armatureCount); } -void TestPerformance::refreshTitile() +void TestPerformance::refreshTitle() { char pszCount[255]; sprintf(pszCount, "%s %i", subtitle().c_str(), armatureCount); @@ -601,7 +601,7 @@ void TestFrameEvent::onFrameEvent(Bone *bone, const char *evt, int originFrameIn { this->stopAllActions(); - ActionInterval *action = ShatteredTiles3D::create(0.2f, Size(16,12), 5, false); + ActionInterval *action = ShatteredTiles3D::create(0.2f, Size(16,12), 5, false); action->setTag(FRAME_EVENT_ACTION_TAG); this->runAction(action); } @@ -617,7 +617,7 @@ void TestFrameEvent::checkAction(float dt) void TestParticleDisplay::onEnter() { ArmatureTestLayer::onEnter(); - + auto listener = EventListenerTouchAllAtOnce::create(); listener->onTouchesEnded = CC_CALLBACK_2(TestParticleDisplay::onTouchesEnded, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); @@ -681,7 +681,7 @@ void TestUseMutiplePicture::onEnter() auto listener = EventListenerTouchAllAtOnce::create(); listener->onTouchesEnded = CC_CALLBACK_2(TestUseMutiplePicture::onTouchesEnded, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); - + displayIndex = 0; armature = Armature::create("Knight_f/Knight"); @@ -1076,7 +1076,7 @@ std::string TestAnchorPoint::title() void TestArmatureNesting::onEnter() { ArmatureTestLayer::onEnter(); - + auto listener = EventListenerTouchAllAtOnce::create(); listener->onTouchesEnded = CC_CALLBACK_2(TestArmatureNesting::onTouchesEnded, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); @@ -1241,7 +1241,7 @@ void TestArmatureNesting2::onTouchesEnded(const std::vector& touches, Ev { Point point = touches[0]->getLocation(); - Armature *armature = hero->getMount() == nullptr ? hero : hero->getMount(); + Armature *armature = hero->getMount() == nullptr ? hero : hero->getMount(); //Set armature direction if (point.x < armature->getPositionX()) diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.h b/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.h index 79e29b61dc..dc0eed2493 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.h +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.h @@ -16,7 +16,7 @@ class ArmatureTestScene : public TestScene { -public: +public: ArmatureTestScene(bool bPortrait = false); virtual void runThisTest(); @@ -114,7 +114,7 @@ public: virtual void addArmature(int number); virtual void addArmatureToParent(cocostudio::Armature *armature); virtual void removeArmatureFromParent(int tag); - virtual void refreshTitile(); + virtual void refreshTitle(); int armatureCount; @@ -327,4 +327,4 @@ public: bool touchedMenu; }; -#endif // __HELLOWORLD_SCENE_H__ \ No newline at end of file +#endif // __HELLOWORLD_SCENE_H__ diff --git a/samples/Cpp/TestCpp/Classes/ParticleTest/ParticleTest.cpp b/samples/Cpp/TestCpp/Classes/ParticleTest/ParticleTest.cpp index f8bfc895af..bab33d56c3 100644 --- a/samples/Cpp/TestCpp/Classes/ParticleTest/ParticleTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ParticleTest/ParticleTest.cpp @@ -21,9 +21,9 @@ void DemoFirework::onEnter() _emitter = ParticleFireworks::create(); _emitter->retain(); _background->addChild(_emitter, 10); - + _emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_stars1) ); - + setEmitterPosition(); } @@ -45,11 +45,11 @@ void DemoFire::onEnter() _emitter = ParticleFire::create(); _emitter->retain(); _background->addChild(_emitter, 10); - + _emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) );//.pvr"); auto p = _emitter->getPosition(); _emitter->setPosition( Point(p.x, 100) ); - + setEmitterPosition(); } @@ -72,7 +72,7 @@ void DemoSun::onEnter() _background->addChild(_emitter, 10); _emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) ); - + setEmitterPosition(); } @@ -93,10 +93,10 @@ void DemoGalaxy::onEnter() _emitter = ParticleGalaxy::create(); _emitter->retain(); _background->addChild(_emitter, 10); - + _emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) ); - - setEmitterPosition(); + + setEmitterPosition(); } std::string DemoGalaxy::title() @@ -117,7 +117,7 @@ void DemoFlower::onEnter() _emitter->retain(); _background->addChild(_emitter, 10); _emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_stars1) ); - + setEmitterPosition(); } @@ -143,61 +143,61 @@ void DemoBigFlower::onEnter() _emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_stars1) ); _emitter->setDuration(-1); - + // gravity _emitter->setGravity(Point::ZERO); - + // angle _emitter->setAngle(90); _emitter->setAngleVar(360); - + // speed of particles _emitter->setSpeed(160); _emitter->setSpeedVar(20); - + // radial _emitter->setRadialAccel(-120); _emitter->setRadialAccelVar(0); - + // tagential _emitter->setTangentialAccel(30); _emitter->setTangentialAccelVar(0); - + // emitter position _emitter->setPosition( Point(160,240) ); _emitter->setPosVar(Point::ZERO); - + // life of particles _emitter->setLife(4); _emitter->setLifeVar(1); - + // spin of particles _emitter->setStartSpin(0); _emitter->setStartSizeVar(0); _emitter->setEndSpin(0); _emitter->setEndSpinVar(0); - + // color of particles Color4F startColor(0.5f, 0.5f, 0.5f, 1.0f); _emitter->setStartColor(startColor); - + Color4F startColorVar(0.5f, 0.5f, 0.5f, 1.0f); _emitter->setStartColorVar(startColorVar); - + Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f); _emitter->setEndColor(endColor); - - Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); + + Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); _emitter->setEndColorVar(endColorVar); - + // size, in pixels _emitter->setStartSize(80.0f); _emitter->setStartSizeVar(40.0f); _emitter->setEndSize(ParticleSystem::START_SIZE_EQUAL_TO_END_SIZE); - + // emits per second _emitter->setEmissionRate(_emitter->getTotalParticles()/_emitter->getLife()); - + // additive _emitter->setBlendAdditive(true); @@ -224,33 +224,33 @@ void DemoRotFlower::onEnter() _background->addChild(_emitter, 10); ////_emitter->release(); // win32 : Remove this line _emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_stars2) ); - + // duration _emitter->setDuration(-1); - + // gravity _emitter->setGravity(Point::ZERO); - + // angle _emitter->setAngle(90); _emitter->setAngleVar(360); - + // speed of particles _emitter->setSpeed(160); _emitter->setSpeedVar(20); - + // radial _emitter->setRadialAccel(-120); _emitter->setRadialAccelVar(0); - + // tagential _emitter->setTangentialAccel(30); _emitter->setTangentialAccelVar(0); - + // emitter position _emitter->setPosition( Point(160,240) ); _emitter->setPosVar(Point::ZERO); - + // life of particles _emitter->setLife(3); _emitter->setLifeVar(1); @@ -260,31 +260,31 @@ void DemoRotFlower::onEnter() _emitter->setStartSpinVar(0); _emitter->setEndSpin(0); _emitter->setEndSpinVar(2000); - + // color of particles Color4F startColor(0.5f, 0.5f, 0.5f, 1.0f); _emitter->setStartColor(startColor); - + Color4F startColorVar(0.5f, 0.5f, 0.5f, 1.0f); _emitter->setStartColorVar(startColorVar); - + Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f); _emitter->setEndColor(endColor); - - Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); + + Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); _emitter->setEndColorVar(endColorVar); // size, in pixels _emitter->setStartSize(30.0f); _emitter->setStartSizeVar(00.0f); _emitter->setEndSize(ParticleSystem::START_SIZE_EQUAL_TO_END_SIZE); - + // emits per second _emitter->setEmissionRate(_emitter->getTotalParticles()/_emitter->getLife()); // additive _emitter->setBlendAdditive(false); - + setEmitterPosition(); } @@ -305,9 +305,9 @@ void DemoMeteor::onEnter() _emitter = ParticleMeteor::create(); _emitter->retain(); _background->addChild(_emitter, 10); - + _emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) ); - + setEmitterPosition(); } @@ -328,9 +328,9 @@ void DemoSpiral::onEnter() _emitter = ParticleSpiral::create(); _emitter->retain(); _background->addChild(_emitter, 10); - + _emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) ); - + setEmitterPosition(); } @@ -351,11 +351,11 @@ void DemoExplosion::onEnter() _emitter = ParticleExplosion::create(); _emitter->retain(); _background->addChild(_emitter, 10); - + _emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_stars1) ); - + _emitter->setAutoRemoveOnFinish(true); - + setEmitterPosition(); } @@ -377,10 +377,10 @@ void DemoSmoke::onEnter() _emitter->retain(); _background->addChild(_emitter, 10); _emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) ); - + auto p = _emitter->getPosition(); _emitter->setPosition( Point( p.x, 100) ); - + setEmitterPosition(); } @@ -401,34 +401,34 @@ void DemoSnow::onEnter() _emitter = ParticleSnow::create(); _emitter->retain(); _background->addChild(_emitter, 10); - + auto p = _emitter->getPosition(); _emitter->setPosition( Point( p.x, p.y-110) ); _emitter->setLife(3); _emitter->setLifeVar(1); - + // gravity _emitter->setGravity(Point(0,-10)); - + // speed of particles _emitter->setSpeed(130); _emitter->setSpeedVar(30); - - + + Color4F startColor = _emitter->getStartColor(); startColor.r = 0.9f; startColor.g = 0.9f; startColor.b = 0.9f; _emitter->setStartColor(startColor); - + Color4F startColorVar = _emitter->getStartColorVar(); startColorVar.b = 0.1f; _emitter->setStartColorVar(startColorVar); - + _emitter->setEmissionRate(_emitter->getTotalParticles()/_emitter->getLife()); - + _emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_snow) ); - + setEmitterPosition(); } @@ -449,13 +449,13 @@ void DemoRain::onEnter() _emitter = ParticleRain::create(); _emitter->retain(); _background->addChild(_emitter, 10); - + auto p = _emitter->getPosition(); _emitter->setPosition( Point( p.x, p.y-100) ); _emitter->setLife(4); - + _emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) ); - + setEmitterPosition(); } @@ -473,74 +473,74 @@ void DemoModernArt::onEnter() { ParticleDemo::onEnter(); -//FIXME: If use ParticleSystemPoint, bada 1.0 device will crash. +//FIXME: If use ParticleSystemPoint, bada 1.0 device will crash. // Crash place: ParticleSystemPoint.cpp Line 149, function: glDrawArrays(GL_POINTS, 0, _particleIdx); _emitter = ParticleSystemQuad::createWithTotalParticles(1000); _emitter->retain(); _background->addChild(_emitter, 10); ////_emitter->release(); - + auto s = Director::getInstance()->getWinSize(); - + // duration _emitter->setDuration(-1); - + // gravity _emitter->setGravity(Point(0,0)); - + // angle _emitter->setAngle(0); _emitter->setAngleVar(360); - + // radial _emitter->setRadialAccel(70); _emitter->setRadialAccelVar(10); - + // tagential _emitter->setTangentialAccel(80); _emitter->setTangentialAccelVar(0); - + // speed of particles _emitter->setSpeed(50); _emitter->setSpeedVar(10); - + // emitter position _emitter->setPosition( Point( s.width/2, s.height/2) ); _emitter->setPosVar(Point::ZERO); - + // life of particles _emitter->setLife(2.0f); _emitter->setLifeVar(0.3f); - + // emits per frame _emitter->setEmissionRate(_emitter->getTotalParticles()/_emitter->getLife()); - + // color of particles Color4F startColor(0.5f, 0.5f, 0.5f, 1.0f); _emitter->setStartColor(startColor); - + Color4F startColorVar(0.5f, 0.5f, 0.5f, 1.0f); _emitter->setStartColorVar(startColorVar); - + Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f); _emitter->setEndColor(endColor); - - Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); + + Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); _emitter->setEndColorVar(endColorVar); - + // size, in pixels _emitter->setStartSize(1.0f); _emitter->setStartSizeVar(1.0f); _emitter->setEndSize(32.0f); _emitter->setEndSizeVar(8.0f); - + // texture _emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) ); - + // additive _emitter->setBlendAdditive(false); - + setEmitterPosition(); } @@ -551,7 +551,7 @@ std::string DemoModernArt::title() //------------------------------------------------------------------ // -// DemoRing +// DemoRing // //------------------------------------------------------------------ void DemoRing::onEnter() @@ -569,7 +569,7 @@ void DemoRing::onEnter() _emitter->setSpeed(100); _emitter->setSpeedVar(0); _emitter->setEmissionRate(10000); - + setEmitterPosition(); } @@ -586,16 +586,16 @@ std::string DemoRing::title() void ParallaxParticle::onEnter() { ParticleDemo::onEnter(); - + _background->getParent()->removeChild(_background, true); _background = NULL; - auto p = ParallaxNode::create(); + auto p = ParallaxNode::create(); addChild(p, 5); auto p1 = Sprite::create(s_back3); auto p2 = Sprite::create(s_back3); - + p->addChild( p1, 1, Point(0.5f,1), Point(0,250) ); p->addChild(p2, 2, Point(1.5f,1), Point(0,50) ); @@ -605,15 +605,15 @@ void ParallaxParticle::onEnter() p1->addChild(_emitter, 10); _emitter->setPosition( Point(250,200) ); - + auto par = ParticleSun::create(); p2->addChild(par, 10); par->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) ); - + auto move = MoveBy::create(4, Point(300,0)); auto move_back = move->reverse(); auto seq = Sequence::create( move, move_back, NULL); - p->runAction(RepeatForever::create(seq)); + p->runAction(RepeatForever::create(seq)); } std::string ParallaxParticle::title() @@ -685,7 +685,7 @@ void RadiusMode1::onEnter() Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f); _emitter->setEndColor(endColor); - Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); + Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); _emitter->setEndColorVar(endColorVar); // size, in pixels @@ -769,7 +769,7 @@ void RadiusMode2::onEnter() Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f); _emitter->setEndColor(endColor); - Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); + Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); _emitter->setEndColorVar(endColorVar); // size, in pixels @@ -853,7 +853,7 @@ void Issue704::onEnter() Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f); _emitter->setEndColor(endColor); - Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); + Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); _emitter->setEndColorVar(endColorVar); // size, in pixels @@ -956,7 +956,7 @@ enum IDC_TOGGLE }; -static int sceneIdx = -1; +static int sceneIdx = -1; #define MAX_LAYER 44 @@ -1033,8 +1033,8 @@ Layer* backParticleAction() sceneIdx--; int total = MAX_LAYER; if( sceneIdx < 0 ) - sceneIdx += total; - + sceneIdx += total; + auto layer = createParticleLayer(sceneIdx); layer->autorelease(); @@ -1047,7 +1047,7 @@ Layer* restartParticleAction() layer->autorelease(); return layer; -} +} ParticleDemo::~ParticleDemo(void) { @@ -1060,46 +1060,46 @@ void ParticleDemo::onEnter(void) _color = LayerColor::create( Color4B(127,127,127,255) ); this->addChild(_color); - + _emitter = NULL; - + auto listener = EventListenerTouchAllAtOnce::create(); listener->onTouchesBegan = CC_CALLBACK_2(ParticleDemo::onTouchesBegan, this); listener->onTouchesMoved = CC_CALLBACK_2(ParticleDemo::onTouchesMoved, this); listener->onTouchesEnded = CC_CALLBACK_2(ParticleDemo::onTouchesEnded, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); - + auto s = Director::getInstance()->getWinSize(); - + auto item4 = MenuItemToggle::createWithCallback( CC_CALLBACK_1(ParticleDemo::toggleCallback, this), MenuItemFont::create( "Free Movement" ), MenuItemFont::create( "Relative Movement" ), MenuItemFont::create( "Grouped Movement" ), NULL ); - + auto menu = Menu::create(item4, NULL); - + menu->setPosition( Point::ZERO ); item4->setPosition( Point( VisibleRect::left().x, VisibleRect::bottom().y+ 100) ); item4->setAnchorPoint( Point(0,0) ); - + addChild( menu, 100 ); - + auto labelAtlas = LabelAtlas::create("0000", "fps_images.png", 12, 32, '.'); addChild(labelAtlas, 100, kTagParticleCount); labelAtlas->setPosition(Point(s.width-66,50)); - + // moving background _background = Sprite::create(s_back3); addChild(_background, 5); _background->setPosition( Point(s.width/2, s.height-180) ); - + auto move = MoveBy::create(4, Point(300,0) ); auto move_back = move->reverse(); auto seq = Sequence::create( move, move_back, NULL); _background->runAction( RepeatForever::create(seq) ); - - + + scheduleUpdate(); } @@ -1110,7 +1110,7 @@ std::string ParticleDemo::title() std::string ParticleDemo::subtitle() { - return "No titile"; + return "No title"; } void ParticleDemo::onTouchesBegan(const std::vector& touches, Event *event) @@ -1126,7 +1126,7 @@ void ParticleDemo::onTouchesMoved(const std::vector& touches, Event *ev void ParticleDemo::onTouchesEnded(const std::vector& touches, Event *event) { auto touch = touches[0]; - + auto location = touch->getLocation(); auto pos = Point::ZERO; @@ -1169,7 +1169,7 @@ void ParticleDemo::restartCallback(Object* sender) { if (_emitter != NULL) { - _emitter->resetSystem(); + _emitter->resetSystem(); } } @@ -1187,7 +1187,7 @@ void ParticleDemo::backCallback(Object* sender) s->addChild( backParticleAction() ); Director::getInstance()->replaceScene(s); s->release(); -} +} void ParticleDemo::setEmitterPosition() { @@ -1217,10 +1217,10 @@ void ParticleBatchHybrid::onEnter() addChild(batch, 10); schedule(schedule_selector(ParticleBatchHybrid::switchRender), 2.0f); - + auto node = Node::create(); addChild(node); - + _parent1 = batch; _parent2 = node; } @@ -1229,16 +1229,16 @@ void ParticleBatchHybrid::switchRender(float dt) { bool usingBatch = ( _emitter->getBatchNode() != NULL ); _emitter->removeFromParentAndCleanup(false); - + auto newParent = (usingBatch ? _parent2 : _parent1 ); newParent->addChild(_emitter); - + log("Particle: Using new parent: %s", usingBatch ? "CCNode" : "CCParticleBatchNode"); } std::string ParticleBatchHybrid::title() { - return "Paticle Batch"; + return "Particle Batch"; } std::string ParticleBatchHybrid::subtitle() @@ -1280,7 +1280,7 @@ void ParticleBatchMultipleEmitters::onEnter() std::string ParticleBatchMultipleEmitters::title() { - return "Paticle Batch"; + return "Particle Batch"; } std::string ParticleBatchMultipleEmitters::subtitle() @@ -1304,7 +1304,7 @@ void ParticleReorder::onEnter() auto parent2 = ParticleBatchNode::createWithTexture(ignore->getTexture()); ignore->unscheduleUpdate(); - for( unsigned int i=0; i<2;i++) + for( unsigned int i=0; i<2;i++) { auto parent = ( i==0 ? parent1 : parent2 ); @@ -1499,7 +1499,7 @@ void MultipleParticleSystems::onEnter() removeChild(_background, true); _background = NULL; - Director::getInstance()->getTextureCache()->addImage("Images/particles.png"); + Director::getInstance()->getTextureCache()->addImage("Images/particles.png"); for (int i = 0; i<5; i++) { auto particleSystem = ParticleSystemQuad::create("Particles/SpinningPeas.plist"); @@ -1528,15 +1528,15 @@ void MultipleParticleSystems::update(float dt) { auto atlas = (LabelAtlas*) getChildByTag(kTagParticleCount); - unsigned int count = 0; - + unsigned int count = 0; + Object* pObj = NULL; CCARRAY_FOREACH(getChildren(), pObj) { auto item = dynamic_cast(pObj); if (item != NULL) { - count += item->getParticleCount(); + count += item->getParticleCount(); } } char str[100] = {0}; @@ -1579,8 +1579,8 @@ void MultipleParticleSystemsBatched::update(float dt) { auto atlas = (LabelAtlas*) getChildByTag(kTagParticleCount); - unsigned count = 0; - + unsigned count = 0; + auto batchNode = getChildByTag(2); Object* pObj = NULL; CCARRAY_FOREACH(batchNode->getChildren(), pObj) @@ -1588,7 +1588,7 @@ void MultipleParticleSystemsBatched::update(float dt) auto item = dynamic_cast(pObj); if (item != NULL) { - count += item->getParticleCount(); + count += item->getParticleCount(); } } char str[50] = {0}; @@ -1631,7 +1631,7 @@ void AddAndDeleteParticleSystems::onEnter() particleSystem->setPosition(Point(i*15 +100,i*15+100)); - unsigned int randZ = rand() % 100; + unsigned int randZ = rand() % 100; _batchNode->addChild(particleSystem, randZ, -1); } @@ -1644,7 +1644,7 @@ void AddAndDeleteParticleSystems::onEnter() void AddAndDeleteParticleSystems::removeSystem(float dt) { int nChildrenCount = _batchNode->getChildren()->count(); - if (nChildrenCount > 0) + if (nChildrenCount > 0) { CCLOG("remove random system"); unsigned int uRand = rand() % (nChildrenCount - 1); @@ -1659,7 +1659,7 @@ void AddAndDeleteParticleSystems::removeSystem(float dt) particleSystem->setPosition(Point(rand() % 300 ,rand() % 400)); CCLOG("add a new system"); - unsigned int randZ = rand() % 100; + unsigned int randZ = rand() % 100; _batchNode->addChild(particleSystem, randZ, -1); } } @@ -1668,8 +1668,8 @@ void AddAndDeleteParticleSystems::update(float dt) { auto atlas = (LabelAtlas*) getChildByTag(kTagParticleCount); - unsigned int count = 0; - + unsigned int count = 0; + auto batchNode = getChildByTag(2); Object* pObj = NULL; CCARRAY_FOREACH(batchNode->getChildren(), pObj) @@ -1677,7 +1677,7 @@ void AddAndDeleteParticleSystems::update(float dt) auto item = dynamic_cast(pObj); if (item != NULL) { - count += item->getParticleCount(); + count += item->getParticleCount(); } } char str[100] = {0}; @@ -1796,7 +1796,7 @@ void ReorderParticleSystems::onEnter() void ReorderParticleSystems::reorderSystem(float time) { auto system = (ParticleSystem*)_batchNode->getChildren()->getObjectAtIndex(1); - _batchNode->reorderChild(system, system->getZOrder() - 1); + _batchNode->reorderChild(system, system->getZOrder() - 1); } @@ -1804,8 +1804,8 @@ void ReorderParticleSystems::update(float dt) { auto atlas = (LabelAtlas*) getChildByTag(kTagParticleCount); - unsigned int count = 0; - + unsigned int count = 0; + auto batchNode = getChildByTag(2); Object* pObj = NULL; CCARRAY_FOREACH(batchNode->getChildren(), pObj) @@ -1813,7 +1813,7 @@ void ReorderParticleSystems::update(float dt) auto item = dynamic_cast(pObj); if (item != NULL) { - count += item->getParticleCount(); + count += item->getParticleCount(); } } char str[100] = {0}; diff --git a/samples/Lua/TestLua/Resources/luaScript/CocoStudioTest/CocoStudioArmatureTest/CocoStudioArmatureTest.lua b/samples/Lua/TestLua/Resources/luaScript/CocoStudioTest/CocoStudioArmatureTest/CocoStudioArmatureTest.lua index feb1b19290..7531500dc8 100644 --- a/samples/Lua/TestLua/Resources/luaScript/CocoStudioTest/CocoStudioArmatureTest/CocoStudioArmatureTest.lua +++ b/samples/Lua/TestLua/Resources/luaScript/CocoStudioTest/CocoStudioArmatureTest/CocoStudioArmatureTest.lua @@ -3,7 +3,7 @@ local armaturePerformanceTag = 20000 local frameEventActionTag = 10000 local winSize = cc.Director:getInstance():getWinSize() local scheduler = cc.Director:getInstance():getScheduler() -local ArmatureTestIndex = +local ArmatureTestIndex = { TEST_ASYNCHRONOUS_LOADING = 1, TEST_DIRECT_LOADING = 2, @@ -52,7 +52,7 @@ function ArmatureTestScene.create() bg:setScaleY(scaleY) scene:addChild(bg) - return scene + return scene end function ArmatureTestScene.toMainMenuCallback() @@ -66,7 +66,7 @@ ArmatureTestLayer._restarItem = nil ArmatureTestLayer._nextItem = nil function ArmatureTestLayer:onEnter() - + end function ArmatureTestLayer.title(idx) @@ -97,7 +97,7 @@ function ArmatureTestLayer.title(idx) elseif ArmatureTestIndex.TEST_ARMATURE_NESTING == idx then return "Test Armature Nesting" elseif ArmatureTestIndex.TEST_ARMATURE_NESTING_2 == idx then - return "Test Armature Nesting 2" + return "Test Armature Nesting 2" end end @@ -127,7 +127,7 @@ function ArmatureTestLayer.create() layer:createToExtensionMenu() layer:onEnter() layer:creatTitleAndSubTitle(armatureSceneIdx) - end + end return layer end @@ -152,7 +152,7 @@ end function ArmatureTestLayer:createMenu() local menu = cc.Menu:create() - + self._backItem = cc.MenuItemImage:create(s_pPathB1, s_pPathB2) self._backItem:registerScriptTapHandler(self.backCallback) menu:addChild(self._backItem,itemTagBasic) @@ -160,14 +160,14 @@ function ArmatureTestLayer:createMenu() self._restarItem:registerScriptTapHandler(self.restartCallback) menu:addChild(self._restarItem,itemTagBasic) self._nextItem = cc.MenuItemImage:create(s_pPathF1, s_pPathF2) - menu:addChild(self._nextItem,itemTagBasic) + menu:addChild(self._nextItem,itemTagBasic) self._nextItem:registerScriptTapHandler(self.nextCallback) - - local size = cc.Director:getInstance():getWinSize() + + local size = cc.Director:getInstance():getWinSize() self._backItem:setPosition(cc.p(size.width / 2 - self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2)) self._restarItem:setPosition(cc.p(size.width / 2, self._restarItem:getContentSize().height / 2)) self._nextItem:setPosition(cc.p(size.width / 2 + self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2)) - + menu:setPosition(cc.p(0, 0)) self:addChild(menu) @@ -181,7 +181,7 @@ function ArmatureTestLayer.toExtensionMenu() end end -function ArmatureTestLayer:createToExtensionMenu() +function ArmatureTestLayer:createToExtensionMenu() cc.MenuItemFont:setFontName("Arial") cc.MenuItemFont:setFontSize(24) local menuItemFont = cc.MenuItemFont:create("Back") @@ -279,7 +279,7 @@ function TestAsynchronousLoading.create() layer:createMenu() layer:createToExtensionMenu() layer:onEnter() - end + end return layer end @@ -313,7 +313,7 @@ function TestDirectLoading.create() layer:createToExtensionMenu() layer:onEnter() layer:creatTitleAndSubTitle(armatureSceneIdx) - end + end return layer end @@ -348,7 +348,7 @@ function TestCSWithSkeleton.create() layer:createToExtensionMenu() layer:onEnter() layer:creatTitleAndSubTitle(armatureSceneIdx) - end + end return layer end @@ -366,7 +366,7 @@ function TestDragonBones20.extend(target) return target end -function TestDragonBones20:onEnter() +function TestDragonBones20:onEnter() local armature = ccs.Armature:create("Dragon") armature:getAnimation():playByIndex(1) armature:getAnimation():setSpeedScale(0.4) @@ -383,8 +383,8 @@ function TestDragonBones20.create() layer:createToExtensionMenu() layer:onEnter() layer:creatTitleAndSubTitle(armatureSceneIdx) - end - return layer + end + return layer end local TestPerformance = class("TestPerformance",ArmatureTestLayer) @@ -405,7 +405,7 @@ function TestPerformance.extend(target) return target end -function TestPerformance:refreshTitile() +function TestPerformance:refreshTitle() local subTitleInfo = ArmatureTestLayer.subTitle(5) .. self._armatureCount local label = tolua.cast(self:getChildByTag(10001),"LabelTTF") label:setString(subTitleInfo) @@ -429,7 +429,7 @@ function TestPerformance:addArmature(num) self:addArmatureToParent(armature) end - self:refreshTitile() + self:refreshTitle() end function TestPerformance:onEnter() @@ -446,7 +446,7 @@ function TestPerformance:onEnter() for i = 1, 20 do self:removeArmatureFromParent(armaturePerformanceTag + self._armatureCount) self._armatureCount = self._armatureCount - 1 - self:refreshTitile() + self:refreshTitle() end end @@ -458,7 +458,7 @@ function TestPerformance:onEnter() local increase = cc.MenuItemFont:create(" + ") increase:setColor(cc.c3b(0,200,20)) increase:registerScriptTapHandler(onIncrease) - + local menu = cc.Menu:create(decrease, increase ) menu:alignItemsHorizontally() menu:setPosition(cc.p(VisibleRect:getVisibleRect().width/2, VisibleRect:getVisibleRect().height-100)) @@ -481,8 +481,8 @@ function TestPerformance.create() layer:createToExtensionMenu() layer:creatTitleAndSubTitle(armatureSceneIdx) layer:onEnter() - end - return layer + end + return layer end local TestPerformanceBatchNode = class("TestPerformanceBatchNode",TestPerformance) @@ -507,7 +507,7 @@ function TestPerformanceBatchNode:removeArmatureFromParent(tag) self._batchNode:removeChildByTag(armaturePerformanceTag + self._armatureCount, true) end -function TestPerformanceBatchNode:onEnter() +function TestPerformanceBatchNode:onEnter() self._batchNode = ccs.BatchNode:create() self:addChild(self._batchNode) @@ -523,7 +523,7 @@ function TestPerformanceBatchNode:onEnter() for i = 1, 20 do self:removeArmatureFromParent(armaturePerformanceTag + self._armatureCount) self._armatureCount = self._armatureCount - 1 - self:refreshTitile() + self:refreshTitle() end end @@ -535,7 +535,7 @@ function TestPerformanceBatchNode:onEnter() local increase = cc.MenuItemFont:create(" + ") increase:setColor(cc.c3b(0,200,20)) increase:registerScriptTapHandler(onIncrease) - + local menu = cc.Menu:create(decrease, increase ) menu:alignItemsHorizontally() menu:setPosition(cc.p(VisibleRect:getVisibleRect().width/2, VisibleRect:getVisibleRect().height-100)) @@ -558,8 +558,8 @@ function TestPerformanceBatchNode.create() layer:createToExtensionMenu() layer:creatTitleAndSubTitle(armatureSceneIdx) layer:onEnter() - end - return layer + end + return layer end local TestChangeZorder = class("TestChangeZorder",ArmatureTestLayer) @@ -576,7 +576,7 @@ function TestChangeZorder.extend(target) return target end -function TestChangeZorder:onEnter() +function TestChangeZorder:onEnter() self.currentTag = -1 local armature = ccs.Armature:create("Knight_f/Knight") @@ -617,8 +617,8 @@ function TestChangeZorder.create() layer:createToExtensionMenu() layer:onEnter() layer:creatTitleAndSubTitle(armatureSceneIdx) - end - return layer + end + return layer end --UNDO callback @@ -635,7 +635,7 @@ function TestAnimationEvent.extend(target) return target end -function TestAnimationEvent:onEnter() +function TestAnimationEvent:onEnter() local armature = ccs.Armature:create("Cowboy") armature:getAnimation():play("Fire") armature:setScaleX(-0.24) @@ -682,8 +682,8 @@ function TestAnimationEvent.create() layer:createToExtensionMenu() layer:onEnter() layer:creatTitleAndSubTitle(armatureSceneIdx) - end - return layer + end + return layer end local TestFrameEvent = class("TestFrameEvent",ArmatureTestLayer) @@ -699,7 +699,7 @@ function TestFrameEvent.extend(target) return target end -function TestFrameEvent:onEnter() +function TestFrameEvent:onEnter() local armature = ccs.Armature:create("HeroAnimation") armature:getAnimation():play("attack") armature:getAnimation():setSpeedScale(0.5) @@ -708,7 +708,7 @@ function TestFrameEvent:onEnter() local function onFrameEvent( bone,evt,originFrameIndex,currentFrameIndex) if (not self:getActionByTag(frameEventActionTag)) or (not self:getActionByTag(frameEventActionTag):isDone()) then self:stopAllActions() - local action = cc.ShatteredTiles3D:create(0.2, cc.size(16,12), 5, false) + local action = cc.ShatteredTiles3D:create(0.2, cc.size(16,12), 5, false) action:setTag(frameEventActionTag) self:runAction(action) end @@ -741,8 +741,8 @@ function TestFrameEvent.create() layer:createToExtensionMenu() layer:creatTitleAndSubTitle(armatureSceneIdx) layer:onEnter() - end - return layer + end + return layer end local TestParticleDisplay = class("TestParticleDisplay",ArmatureTestLayer) @@ -760,8 +760,8 @@ function TestParticleDisplay.extend(target) return target end -function TestParticleDisplay:onEnter() - self:setTouchEnabled(true) +function TestParticleDisplay:onEnter() + self:setTouchEnabled(true) self.animationID = 0 self.armature = ccs.Armature:create("robot") @@ -780,7 +780,7 @@ function TestParticleDisplay:onEnter() bone:setZOrder(100) bone:setScale(1.2) self.armature:addBone(bone, "bady-a3") - + bone = ccs.Bone:create("p2") bone:addDisplay(p2, 0) bone:changeDisplayByIndex(0, true) @@ -812,9 +812,9 @@ function TestParticleDisplay.create() layer:createToExtensionMenu() layer:onEnter() layer:creatTitleAndSubTitle(armatureSceneIdx) - end + end - return layer + return layer end local TestUseMutiplePicture = class("TestUseMutiplePicture",ArmatureTestLayer) @@ -832,8 +832,8 @@ function TestUseMutiplePicture.extend(target) return target end -function TestUseMutiplePicture:onEnter() - self:setTouchEnabled(true) +function TestUseMutiplePicture:onEnter() + self:setTouchEnabled(true) self.displayIndex = 1 self.armature = ccs.Armature:create("Knight_f/Knight") @@ -842,14 +842,14 @@ function TestUseMutiplePicture:onEnter() self.armature:setScale(1.2) self:addChild(self.armature) - local weapon = + local weapon = { - "weapon_f-sword.png", - "weapon_f-sword2.png", - "weapon_f-sword3.png", - "weapon_f-sword4.png", - "weapon_f-sword5.png", - "weapon_f-knife.png", + "weapon_f-sword.png", + "weapon_f-sword2.png", + "weapon_f-sword3.png", + "weapon_f-sword4.png", + "weapon_f-sword5.png", + "weapon_f-knife.png", "weapon_f-hammer.png", } @@ -882,9 +882,9 @@ function TestUseMutiplePicture.create() layer:createToExtensionMenu() layer:onEnter() layer:creatTitleAndSubTitle(armatureSceneIdx) - end + end - return layer + return layer end local TestAnchorPoint = class("TestAnchorPoint",ArmatureTestLayer) @@ -925,7 +925,7 @@ function TestAnchorPoint.create() layer:createToExtensionMenu() layer:onEnter() layer:creatTitleAndSubTitle(armatureSceneIdx) - end + end return layer end @@ -946,7 +946,7 @@ function TestArmatureNesting.extend(target) end function TestArmatureNesting:onEnter() - self:setTouchEnabled(true) + self:setTouchEnabled(true) self.weaponIndex = 0 self.armature = ccs.Armature:create("cyborg") @@ -980,9 +980,9 @@ function TestArmatureNesting.create() layer:createToExtensionMenu() layer:onEnter() layer:creatTitleAndSubTitle(armatureSceneIdx) - end + end - return layer + return layer end local Hero = class("Hero") @@ -1140,9 +1140,9 @@ function TestArmatureNesting2.create() layer:createToExtensionMenu() layer:creatTitleAndSubTitle(armatureSceneIdx) layer:onEnter() - end + end - return layer + return layer end @@ -1173,7 +1173,7 @@ function nextArmatureTest() return armatureSceneArr[armatureSceneIdx]() end -function backArmatureTest() +function backArmatureTest() armatureSceneIdx = armatureSceneIdx - 1 if armatureSceneIdx <= 0 then armatureSceneIdx = armatureSceneIdx + table.getn(armatureSceneArr) @@ -1187,7 +1187,7 @@ function restartArmatureTest() end local function addFileInfo() - + end function runArmatureTestScene() diff --git a/samples/Lua/TestLua/Resources/luaScript/ParticleTest/ParticleTest.lua b/samples/Lua/TestLua/Resources/luaScript/ParticleTest/ParticleTest.lua index 8b4dca5692..f0a9c1ae7c 100644 --- a/samples/Lua/TestLua/Resources/luaScript/ParticleTest/ParticleTest.lua +++ b/samples/Lua/TestLua/Resources/luaScript/ParticleTest/ParticleTest.lua @@ -330,7 +330,7 @@ local function ParticleBatchHybrid() layer:registerScriptHandler(ParticleBatchHybrid_onEnterOrExit) - titleLabel:setString("Paticle Batch") + titleLabel:setString("Particle Batch") subtitleLabel:setString("Hybrid: batched and non batched every 2 seconds") return layer end @@ -364,7 +364,7 @@ local function ParticleBatchMultipleEmitters() layer:addChild(batch, 10) - titleLabel:setString("Paticle Batch") + titleLabel:setString("Particle Batch") subtitleLabel:setString("Multiple emitters. One Batch") return layer end @@ -900,7 +900,7 @@ local function RadiusMode1() emitter:setTexture(cc.TextureCache:getInstance():addImage("Images/stars-grayscale.png")) -- duration - emitter:setDuration(cc.PARTICLE_DURATION_INFINITY) + emitter:setDuration(cc.PARTICLE_DURATION_INFINITY) -- radius mode emitter:setEmitterMode(cc.PARTICLE_MODE_RADIUS)