Skip to content

Commit 921e719

Browse files
author
Ming
committed
1 parent 7837791 commit 921e719

17 files changed

+166
-119
lines changed

cocos2dx/include/CCAction.h

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ THE SOFTWARE.
2929
#include "NSObject.h"
3030
#include "NSZone.h"
3131
#include "CCNode.h"
32+
3233
namespace cocos2d {
3334

3435
enum {
@@ -55,39 +56,38 @@ class CCX_DLL CCAction : public NSObject
5556
//! called before the action start. It will also set the target.
5657
virtual void startWithTarget(CCNode *pTarget);
5758

58-
//! called after the action has finished. It will set the 'target' to nil.
59-
//! IMPORTANT: You should never call "[action stop]" manually. Instead, use: "[target stopAction:action];"
59+
/**
60+
called after the action has finished. It will set the 'target' to nil.
61+
IMPORTANT: You should never call "[action stop]" manually. Instead, use: "target->stopAction(action);"
62+
*/
6063
virtual void stop(void);
6164

6265
//! called every frame with it's delta time. DON'T override unless you know what you are doing.
6366
virtual void step(ccTime dt);
6467

65-
//! called once per frame. time a value between 0 and 1
66-
//! For example:
67-
//! * 0 means that the action just started
68-
//! * 0.5 means that the action is in the middle
69-
//! * 1 means that the action is over
68+
/**
69+
called once per frame. time a value between 0 and 1
70+
71+
For example:
72+
- 0 means that the action just started
73+
- 0.5 means that the action is in the middle
74+
- 1 means that the action is over
75+
*/
7076
virtual void update(ccTime time);
7177

7278
inline CCNode* getTarget(void) { return m_pTarget; }
73-
/** The "target". The action will modify the target properties.
74-
The target will be set with the 'startWithTarget' method.
75-
When the 'stop' method is called, target will be set to nil.
76-
The target is 'assigned', it is not 'retained'.
77-
*/
79+
/** The action will modify the target properties. */
7880
inline void setTarget(CCNode *pTarget) { m_pTarget = pTarget; }
7981

8082
inline CCNode* getOriginalTarget(void) { return m_pOriginalTarget; }
81-
/** The original target, since target can be nil.
83+
/** Set the original target, since target can be nil.
8284
Is the target that were used to run the action. Unless you are doing something complex, like ActionManager, you should NOT call this method.
8385
The target is 'assigned', it is not 'retained'.
8486
@since v0.8.2
8587
*/
8688
inline void setOriginalTarget(CCNode *pOriginalTarget) { m_pOriginalTarget = pOriginalTarget; }
8789

88-
/** The action tag. An identifier of the action */
8990
inline int getTag(void) { return m_nTag; }
90-
//! The tag is 'assigned', it is not 'retained'.
9191
inline void setTag(int nTag) { m_nTag = nTag; }
9292

9393
public:
@@ -96,7 +96,13 @@ class CCX_DLL CCAction : public NSObject
9696

9797
protected:
9898
CCNode *m_pOriginalTarget;
99+
/** The "target".
100+
The target will be set with the 'startWithTarget' method.
101+
When the 'stop' method is called, target will be set to nil.
102+
The target is 'assigned', it is not 'retained'.
103+
*/
99104
CCNode *m_pTarget;
105+
/** The action tag. An identifier of the action */
100106
int m_nTag;
101107
};
102108

@@ -114,8 +120,9 @@ class CCX_DLL CCFiniteTimeAction : public CCAction
114120
public:
115121
CCFiniteTimeAction(){}
116122
virtual ~CCFiniteTimeAction(){}
117-
//! duration in seconds of the action
123+
//! get duration in seconds of the action
118124
inline ccTime getDuration(void) { return m_fDuration; }
125+
//! set duration in seconds of the action
119126
inline void setDuration(ccTime duration) { m_fDuration = duration; }
120127

121128
/** returns a reversed action */
@@ -211,7 +218,7 @@ class CCX_DLL CCFollow : public CCAction
211218
// whether camera should be limited to certain area
212219
bool m_bBoundarySet;
213220

214-
// if screensize is bigger than the boundary - update not needed
221+
// if screen size is bigger than the boundary - update not needed
215222
bool m_bBoundaryFullyCovered;
216223

217224
// fast access to the screen dimensions

cocos2dx/include/CCActionManager.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ class CCX_DLL CCActionManager : public NSObject, public SelectorProtocol
5454

5555
// actions
5656

57-
/** Adds an action with a target.
57+
/** Adds an action with a target.
5858
If the target is already present, then the action will be added to the existing target.
59-
If the target is not present, a new instance of this target will be created either paused or paused, and the action will be added to the newly created target.
59+
If the target is not present, a new instance of this target will be created either paused or not, and the action will be added to the newly created target.
6060
When the target is paused, the queued actions won't be 'ticked'.
6161
*/
6262
void addAction(CCAction *pAction, CCNode *pTarget, bool paused);
6363

64-
/** Removes all actions from all the targers.
64+
/** Removes all actions from all the targets.
6565
*/
6666
void removeAllActions(void);
6767

@@ -82,10 +82,10 @@ class CCX_DLL CCActionManager : public NSObject, public SelectorProtocol
8282
*/
8383
CCAction* getActionByTag(int tag, NSObject *pTarget);
8484

85-
/** Returns the numbers of actions that are running in a certain target
85+
/** Returns the numbers of actions that are running in a certain target.
8686
* Composable actions are counted as 1 action. Example:
87-
* If you are running 1 Sequence of 7 actions, it will return 1.
88-
* If you are running 7 Sequences of 2 actions, it will return 7.
87+
* - If you are running 1 Sequence of 7 actions, it will return 1.
88+
* - If you are running 7 Sequences of 2 actions, it will return 7.
8989
*/
9090
int numberOfRunningActionsInTarget(NSObject *pTarget);
9191

cocos2dx/include/CCDirector.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ typedef enum {
105105
* Features and Limitations:
106106
* - Integrates OK with UIKit objects
107107
* - It the slowest director
108-
* - The invertal update is customizable from 1 to 60
108+
* - The interval update is customizable from 1 to 60
109109
*/
110110
kCCDirectorTypeNSTimer,
111111

112112
/** will use a Director that triggers the main loop from a custom main loop.
113113
*
114114
* Features and Limitations:
115115
* - Faster than NSTimer Director
116-
* - It doesn't integrate well with UIKit objecgts
116+
* - It doesn't integrate well with UIKit objects
117117
* - The interval update can't be customizable
118118
*/
119119
kCCDirectorTypeMainLoop,
@@ -122,7 +122,7 @@ typedef enum {
122122
*
123123
* Features and Limitations:
124124
* - Faster than NSTimer Director
125-
* - It doesn't integrate well with UIKit objecgts
125+
* - It doesn't integrate well with UIKit objects
126126
* - The interval update can't be customizable
127127
*/
128128
kCCDirectorTypeThreadMainLoop,
@@ -202,26 +202,26 @@ class CCX_DLL CCDirector : public NSObject
202202

203203
// attribute
204204

205-
/** The current running Scene. Director can only run one Scene at the time */
205+
/** Get current running Scene. Director can only run one Scene at the time */
206206
inline CCScene* getRunningScene(void) { return m_pRunningScene; }
207207

208-
/** The FPS value */
208+
/** Get the FPS value */
209209
inline double getAnimationInterval(void) { return m_dAnimationInterval; }
210+
/** Set the FPS value. Now it has not effect. */
210211
virtual void setAnimationInterval(double dValue);
211212

212213
/** Whether or not to display the FPS on the bottom-left corner */
213214
inline bool isDisplayFPS(void) { return m_bDisplayFPS; }
215+
/** Display the FPS on the bottom-left corner */
214216
inline void setDisplayFPS(bool bDisplayFPS) { m_bDisplayFPS = bDisplayFPS; }
215217

216-
/** The CCXEGLView, where everything is rendered */
218+
/** Get the CCXEGLView, where everything is rendered */
217219
inline cocos2d::CCXEGLView* getOpenGLView(void) { return m_pobOpenGLView; }
218220
void setOpenGLView(cocos2d::CCXEGLView *pobOpenGLView);
219221

220-
/** whether or not the next delta time will be zero */
221222
inline bool isNextDeltaTimeZero(void) { return m_bNextDeltaTimeZero; }
222223
void setNextDeltaTimeZero(bool bNextDeltaTimeZero);
223224

224-
/** The device orientation */
225225
inline ccDeviceOrientation getDeviceOrientation(void) { return m_eDeviceOrientation; }
226226
void setDeviceOrientation(ccDeviceOrientation kDeviceOrientation);
227227

@@ -435,6 +435,7 @@ class CCX_DLL CCDirector : public NSObject
435435
void recalculateProjectionAndEAGLViewSize();
436436

437437
protected:
438+
/* The CCXEGLView, where everything is rendered */
438439
cocos2d::CCXEGLView *m_pobOpenGLView;
439440

440441
double m_dAnimationInterval;
@@ -446,11 +447,10 @@ class CCX_DLL CCDirector : public NSObject
446447
/* landscape mode ? */
447448
bool m_bLandscape;
448449

449-
/* orientation */
450+
/* The device orientation */
450451
ccDeviceOrientation m_eDeviceOrientation;
451452

452-
/* display FPS ? */
453-
bool m_bDisplayFPS;
453+
bool m_bDisplayFPS;
454454
int m_nFrames;
455455
ccTime m_fAccumDt;
456456
ccTime m_fFrameRate;

cocos2dx/include/CCGrid3DAction.h

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,20 @@ namespace cocos2d
3434
class CCX_DLL CCWaves3D : public CCGrid3DAction
3535
{
3636
public:
37-
/** get amplitude of the wave */
3837
inline float getAmplitude(void) { return m_fAmplitude; }
39-
/** set amplitude of the wave */
4038
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
41-
/** get amplitude rate of the wave */
39+
4240
inline float getAmplitudeRate(void) { return m_fAmplitudeRate; }
43-
/** set amplitude rate of the wave */
4441
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
4542

43+
/** init the action */
4644
bool initWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
4745

4846
virtual NSObject* copyWithZone(NSZone* pZone);
4947
virtual void update(ccTime time);
5048

5149
public:
50+
/** create the action */
5251
static CCWaves3D* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
5352

5453
protected:
@@ -88,10 +87,11 @@ namespace cocos2d
8887
class CCX_DLL CCLens3D : public CCGrid3DAction
8988
{
9089
public:
91-
/** lens effect. Defaults to 0.7 - 0 means no effect, 1 is very strong effect */
90+
/** Get lens center position */
9291
inline float getLensEffect(void) { return m_fLensEffect; }
92+
/** Set lens center position */
9393
inline void setLensEffect(float fLensEffect) { m_fLensEffect = fLensEffect; }
94-
/** lens center position */
94+
9595
inline CGPoint getPosition(void) { return m_position; }
9696
inline void setPosition(CGPoint position) { m_position = position; }
9797

@@ -104,8 +104,10 @@ namespace cocos2d
104104
/** creates the action with center position, radius, a grid size and duration */
105105
static CCLens3D* actionWithPosition(CGPoint pos, float r, ccGridSize gridSize, ccTime duration);
106106
protected:
107+
/* lens center position */
107108
CGPoint m_position;
108109
float m_fRadius;
110+
/** lens effect. Defaults to 0.7 - 0 means no effect, 1 is very strong effect */
109111
float m_fLensEffect;
110112
CGPoint m_lastPosition;
111113
};
@@ -114,13 +116,14 @@ namespace cocos2d
114116
class CCX_DLL CCRipple3D : public CCGrid3DAction
115117
{
116118
public:
117-
/** center position */
119+
/** get center position */
118120
inline CGPoint getPosition(void) { return m_position; }
121+
/** set center position */
119122
inline void setPosition(CGPoint position) { m_position = position; }
120-
/** amplitude */
123+
121124
inline float getAmplitude(void) { return m_fAmplitude; }
122125
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
123-
/** amplitude rate */
126+
124127
inline float getAmplitudeRate(void) { return m_fAmplitudeRate; }
125128
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
126129

@@ -135,6 +138,7 @@ namespace cocos2d
135138
static CCRipple3D* actionWithPosition(CGPoint pos, float r, int wav, float amp,
136139
ccGridSize gridSize, ccTime duration);
137140
protected:
141+
/* center position */
138142
CGPoint m_position;
139143
float m_fRadius;
140144
int m_nWaves;
@@ -164,10 +168,9 @@ namespace cocos2d
164168
class CCX_DLL CCLiquid : public CCGrid3DAction
165169
{
166170
public:
167-
/** amplitude */
168171
inline float getAmplitude(void) { return m_fAmplitude; }
169172
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
170-
/** amplitude rate */
173+
171174
inline float getAmplitudeRate(void) { return m_fAmplitudeRate; }
172175
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
173176

@@ -190,10 +193,9 @@ namespace cocos2d
190193
class CCX_DLL CCWaves : public CCGrid3DAction
191194
{
192195
public:
193-
/** amplitude */
194196
inline float getAmplitude(void) { return m_fAmplitude; }
195197
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
196-
/** amplitude rate */
198+
197199
inline float getAmplitudeRate(void) { return m_fAmplitudeRate; }
198200
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
199201

@@ -219,13 +221,14 @@ namespace cocos2d
219221
class CCX_DLL CCTwirl : public CCGrid3DAction
220222
{
221223
public:
222-
/** twirl center */
224+
/** get twirl center */
223225
inline CGPoint getPosition(void) { return m_position; }
226+
/** set twirl center */
224227
inline void setPosition(CGPoint position) { m_position = position; }
225-
/** amplitude */
228+
226229
inline float getAmplitude(void) { return m_fAmplitude; }
227230
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
228-
/** amplitude rate */
231+
229232
inline float getAmplitudeRate(void) { return m_fAmplitudeRate; }
230233
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
231234

@@ -240,6 +243,7 @@ namespace cocos2d
240243
static CCTwirl* actionWithPosition(CGPoint pos, int t, float amp, ccGridSize gridSize,
241244
ccTime duration);
242245
protected:
246+
/* twirl center */
243247
CGPoint m_position;
244248
int m_nTwirls;
245249
float m_fAmplitude;

cocos2dx/include/CCGridAction.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ namespace cocos2d
104104
virtual void update(ccTime time);
105105
virtual CCIntervalAction* reverse(void);
106106

107-
/** amplitude rate */
107+
/** get amplitude rate */
108108
inline float getRate(void) { return m_fRate; }
109+
/** set amplitude rate */
109110
inline void setRate(float fRate) { m_fRate = fRate; }
110111

111112
public:
@@ -125,8 +126,9 @@ namespace cocos2d
125126
/** initializes the action with an inner action that has the amplitude property, and a duration time */
126127
bool initWithAction(CCAction *pAction, ccTime duration);
127128

128-
/** amplitude rate */
129+
/** get amplitude rate */
129130
inline float getRate(void) { return m_fRate; }
131+
/** set amplitude rate */
130132
inline void setRate(float fRate) { m_fRate = fRate; }
131133

132134
virtual void startWithTarget(CCNode *pTarget);
@@ -150,8 +152,9 @@ namespace cocos2d
150152
/** initializes the action with an inner action that has the amplitude property, and a duration time */
151153
bool initWithAction(CCAction *pAction, ccTime duration);
152154

153-
/** amplitude rate */
155+
/** get amplitude rate */
154156
inline float getRate(void) { return m_fRate; }
157+
/** set amplitude rate */
155158
inline void setRate(float fRate) { m_fRate = fRate; }
156159

157160
virtual void startWithTarget(CCNode *pTarget);

0 commit comments

Comments
 (0)