Skip to content

Commit 75ad173

Browse files
author
Walzer
committed
issue cocos2d#171, modify object-c code in annotate.
1 parent 6454b6c commit 75ad173

16 files changed

+102
-102
lines changed

cocos2dx/include/CCLayer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ class CCX_DLL CCLayer : public CCNode, public CCTouchDelegate//, public UIAccele
5858

5959
/** If isTouchEnabled, this method is called onEnter. Override it to change the
6060
way CCLayer receives touch events.
61-
( Default: [[TouchDispatcher sharedDispatcher] addStandardDelegate:self priority:0] )
61+
( Default: CCTouchDispatcher::getSharedDispatcher()->addStandardDelegate(this,0); )
6262
Example:
63-
-(void) registerWithTouchDispatcher
63+
void CCLayer::registerWithTouchDispatcher()
6464
{
65-
[[TouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:INT_MIN+1 swallowsTouches:YES];
65+
CCTouchDispatcher::getSharedDispatcher()->addTargetedDelegate(this,INT_MIN+1,true);
6666
}
6767
@since v0.8.0
6868
*/

cocos2dx/include/CCNode.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,11 @@ class CCX_DLL CCNode : public SelectorProtocol, public NSObject
124124
/** The rotation (angle) of the node in degrees. 0 is the default rotation angle. Positive values rotate node CW. */
125125
CCX_PROPERTY(float, m_fRotation, Rotation)
126126

127-
/** The scale factor of the node. 1.0 is the default scale factor. It modifies the X and Y scale at the same time. */
127+
/** Get the scale factor of the node.
128+
@warning: Assert when m_fScaleX != m_fScaleY.
129+
*/
128130
float getScale();
131+
/** The scale factor of the node. 1.0 is the default scale factor. It modifies the X and Y scale at the same time. */
129132
void setScale(float scale);
130133

131134
/** The scale factor of the node. 1.0 is the default scale factor. It only modifies the X scale factor. */

