issue #171, modify object-c code in annotate.

This commit is contained in:
Walzer 2010-09-28 04:14:12 +00:00
parent 569ac8d1eb
commit 01eb8da314
16 changed files with 98 additions and 98 deletions

View File

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

View File

@ -124,8 +124,11 @@ class CCX_DLL CCNode : public SelectorProtocol, public NSObject
/** The rotation (angle) of the node in degrees. 0 is the default rotation angle. Positive values rotate node CW. */
CCX_PROPERTY(float, m_fRotation, Rotation)
/** The scale factor of the node. 1.0 is the default scale factor. It modifies the X and Y scale at the same time. */
/** Get the scale factor of the node.
@warning: Assert when m_fScaleX != m_fScaleY.
*/
float getScale();
/** The scale factor of the node. 1.0 is the default scale factor. It modifies the X and Y scale at the same time. */
void setScale(float scale);
/** The scale factor of the node. 1.0 is the default scale factor. It only modifies the X scale factor. */

View File

@ -35,7 +35,7 @@ namespace cocos2d {
* This uses a 3DAction so it's strongly recommended that depth buffering
* is turned on in CCDirector using:
*
* [[CCDirector sharedDirector] setDepthBufferFormat:kDepthBuffer16];
* CCDirector::getSharedDirector()->setDepthBufferFormat(kDepthBuffer16);
*
* @since v0.8.2
*/

View File

@ -331,7 +331,7 @@ namespace cocos2d {
*/
CCX_PROPERTY(tCCPositionType, m_ePositionType, PositionType)
/** whether or not the node will be auto-removed when it has no particles left.
By default it is NO.
By default it is false.
@since v0.8
*/
CCX_PROPERTY(bool, m_bIsAutoRemoveOnFinish, IsAutoRemoveOnFinish)
@ -383,6 +383,9 @@ namespace cocos2d {
virtual void update(ccTime dt);
private:
/** Private method, return the string found by key in dict.
@return "" if not found; return the string if found.
*/
inline const char * valueForKey(const char *key, NSDictionary<std::string, NSObject*> *dict)
{
if (dict)

View File

@ -35,8 +35,8 @@ namespace cocos2d {
class CCX_DLL CCRadialCCWTransition : public CCTransitionScene
{
public:
CCRadialCCWTransition();
virtual ~CCRadialCCWTransition();
CCRadialCCWTransition(){}
virtual ~CCRadialCCWTransition(){}
virtual void onEnter();
virtual void onExit();
@ -54,8 +54,8 @@ protected:
class CCX_DLL CCRadialCWTransition : public CCRadialCCWTransition
{
public:
// CCRadialCWTransition();
// virtual ~CCRadialCWTransition();
CCRadialCWTransition(){}
virtual ~CCRadialCWTransition(){}
static CCRadialCWTransition* transitionWithDuration(ccTime t, CCScene* scene);
protected:

View File

@ -56,7 +56,7 @@ namespace cocos2d {
bool initWithWidthAndHeight(int width, int height);
void begin();
void end();
/* get buffer as UIImage */
/** get buffer as UIImage */
UIImage *getUIImageFromBuffer();
/** saves the texture into a file */
bool saveBuffer(const char *name);

View File

@ -82,7 +82,7 @@ namespace cocos2d {
/** dealloc the map that contains the tile position from memory.
Unless you want to know at runtime the tiles positions, you can safely call this method.
If you are going to call [layer tileGIDAt:] then, don't release the map
If you are going to call layer->tileGIDAt() then, don't release the map
*/
void releaseMap();
@ -90,14 +90,14 @@ namespace cocos2d {
The returned CCSprite will be already added to the CCTMXLayer. Don't add it again.
The CCSprite can be treated like any other CCSprite: rotated, scaled, translated, opacity, color, etc.
You can remove either by calling:
- [layer removeChild:sprite cleanup:cleanup];
- or [layer removeTileAt:ccp(x,y)];
- layer->removeChild(sprite, cleanup);
- or layer->removeTileAt(ccp(x,y));
*/
CCSprite* tileAt(CGPoint tileCoordinate);
/** returns the tile gid at a given tile coordinate.
if it returns 0, it means that the tile is empty.
This method requires the the tile map has not been previously released (eg. don't call [layer releaseMap])
This method requires the the tile map has not been previously released (eg. don't call layer->releaseMap())
*/
unsigned int tileGIDAt(CGPoint tileCoordinate);
@ -120,7 +120,7 @@ namespace cocos2d {
void setupTiles();
/** CCTMXLayer doesn't support adding a CCSprite manually.
@warning addchild:z:tag: is not supported on CCTMXLayer. Instead of setTileGID:at:/tileAt:
@warning addchild(z, tag); is not supported on CCTMXLayer. Instead of setTileGID.
*/
CCNode * addChild(CCNode * child, int zOrder, int tag);
// super method
@ -149,10 +149,10 @@ namespace cocos2d {
unsigned int atlasIndexForExistantZ(unsigned int z);
unsigned int atlasIndexForNewZ(int z);
protected:
/** name of the layer */
// name of the layer
std::string m_sLayerName;
unsigned char m_cOpacity; // TMX Layer supports opacity
// TMX Layer supports opacity
unsigned char m_cOpacity;
unsigned int m_uMinGID;
unsigned int m_uMaxGID;

View File

@ -55,7 +55,7 @@ namespace cocos2d {
Features:
- Each tile will be treated as an CCSprite
- The sprites are created on demand. They will be created only when you call "[layer tileAt:]"
- The sprites are created on demand. They will be created only when you call "layer->tileAt(position)"
- Each tile can be rotated / moved / scaled / tinted / "opacitied", since each tile is a CCSprite
- Tiles can be added/removed in runtime
- The z-order of the tiles can be modified in runtime
@ -79,22 +79,22 @@ namespace cocos2d {
Each layer is created using an CCTMXLayer (subclass of CCSpriteSheet). If you have 5 layers, then 5 CCTMXLayer will be created,
unless the layer visibility is off. In that case, the layer won't be created at all.
You can obtain the layers (CCTMXLayer objects) at runtime by:
- [map getChildByTag: tag_number]; // 0=1st layer, 1=2nd layer, 2=3rd layer, etc...
- [map layerNamed: name_of_the_layer];
- map->getChildByTag(tag_number); // 0=1st layer, 1=2nd layer, 2=3rd layer, etc...
- map->layerNamed(name_of_the_layer);
Each object group is created using a CCTMXObjectGroup which is a subclass of NSMutableArray.
You can obtain the object groups at runtime by:
- [map objectGroupNamed: name_of_the_object_group];
- map->objectGroupNamed(name_of_the_object_group);
Each object is a CCTMXObject.
Each property is stored as a key-value pair in an NSMutableDictionary.
You can obtain the properties at runtime by:
[map propertyNamed: name_of_the_property];
[layer propertyNamed: name_of_the_property];
[objectGroup propertyNamed: name_of_the_property];
[object propertyNamed: name_of_the_property];
map->propertyNamed(name_of_the_property);
layer->propertyNamed(name_of_the_property);
objectGroup->propertyNamed(name_of_the_property);
object->propertyNamed(name_of_the_property);
@since v0.8.1
*/

View File

@ -37,7 +37,6 @@ namespace cocos2d {
*
*/
enum {
TMXLayerAttribNone = 1 << 0,
TMXLayerAttribBase64 = 1 << 1,
@ -123,27 +122,27 @@ namespace cocos2d {
class CCX_DLL CCTMXMapInfo : public NSObject
{
public:
// map orientation
/// map orientation
CCX_SYNTHESIZE(int, m_nOrientation, Orientation);
// map width & height
/// map width & height
CCX_SYNTHESIZE(CGSize, m_tMapSize, MapSize);
// tiles width & height
/// tiles width & height
CCX_SYNTHESIZE(CGSize, m_tTileSize, TileSize);
// Layers
/// Layers
CCX_PROPERTY(NSMutableArray<CCTMXLayerInfo*>*, m_pLayers, Layers);
// tilesets
/// tilesets
CCX_PROPERTY(NSMutableArray<CCTMXTilesetInfo*>*, m_pTilesets, Tilesets);
// ObjectGroups
/// ObjectGroups
CCX_PROPERTY(NSMutableArray<CCTMXObjectGroup*>*, m_pObjectGroups, ObjectGroups);
// parent element
/// parent element
CCX_SYNTHESIZE(int, m_nParentElement, ParentElement);
// parent GID
/// parent GID
CCX_SYNTHESIZE(unsigned int, m_uParentGID, ParentGID);
// layer attribs
/// layer attribs
CCX_SYNTHESIZE(int, m_nLayerAttribs, LayerAttribs);
// is stroing characters?
/// is stroing characters?
CCX_SYNTHESIZE(bool, m_bStoringCharacters, StoringCharacters);
// properties
/// properties
CCX_PROPERTY(CCXStringToStringDictionary*, m_pProperties, Properties);
public:
CCTMXMapInfo();
@ -152,7 +151,7 @@ namespace cocos2d {
static CCTMXMapInfo * formatWithTMXFile(const char *tmxFile);
/** initializes a TMX format witha tmx file */
bool initWithTMXFile(const char *tmxFile);
/* initalises parsing of an XML file, either a tmx (Map) file or tsx (Tileset) file */
/** initalises parsing of an XML file, either a tmx (Map) file or tsx (Tileset) file */
bool parseXMLFile(const char *xmlFilename);
NSDictionary<int, CCXStringToStringDictionary*> * getTileProperties();

View File

@ -188,6 +188,7 @@ public:
/** sets the default pixel format for UIImages that contains alpha channel.
If the UIImage contains alpha channel, then the options are:
- generate 32-bit textures: kCCTexture2DPixelFormat_RGBA8888 (default one)
- generate 24-bit textures: kCCTexture2DPixelFormat_RGB888
- generate 16-bit textures: kCCTexture2DPixelFormat_RGBA4444
- generate 16-bit textures: kCCTexture2DPixelFormat_RGB5A1
- generate 16-bit textures: kCCTexture2DPixelFormat_RGB565
@ -195,7 +196,7 @@ public:
How does it work ?
- 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)
- If the image is an RGB (without Alpha) then an RGB565 texture will be used (16-bit texture)
- If the image is an RGB (without Alpha) then an RGB565 or RGB888 texture will be used (16-bit texture)
@since v0.8
*/

View File

@ -49,7 +49,7 @@ protected:
NSLock *m_pContextLock;
private:
void addImageWithAsyncObject(CCAsyncObject* async);
// @todo void addImageWithAsyncObject(CCAsyncObject* async);
public:
@ -74,15 +74,15 @@ public:
*/
CCTexture2D* addImage(const char* fileimage);
/** Returns a Texture2D object given a file image
/* Returns a Texture2D object given a file image
* If the file image was not previously loaded, it will create a new CCTexture2D object and it will return it.
* 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.
* The callback will be called from the main thread, so it is safe to create any cocos2d object from the callback.
* Supported image extensions: .png, .bmp, .tiff, .jpeg, .pvr, .gif
* Supported image extensions: .png, .jpg
* @since v0.8
*/
/// @todo selector
void addImageAsync(const char* filename, NSObject*target, fpAsyncCallback func);
// @todo void addImageAsync(const char* filename, NSObject*target, fpAsyncCallback func);
#if _POWERVR_SUPPORT_
/** Returns a Texture2D object given an PVRTC RAW filename
@ -102,14 +102,14 @@ public:
CCTexture2D* addPVRTCImage(const char* fileimage);
#endif
/** Returns a Texture2D object given an CGImageRef image
/* Returns a Texture2D object given an CGImageRef image
* If the image was not previously loaded, it will create a new CCTexture2D object and it will return it.
* Otherwise it will return a reference of a previously loaded image
* The "key" parameter will be used as the "key" for the cache.
* If "key" is nil, then a new texture will be created each time.
* @since v0.8
*/
/// @todo CGImageRef CCTexture2D* addCGImage(CGImageRef image, string & key);
// @todo CGImageRef CCTexture2D* addCGImage(CGImageRef image, string & key);
/** Returns a Texture2D object given an UIImage image
* If the image was not previously loaded, it will create a new CCTexture2D object and it will return it.
* Otherwise it will return a reference of a previously loaded image

View File

@ -78,9 +78,9 @@ namespace cocos2d {
void updateAtlasValues();
protected:
/// x,y to altas dicctionary
// x,y to altas dicctionary
StringToIntegerDictionary *m_pPosToAtlasIndex;
/// numbers of tiles to render
// numbers of tiles to render
int m_nItemsToRender;
};

View File

@ -42,10 +42,10 @@ class CCNode;
*/
class CCX_DLL CCTransitionEaseScene// : public NSObject
{
public:
/** returns the Ease action that will be performed on a linear action.
@since v0.8.2
*/
public:
virtual CCIntervalAction * easeActionWithAction(CCIntervalAction * action) = 0;
};
@ -404,7 +404,7 @@ public:
virtual ~CCFadeTransition();
/** creates the transition with a duration and with an RGB color
* Example: [FadeTransition transitionWithDuration:2 scene:s withColor:ccc3(255,0,0)]; // red color
* Example: FadeTransition::transitionWithDuration(2, scene, ccc3(255,0,0); // red color
*/
static CCFadeTransition* transitionWithDuration(ccTime duration,CCScene* scene, ccColor3B color = ccBLACK);
/** initializes the transition with a duration and with an RGB color */

View File

@ -42,13 +42,6 @@ enum {
kSceneRadial = 0xc001,
};
CCRadialCCWTransition::CCRadialCCWTransition()
{
}
CCRadialCCWTransition::~CCRadialCCWTransition()
{
}
void CCRadialCCWTransition::sceneOrder()
{
m_bIsInSceneOnTop = false;

View File

@ -34,7 +34,7 @@ THE SOFTWARE.
#include "CCXFileUtils.h"
#include "CCXUIImage.h"
/// @todo EAGLContext static EAGLContext *auxEAGLcontext = NULL;
// @todo EAGLContext static EAGLContext *auxEAGLcontext = NULL;
namespace cocos2d {
class CCAsyncObject : NSObject
@ -82,7 +82,7 @@ CCTextureCache::~CCTextureCache()
CCX_SAFE_RELEASE(m_pTextures);
CCX_SAFE_DELETE(m_pDictLock);
CCX_SAFE_DELETE(m_pContextLock);
/// @todo release
// @todo release
// [auxEAGLcontext release];
// auxEAGLcontext = nil;
}
@ -102,9 +102,10 @@ char * CCTextureCache::description()
// TextureCache - Add Images
/* @todo EAGLContext
void CCTextureCache::addImageWithAsyncObject(CCAsyncObject* async)
{
/** @todo EAGLContext
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
// textures will be created on the main OpenGL context
@ -134,43 +135,43 @@ sharegroup:[[[[CCDirector sharedDirector] openGLView] context] sharegroup]];
}
[contextLock unlock];
[autoreleasepool release];*/
}
[autoreleasepool release];
}*/
/** @todo selector, NSThread*/
/* @todo selector, NSThread
void CCTextureCache::addImageAsync(const char* filename, NSObject *target, fpAsyncCallback func)
{
NSAssert(filename != NULL , "TextureCache: fileimage MUST not be nill");
// optimization
// CCTexture2D * tex;
//
// if ( (tex = m_pTextures->objectForKey(filename)) )
CCTexture2D * tex;
// {
if ( (tex = m_pTextures->objectForKey(filename)) )
// target->
{
// }
target->
//
// if( (tex=[textures objectForKey: filename] ) ) {
// [target performSelector:selector withObject:tex];
// return;
// }
//
// // schedule the load
//
// CCAsyncObject *asyncObject = [[CCAsyncObject alloc] init];
// asyncObject.selector = selector;
// asyncObject.target = target;
// asyncObject.data = filename;
//
// [NSThread detachNewThreadSelector:@selector(addImageWithAsyncObject:) toTarget:self withObject:asyncObject];
// [asyncObject release];
}
if( (tex=[textures objectForKey: filename] ) ) {
[target performSelector:selector withObject:tex];
return;
}
// schedule the load
CCAsyncObject *asyncObject = [[CCAsyncObject alloc] init];
asyncObject.selector = selector;
asyncObject.target = target;
asyncObject.data = filename;
[NSThread detachNewThreadSelector:@selector(addImageWithAsyncObject:) toTarget:self withObject:asyncObject];
[asyncObject release];
}*/
CCTexture2D * CCTextureCache::addImage(const char * path)
{
NSAssert(path != NULL, "TextureCache: fileimage MUST not be NULL");
@ -320,7 +321,7 @@ CCTexture2D * CCTextureCache::addPVRTCImage(const char* fileimage)
}
#endif
/** @todo CGImageRef
/* @todo CGImageRef
-(CCTexture2D*) addCGImage: (CGImageRef) imageref forKey: (string & )key
{
NSAssert(imageref != nil, @"TextureCache: image MUST not be nill");