cocos2dx/include/CCPageTurnTransition.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ namespace cocos2d {
3535
* This uses a 3DAction so it's strongly recommended that depth buffering
3636
* is turned on in CCDirector using:
3737
*
38-
* [[CCDirector sharedDirector] setDepthBufferFormat:kDepthBuffer16];
38+
* CCDirector::getSharedDirector()->setDepthBufferFormat(kDepthBuffer16);
3939
*
4040
* @since v0.8.2
4141
*/
4242
class CCX_DLL CCPageTurnTransition : public CCTransitionScene
4343
{
4444
protected:
4545
bool m_bBack;
46-
46+
4747
public:
4848
CCPageTurnTransition();
4949
virtual ~CCPageTurnTransition();

cocos2dx/include/CCParticleExamples.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ namespace cocos2d {
7070
}
7171
};
7272

73-
//! A sun particle system
73+
//! A sun particle system
7474
class CCX_DLL CCParticleSun : public CCQuadParticleSystem
7575
{
7676
public:
@@ -91,7 +91,7 @@ namespace cocos2d {
9191
}
9292
};
9393

94-
//! A galaxy particle system
94+
//! A galaxy particle system
9595
class CCX_DLL CCParticleGalaxy : public CCQuadParticleSystem
9696
{
9797
public:
@@ -112,7 +112,7 @@ namespace cocos2d {
112112
}
113113
};
114114

115-
//! A flower particle system
115+
//! A flower particle system
116116
class CCX_DLL CCParticleFlower : public CCQuadParticleSystem
117117
{
118118
public:
@@ -133,7 +133,7 @@ namespace cocos2d {
133133
}
134134
};
135135

136-
//! A meteor particle system
136+
//! A meteor particle system
137137
class CCX_DLL CCParticleMeteor : public CCQuadParticleSystem
138138
{
139139
public:
@@ -154,7 +154,7 @@ namespace cocos2d {
154154
}
155155
};
156156

157-
//! An spiral particle system
157+
//! An spiral particle system
158158
class CCX_DLL CCParticleSpiral : public CCQuadParticleSystem
159159
{
160160
public:
@@ -175,7 +175,7 @@ namespace cocos2d {
175175
}
176176
};
177177

178-
//! An explosion particle system
178+
//! An explosion particle system
179179
class CCX_DLL CCParticleExplosion : public CCQuadParticleSystem
180180
{
181181
public:
@@ -196,7 +196,7 @@ namespace cocos2d {
196196
}
197197
};
198198

199-
//! An smoke particle system
199+
//! An smoke particle system
200200
class CCX_DLL CCParticleSmoke : public CCQuadParticleSystem
201201
{
202202
public:
@@ -217,7 +217,7 @@ namespace cocos2d {
217217
}
218218
};
219219

220-
//! An snow particle system
220+
//! An snow particle system
221221
class CCX_DLL CCParticleSnow : public CCQuadParticleSystem
222222
{
223223
public:
@@ -238,7 +238,7 @@ namespace cocos2d {
238238
}
239239
};
240240

241-
//! A rain particle system
241+
//! A rain particle system
242242
class CCX_DLL CCParticleRain : public CCQuadParticleSystem
243243
{
244244
public:

cocos2dx/include/CCParticleSystem.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ namespace cocos2d {
331331
*/
332332
CCX_PROPERTY(tCCPositionType, m_ePositionType, PositionType)
333333
/** whether or not the node will be auto-removed when it has no particles left.
334-
By default it is NO.
334+
By default it is false.
335335
@since v0.8
336336
*/
337337
CCX_PROPERTY(bool, m_bIsAutoRemoveOnFinish, IsAutoRemoveOnFinish)
@@ -383,6 +383,9 @@ namespace cocos2d {
383383

384384
virtual void update(ccTime dt);
385385
private:
386+
/** Private method, return the string found by key in dict.
387+
@return "" if not found; return the string if found.
388+
*/
386389
inline const char * valueForKey(const char *key, NSDictionary<std::string, NSObject*> *dict)
387390
{
388391
if (dict)

cocos2dx/include/CCRadialTransition.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ namespace cocos2d {
3535
class CCX_DLL CCRadialCCWTransition : public CCTransitionScene
3636
{
3737
public:
38-
CCRadialCCWTransition();
39-
virtual ~CCRadialCCWTransition();
38+
CCRadialCCWTransition(){}
39+
virtual ~CCRadialCCWTransition(){}
4040

4141
virtual void onEnter();
4242
virtual void onExit();
@@ -54,8 +54,8 @@ class CCX_DLL CCRadialCCWTransition : public CCTransitionScene
5454
class CCX_DLL CCRadialCWTransition : public CCRadialCCWTransition
5555
{
5656
public:
57-
// CCRadialCWTransition();
58-
// virtual ~CCRadialCWTransition();
57+
CCRadialCWTransition(){}
58+
virtual ~CCRadialCWTransition(){}
5959
static CCRadialCWTransition* transitionWithDuration(ccTime t, CCScene* scene);
6060

6161
protected:

cocos2dx/include/CCRenderTexture.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace cocos2d {
5656
bool initWithWidthAndHeight(int width, int height);
5757
void begin();
5858
void end();
59-
/* get buffer as UIImage */
59+
/** get buffer as UIImage */
6060
UIImage *getUIImageFromBuffer();
6161
/** saves the texture into a file */
6262
bool saveBuffer(const char *name);

cocos2dx/include/CCTMXLayer.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,22 @@ namespace cocos2d {
8282

8383
/** dealloc the map that contains the tile position from memory.
8484
Unless you want to know at runtime the tiles positions, you can safely call this method.
85-
If you are going to call [layer tileGIDAt:] then, don't release the map
85+
If you are going to call layer->tileGIDAt() then, don't release the map
8686
*/
8787
void releaseMap();
8888

8989
/** returns the tile (CCSprite) at a given a tile coordinate.
9090
The returned CCSprite will be already added to the CCTMXLayer. Don't add it again.
9191
The CCSprite can be treated like any other CCSprite: rotated, scaled, translated, opacity, color, etc.
9292
You can remove either by calling:
93-
- [layer removeChild:sprite cleanup:cleanup];
94-
- or [layer removeTileAt:ccp(x,y)];
93+
- layer->removeChild(sprite, cleanup);
94+
- or layer->removeTileAt(ccp(x,y));
9595
*/
9696
CCSprite* tileAt(CGPoint tileCoordinate);
9797

9898
/** returns the tile gid at a given tile coordinate.
9999
if it returns 0, it means that the tile is empty.
100-
This method requires the the tile map has not been previously released (eg. don't call [layer releaseMap])
100+
This method requires the the tile map has not been previously released (eg. don't call layer->releaseMap())
101101
*/
102102
unsigned int tileGIDAt(CGPoint tileCoordinate);
103103

@@ -120,7 +120,7 @@ namespace cocos2d {
120120
void setupTiles();
121121

122122
/** CCTMXLayer doesn't support adding a CCSprite manually.
123-
@warning addchild:z:tag: is not supported on CCTMXLayer. Instead of setTileGID:at:/tileAt:
123+
@warning addchild(z, tag); is not supported on CCTMXLayer. Instead of setTileGID.
124124
*/
125125
CCNode * addChild(CCNode * child, int zOrder, int tag);
126126
// super method
@@ -149,10 +149,10 @@ namespace cocos2d {
149149
unsigned int atlasIndexForExistantZ(unsigned int z);
150150
unsigned int atlasIndexForNewZ(int z);
151151
protected:
152-
/** name of the layer */
152+
// name of the layer
153153
std::string m_sLayerName;
154-
155-
unsigned char m_cOpacity; // TMX Layer supports opacity
154+
// TMX Layer supports opacity
155+
unsigned char m_cOpacity;
156156

157157
unsigned int m_uMinGID;
158158
unsigned int m_uMaxGID;

cocos2dx/include/CCTMXTiledMap.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace cocos2d {
5555
5656
Features:
5757
- Each tile will be treated as an CCSprite
58-
- The sprites are created on demand. They will be created only when you call "[layer tileAt:]"
58+
- The sprites are created on demand. They will be created only when you call "layer->tileAt(position)"
5959
- Each tile can be rotated / moved / scaled / tinted / "opacitied", since each tile is a CCSprite
6060
- Tiles can be added/removed in runtime
6161
- The z-order of the tiles can be modified in runtime
@@ -79,22 +79,22 @@ namespace cocos2d {
7979
Each layer is created using an CCTMXLayer (subclass of CCSpriteSheet). If you have 5 layers, then 5 CCTMXLayer will be created,
8080
unless the layer visibility is off. In that case, the layer won't be created at all.
8181
You can obtain the layers (CCTMXLayer objects) at runtime by:
82-
- [map getChildByTag: tag_number]; // 0=1st layer, 1=2nd layer, 2=3rd layer, etc...
83-
- [map layerNamed: name_of_the_layer];
82+
- map->getChildByTag(tag_number); // 0=1st layer, 1=2nd layer, 2=3rd layer, etc...
83+
- map->layerNamed(name_of_the_layer);
8484
8585
Each object group is created using a CCTMXObjectGroup which is a subclass of NSMutableArray.
8686
You can obtain the object groups at runtime by:
87-
- [map objectGroupNamed: name_of_the_object_group];
87+
- map->objectGroupNamed(name_of_the_object_group);
8888
8989
Each object is a CCTMXObject.
9090
9191
Each property is stored as a key-value pair in an NSMutableDictionary.
9292
You can obtain the properties at runtime by:
9393
94-
[map propertyNamed: name_of_the_property];
95-
[layer propertyNamed: name_of_the_property];
96-
[objectGroup propertyNamed: name_of_the_property];
97-
[object propertyNamed: name_of_the_property];
94+
map->propertyNamed(name_of_the_property);
95+
layer->propertyNamed(name_of_the_property);
96+
objectGroup->propertyNamed(name_of_the_property);
97+
object->propertyNamed(name_of_the_property);
9898
9999
@since v0.8.1
100100
*/

cocos2dx/include/CCTMXXMLParser.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ namespace cocos2d {
3737
*
3838
*/
3939

40-
4140
enum {
4241
TMXLayerAttribNone = 1 << 0,
4342
TMXLayerAttribBase64 = 1 << 1,
@@ -123,27 +122,27 @@ namespace cocos2d {
123122
class CCX_DLL CCTMXMapInfo : public NSObject
124123
{
125124
public:
126-
// map orientation
125+
/// map orientation
127126
CCX_SYNTHESIZE(int, m_nOrientation, Orientation);
128-
// map width & height
127+
/// map width & height
129128
CCX_SYNTHESIZE(CGSize, m_tMapSize, MapSize);
130-
// tiles width & height
129+
/// tiles width & height
131130
CCX_SYNTHESIZE(CGSize, m_tTileSize, TileSize);
132-
// Layers
131+
/// Layers
133132
CCX_PROPERTY(NSMutableArray<CCTMXLayerInfo*>*, m_pLayers, Layers);
134-
// tilesets
133+
/// tilesets
135134
CCX_PROPERTY(NSMutableArray<CCTMXTilesetInfo*>*, m_pTilesets, Tilesets);
136-
// ObjectGroups
135+
/// ObjectGroups
137136
CCX_PROPERTY(NSMutableArray<CCTMXObjectGroup*>*, m_pObjectGroups, ObjectGroups);
138-
// parent element
137+
/// parent element
139138
CCX_SYNTHESIZE(int, m_nParentElement, ParentElement);
140-
// parent GID
139+
/// parent GID
141140
CCX_SYNTHESIZE(unsigned int, m_uParentGID, ParentGID);
142-
// layer attribs
141+
/// layer attribs
143142
CCX_SYNTHESIZE(int, m_nLayerAttribs, LayerAttribs);
144-
// is stroing characters?
143+
/// is stroing characters?
145144
CCX_SYNTHESIZE(bool, m_bStoringCharacters, StoringCharacters);
146-
// properties
145+
/// properties
147146
CCX_PROPERTY(CCXStringToStringDictionary*, m_pProperties, Properties);
148147
public:
149148
CCTMXMapInfo();
@@ -152,7 +151,7 @@ namespace cocos2d {
152151
static CCTMXMapInfo * formatWithTMXFile(const char *tmxFile);
153152
/** initializes a TMX format witha tmx file */
154153
bool initWithTMXFile(const char *tmxFile);
155-
/* initalises parsing of an XML file, either a tmx (Map) file or tsx (Tileset) file */
154+
/** initalises parsing of an XML file, either a tmx (Map) file or tsx (Tileset) file */
156155
bool parseXMLFile(const char *xmlFilename);
157156

158157
NSDictionary<int, CCXStringToStringDictionary*> * getTileProperties();

cocos2dx/include/CCTexture2D.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,15 @@ class CCX_DLL CCTexture2D : public NSObject
188188
/** sets the default pixel format for UIImages that contains alpha channel.
189189
If the UIImage contains alpha channel, then the options are:
190190
- generate 32-bit textures: kCCTexture2DPixelFormat_RGBA8888 (default one)
191+
- generate 24-bit textures: kCCTexture2DPixelFormat_RGB888
191192
- generate 16-bit textures: kCCTexture2DPixelFormat_RGBA4444
192193
- generate 16-bit textures: kCCTexture2DPixelFormat_RGB5A1
193194
- generate 16-bit textures: kCCTexture2DPixelFormat_RGB565
194195
- generate 8-bit textures: kCCTexture2DPixelFormat_A8 (only use it if you use just 1 color)
195196
196197
How does it work ?
197198
- If the image is an RGBA (with Alpha) then the default pixel format will be used (it can be a 8-bit, 16-bit or 32-bit texture)
198-
- If the image is an RGB (without Alpha) then an RGB565 texture will be used (16-bit texture)
199+
- If the image is an RGB (without Alpha) then an RGB565 or RGB888 texture will be used (16-bit texture)
199200
200201
@since v0.8
201202
*/

cocos2dx/include/CCTextureCache.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class CCX_DLL CCTextureCache : public NSObject
4949
NSLock *m_pContextLock;
5050

5151
private:
52-
void addImageWithAsyncObject(CCAsyncObject* async);
52+
// @todo void addImageWithAsyncObject(CCAsyncObject* async);
5353

5454
public:
5555

@@ -74,15 +74,15 @@ class CCX_DLL CCTextureCache : public NSObject
7474
*/
7575
CCTexture2D* addImage(const char* fileimage);
7676

77-
/** Returns a Texture2D object given a file image
77+
/* Returns a Texture2D object given a file image
7878
* If the file image was not previously loaded, it will create a new CCTexture2D object and it will return it.
7979
* Otherwise it will load a texture in a new thread, and when the image is loaded, the callback will be called with the Texture2D as a parameter.
8080
* The callback will be called from the main thread, so it is safe to create any cocos2d object from the callback.
81-
* Supported image extensions: .png, .bmp, .tiff, .jpeg, .pvr, .gif
81+
* Supported image extensions: .png, .jpg
8282
* @since v0.8
8383
*/
84-
/// @todo selector
85-
void addImageAsync(const char* filename, NSObject*target, fpAsyncCallback func);
84+
85+
// @todo void addImageAsync(const char* filename, NSObject*target, fpAsyncCallback func);
8686

8787
#if _POWERVR_SUPPORT_
8888
/** Returns a Texture2D object given an PVRTC RAW filename
@@ -102,14 +102,14 @@ class CCX_DLL CCTextureCache : public NSObject
102102
CCTexture2D* addPVRTCImage(const char* fileimage);
103103
#endif
104104

105-
/** Returns a Texture2D object given an CGImageRef image
105+
/* Returns a Texture2D object given an CGImageRef image
106106
* If the image was not previously loaded, it will create a new CCTexture2D object and it will return it.
107107
* Otherwise it will return a reference of a previously loaded image
108108
* The "key" parameter will be used as the "key" for the cache.
109109
* If "key" is nil, then a new texture will be created each time.
110110
* @since v0.8
111111
*/
112-
/// @todo CGImageRef CCTexture2D* addCGImage(CGImageRef image, string & key);
112+
// @todo CGImageRef CCTexture2D* addCGImage(CGImageRef image, string & key);
113113
/** Returns a Texture2D object given an UIImage image
114114
* If the image was not previously loaded, it will create a new CCTexture2D object and it will return it.
115115
* Otherwise it will return a reference of a previously loaded image

cocos2dx/include/CCTileMapAtlas.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ namespace cocos2d {
7878
void updateAtlasValues();
7979

8080
protected:
81-
/// x,y to altas dicctionary
81+
// x,y to altas dicctionary
8282
StringToIntegerDictionary *m_pPosToAtlasIndex;
83-
/// numbers of tiles to render
83+
// numbers of tiles to render
8484
int m_nItemsToRender;
8585
};
8686

0 commit comments

Comments
 (0)