* Base SDK 4.1 or newer should be used.
Both Xcode 4 and Xcode 3 can be used with cocos2d.
With Xcode versions below 4.2.1 the compiler will generate warnings about '#pragma clang' statements. These can be safely commented out.
You can download cocos2d for iPhone v1.1 from here:
You can find the v1.0.1 documentation here:
To understand how fast cocos2d v1.1 beta is, please see the performance tests
IMPORTANT : If you notice an slowdown while loading JPG images, see Issue #886
A new file extension is used to load retina images for the iPad 3. The default one is '-ipadhd'. To change it use
[CCFileUtils setiPadRetinaDisplaySuffix:@"@2x~ipad"]; // Default on iPad RetinaDisplay is "-ipadhd"
+(void) setRetinaDisplaySuffix:(NSString*)suffix is now deprecated.
This ported format from 2.0 supports custom delay per frame and callbacks per frame. An example can be found in the sprite test.
Supports the new animation format. There are several playback modes, looping, looping starting with a certain frame, one time playing and displaying a random frame. One restriction, the offset of sprite frames isn't taken into account yet. The particle tests contain a example of this new functionality, as well as the new plist animation format.
This new implementation fixes many bugs, most notable trying to add/remove a touchhandler inside another touchhandler.
New features are:
choose which handlers process the touches first, standard or targeted
custom sorting with different algorithms, including using own comparator functions
new properties, 'tag', 'disable' and 'remove'. The
API accepts ranges of attribute values to manipulate the handlers.
The new implementation also has considerable performance improvements. Look at the TouchDispatcherPerformanceTest.m for various examples of the new functionality.
For the full list of changes and a performance test, look here
A batchnode that draws multiple particle systems in one draw call. The particle systems need to share the following same properties:
Most efficient setup:
//load the batchnode with a image file or texture
//to avoid memory reallocation, make sure the capacity is large enough to hold all particle systems
CCParticleBatchNode* batchNode = [CCParticleBatchNode particleBatchNodeWithFile:@"my_image.png" capacity:1000 useQuad:YES additiveBlending:NO];
for (int i = 0; i < 5 ; i++)
{
CCParticleSystemQuad* system = [CCParticleSystemQuad particleWithFile:plistFile batchNode:batchNode rect:CGRectMake(0.f,0.f,32.f,32.f)];
[batchNode addChild:system];
}
For more examples on how to use the particle batchnode, look into ParticlesTestBatched.m.
Look at the performance tests to see the performance improvements.
//schedules a selector that will run 2 times after 3.5 seconds with a interval of 1 second.
[CCScheduler sharedScheduler] scheduleSelector:@sel(aMethod) forTarget:self interval:1.f paused:NO repeat:2 delay:3.5f];
If you don't want to edit the ccConfig.h to enable/disable certain features of cocos2d, you can do it setting those settings as preprocessor macros.
Lets say that you want to enable NPOT support, then you can set the following macro in Xcode preprocessors macros:
CC_TEXTURE_NPOT_SUPPORT=1
Added support for “compressed interpolation”.
| CCLayerGradient WITHOUT compressed interpolation. End and Start colors are not visible. |
| CCLayerGradient WITH compressed interpolation. End and Start colors are visible. |
“Compressed Interpolation” creates a gradient with visible. start and end colors .
This feature is specially useful if you create vertical and/or horizontal gradients.
How to use it:
[gradientLayer setCompressedInterpolation:NO];
[gradientLayer setCompressedInterpolation:YES]; // default value
Added support for different line modes in CCLabelTTF
| Different line break modes |
Supported line break modes:
CCLineBreakModeWordWrap (default one)
CCLineBreakModeCharacterWrap (not supported on Mac)
CCLineBreakModeClip (not supported on Mac)
How to use it:
id label = [CCLabelTTF labelWithString:@"Hello World"
dimensions:CGSizeMake(s.width/4,40)
alignment:CCTextAlignmentCenter
lineBreakMode:CCLineBreakModeCharacterWrap
fontName:@"Marker Felt"
fontSize:16];
If you don't specify the linebreak mode, then it will use CCLineBreakModeWordWrap.
Added support for Touch events
It is possible to create a GL view programatically
LabelTTF alignment works as expected
Event Dispatchers works as expected
NSTimer can be executed
Templates works with Cocos Denshion
Added Xcode 4 templates both for Box2d and Chipmunk
Code is 64-bit friendly
Fullscreen reuses previous OpenGL view
Added support for skew transformations:
 | Horizontal Skew |
| Vertical Skew |
How to use it:
sprite.skewX = 45.0f;
[sprite2 setSkewY: 32];
Added also the CCSkewBy and CCSkewTo actions:
eg:
id actionTo = [CCSkewTo actionWithDuration:2 skewX:37.2f skewY:-37.2f];
id actionBy = [CCSkewBy actionWithDuration:2 skewX:0.0f skewY:-90.0f];
Added support for NPOT (Non Power of Two) PVR textures.
NPOT PVR textures support is built-in. You don't have to enable it on the ccConfig.h file.
NPOT Textures take less memory tan POT textures, but the can't have mipmaps, and they can't use GL_REPEAT.
Issue 1154
Add functionality for dumping CCTextureCache's texture list with VRAM memory estimates.
Example:
[[CCTextureCache sharedTextureCache] dumpCachedTextureInfo];
Example output:
Texture2dTest[28679:207] cocos2d: "r2.png" rc=2 id=13 64 x 64 @ 32 bpp => 16 KB
Texture2dTest[28679:207] cocos2d: "b1.png" rc=2 id=10 128 x 64 @ 32 bpp => 64 KB
Texture2dTest[28679:207] cocos2d: "f1.png" rc=2 id=14 128 x 64 @ 32 bpp => 64 KB
Texture2dTest[28679:207] cocos2d: "b2.png" rc=2 id=11 128 x 64 @ 32 bpp => 64 KB
Texture2dTest[28679:207] cocos2d: "f2.png" rc=2 id=15 128 x 64 @ 32 bpp => 64 KB
Texture2dTest[28679:207] cocos2d: "test_image.tiff" rc=3 id=2 128 x 128 @ 32 bpp => 64 KB
Texture2dTest[28679:207] cocos2d: "r1.png" rc=2 id=12 64 x 64 @ 32 bpp => 16 KB
Texture2dTest[28679:207] cocos2d: CCTextureCache dumpDebugInfo: 7 textures, for 352 KB (0.34 MB)
[NEW] v2.0 forward ported changes:
LabelBMFont: added setFntFile method
Animation: Added new animation format that supports delays per frame and notifications per frame
Actions: Added ActionTargeted action. Useful to target other nodes from a sequence.
[NEW] All: Code is compatible with ARC (issue #1199)
[NEW] ccFileUtiles: new iPad retina file extension (ipadhd)
[NEW] DrawPrimitives: Added new functions, ccDrawRect, ccDrawSolidRect, ccDrawSolidPoly
[NEW] DrawPrimitives: Added batch drawing of lines, ccDrawLines (issue #1081)
[NEW] Node: Added onExitTransitionDidStart (issue #792)
[NEW] ParticleSystem: supports animations in new animation format
[NEW] TileMap: supports in-memory TMX map creation (issue #1239)
[NEW] TileMap: Flipped tiles can be changed during runtime (issue #1264)
[NEW] Touchdispatcher: new implementation, supporting changing dispatchers based on (ranges) of properties, custom sorting and more (full list in online release notes)
[NEW] Types: Added convenience function to create a ccColor4F from color components
[FIX] Actions: incorrect behavior of CCRepeat
[FIX] CCLabelBMFont: full unicode support
[FIX] CCTMXXMLParser: removed unused variables in release mode
[FIX] ColorLayer: incorrect size in init method
[FIX] Director: 3d projection setting for iPad retina
[FIX] Denshion: Background music fades ok (issue #1304)
[FIX] EAGLView: always destroy and recreate OpenGL buffers completely (issue #1254)
[FIX] MenuItem: removed warning when deleting item
[FIX] Node: orderOfArrival is @synthezied correctly (issue #1273)
[FIX] Node & Sprite: Scale before Skew to prevent issues with negatives scales.
[FIX] ParticleSystem: prevent bursts of particles due to too high emitCounter (issue #1201)
[FIX] ParticleBatchNode: removeChild error and 'freezing' particles (issue #1316)
[FIX] ParticleBatchNode: memoryleak (issue #1306)
[FIX] ParticleSystem: CCParticleExamples on armv6 uses quad particle system by default, so CCParticleBatchNode can be used
[FIX] Sprite: fixed possible setColor and opacity
[FIX] Sprite: fixed adding premade sprite hierarchy to batchnode (issue #1217)
[FIX] TileMap: Fixed a problem with multiple layers and multiple tile sets that could cause TMX maps to not load if rotation is used (issue #1302)
[FIX] TouchDispatcher: correctly handles addition and removal of handlers when being inside a touch handler (issue #1084, #1139)
[FIX] TouchDispatcher: new implementation fixes multiple issues (issue #1173, #1267)
[FIX-MAC] LabelTTF: word wrap works on Mac (issue #1074)
[FIX-MAC] fix for failed to compile on 32-bit mac builds.
[NEW] Animation: Added file format. AnimationCache can load animations from file
[NEW] ccConfig: Removed CC_RETINA_DISPLAY_FILENAME_SUFFIX. Use CCFileUtils
API instead
[NEW] ccConfig: Removed CC_RETINA_DISPLAY_SUPPORT. It is always enabled.
[NEW] FileUtils: Added iPad / RetinaDisplay extension. (issue #1211)
[NEW] FileUtils: Added xxxFileExistAtPath for iPad and RetinaDisplay resources
[NEW] Node: improved speed when reordering nodes
[NEW] Particles: Added ParticleBatchNode (issue #955)
[NEW] Sprite: improved speed when reordering sprites
[NEW] Scheduler: Added support for delay and repeat (issue #630)
[NEW] Textures: Added support for RGB888 textures (issue #958)
[NEW] TileMap: TMX map supports flipped tiles (issue #1233)
[FIX] Actions: removed #undef CLAMP (issue #1210)
[FIX] Actions: Repeat & RepeatForEver work as expected(issue #1247)
[FIX] Actions: duration is not divided by zero (issue #615)
[FIX] Actions: Instant actions can be sequenceables (issue #1166)
[FIX] FileUtils: Loads -hd resources even if the sd resource is not present (issue #1179)
[FIX] FileUtils: renamed ccRemoveSuffixFromFile to +[CCFileUtils removeSuffixFromFile:];
[FIX] FileUtils: localized resources can be loaded using fullPathFromRelativePath (issue #1230)
[FIX] LayerColor: init calls initWithColor:width:height (issue #1226)
[FIX] Sprite: Debug draw fixed (issue #1069)
[FIX] SpriteBatchNode: removeAllChildrenWithCleanup works correctly (issue #1216)
[FIX] Texture2D: drawAtPoint uses the correct vertices
[FIX] Texture2D: drawAtPoint, drawInRect disables color state (issue #1222)
[FIX-MAC] Director: Only call set setAcceptsTouchEvents: when
OS X >= 10.6 (issue #1225)
[FIX] All: Implicit atomic properties converted to nonatomic
[FIX] All: Removed deprected code
[FIX] CCArray: copyWithZone fixed
[FIX] Director: frames → totalFrames, and it works as expected. Value is not being reset.
[FIX] Menu: If any ancestor is invisible, then touches won't be accepted
[FIX] Node: vertexZ returns points, not “pixels”
[FIX] LabelTTF: don't crash when calling description after dealloc
[FIX] Tests: [window release] instead of [window dealloc]
[FIX] Texture: TextureCache#dump reports the right info (issue #1205)
[FIX-MAC] CocosDenshion: Cleanup buffers to prevent noise
[NEW] ccpSegmentIntersect & ccpPointIntersect: Added helper functions for ccpLineIntersect (issue #1193)
[NEW] ccConfig: Added possibility to define the configuration as preprocessor macros
[NEW] Director: frames is a readonly property
[NEW] Menu: MenuItemFont can change size and font from instance (issue #1192)
[NEW] Scheduler: Added isTargetPaused method
[NEW] Sprite: Debugging draw for texture (issue #879)
[NEW] Textures: PVR supports NPOT textures
[FIX] CCArray: ForEach prepends “__” to inner variables to prevent conflict
[FIX] ccpLineIntersect works as expected. Improved performance (issue #1174, #1193)
[FIX] cocosLive: fixed memory leak in ScoreServerPost
[FIX] Director: Added asserts to prevent calling startAnimation twice.
[FIX] EAGLView: Fixed leak when using multisampling and resizing the layer (issue #1198)
[FIX] Menu: Column aligment is centered. Removed the +10 pixels padding.
[FIX] Node: Node#Draw calls super#draw
[FIX] Tests: Fixed memory leak in ParticleTest
[FIX] Tests: Fixed memory leak in cocosLiveTest
[FIX] Tiles: Worked around memory leak in NSXMLParser (issue #1197)
[FIX] TouchDispatcher: added setPriority (issue #757)
[FIX] Xcode: cocos2d compiles OK with Xcode 4.2 + llvm 3.0
[3RD] Chipmunk: updated to v5.3.5
[NEW] Actions: Added SkewTo and SkewBy actions
[NEW] LabelTTF: Added support for LineBreakMode. Mac only supports Word-Break.
[NEW] Node / Sprite: Added support for SkewX and SkewY properties
[NEW] Tests: Added skewX, skewY tests for sprites and actions. Added linebreak tests for LabelTTF.
[NEW] TextureCache: Added dumpCachedTextureInfo method. Shows the RAM used by the cached textures (issue #1154)
[FIX] cocosLive: Fixed memory leaks in NSURLConnection
[FIX] Sprites: DisplayedFrame returns the correct frame (issue #1182)
[FIX] Templates: Supports spaces in project name (issue #1158)
[FIX] TextureCache: Textures are autoreleased to prevent a crash in multi-threading environments
[FIX] TexturePVR: clean glError() before creating textures
[FIX] TMX Maps: Consume less memory (only what is needed), faster loading times (issue #1175)
[FIX-MAC] Tests: Added test case for issue #1071
[FIX-MAC] Director: Doesn't crash when entering fullscreen if window is not Key (issue #1185)
[NEW] CCArray: Added reduceMemoryFootprint and reverseObject (issue #1167)
[NEW] Director: Use small dt when the game is being debugged.
[NEW] Label: TTF supports new LA88 texture format instead of RGBA8888. A8 is still the default one.
[NEW] Particles: Added support for ParticleDesigner 1.3.60 (spinning support)
[NEW] Tests: Added test case for bug 1159
[FIX] Particles: TTL is always >= 0.
[FIX] Particles: texture coordinates are being used correctly when texture is NPOT.
[FIX] Scheduler: Fixed possible crash when unscheduling a sibling
[FIX] Templates: Use NS_BLOCK_ASSERTIONS and NDEBUG in Release Mode to remove asserts
[FIX] Templates: Xcode 3 templates fixed. Removed unused files in cocos2d lib. Added missing files from TouchJSON
[FIX] Templates: ARMv6 devices uses “none” autorotation to improve speed
[FIX] Templates: Added Xcode 4 “File” templates both for iOS and Mac
OS X
[FIX] Templates: Uses CFBundleIconFiles in Info.plist instead of “Icon Files” (issue #1151)
[FIX] Templates: Xcode 4 templates generates “sub groups”
[FIX] Templates: Xcode 4 Mac templates include CocosDenshion
[FIX] TextureAtlas: Render “static” VBO batches between 6~10 % faster (issue #1150)
[FIX-MAC] Templates: Generates by default an RGBA8 color buffer instead of an RGBA16
[NEW] Actions: Added the possibility to create a CCSpawn and CCSequence with an NSArray
[NEW] CCArray: Added exchangeObject & exchangeObjectAtIndex (issue #1085)
[NEW] Templates: Added Xcode4 templates for cocos2d, cocos2d+box2d, cocos2d+chipmunk both for iOS and Mac
OS X
[NEW] Templates: Possibility to run the installer from any directory
[NEW] Tests: Added DirectorTest
[NEW] Tests: Added Texture2d subtest for an unsupported PVR pixel format
[NEW] TextureAtlas: added possibility to draw the quads in parts
[FIX] All: Removed many deprecated methods and classes that were scheduled for removal on v1.0
[FIX] Actions: Instant, “base” actions, ReverseTime, Spawn and Sequence don't leak memory if actions are reused
[FIX] ccpLineIntersect: doesn't produce false positives for collisions (issue #962)
[FIX] Director: convertToUI works OK in RetinaDisplay mode
[FIX] Documentation: Drawing primitives fixed syntax error (issue #1127)
[FIX] Documentation: onExit doxystring improved (issue #1135)
[FIX] MenuItemToggle: Don't scale up if it is pressed several times (issue #948)
[FIX] ProgressTimer: fixed underflow in setPercentage() (issue #1123)
[FIX] RenderTexture: Only enable default GL states, without disabling them (mitigated issue #1145)
[FIX] StreakMotion: fixed flicker introduced in v0.99.x (issue #1075)
[FIX] Templates: Don't generate analyze warnings in Xcode4 (issue #1142)
[FIX] Xcode: TexturePVR compiles when using cocos2d as an external library (issue #1132)
[FIX] Xcode: Added SKIP_INSTALL=YES in libraries for Xcode4 (issue #1137)
[FIX-MAC] All: Code is 64-bit friendly. No more warnings when casting from 64 to 32 bits
[FIX-MAC] Director: Compiles in Mac when “slow” FPS are selected (issue #1126)
[FIX-MAC] Director: Fullscreen reuses the OpenGL view.
[3RD] FontLabel: Fixes issues with wrapping and apostraphes and hyphens (issue #1124)
[3RD] TouchJSON: Updated to “master” from March, 5 2011 (issue #1128)
[3RD] uthash / utlist: Updated to version 1.9.3
[NEW] Actions: Repeat and RepeatForEver has getter/setter for the inner action (issue #1110)
[NEW] LayerGradient: Added “compressed interpolation” (default mode) in order to display all graident's colors in any vector
[NEW-MAC] Added CC_DIRECTOR_INIT(). It is possible to create a Mac Window programatically
[NEW-MAC] EventDispatcher: Added support for touches events
[FIX] CocosDenshion: Improved logging
[FIX] CocosDenshion: Fixed excessively large or negative gain values cause distorted audio in the simulator.
[FIX] CocosDenshion: Added guards to prevent memory corruption caused by invalid parameters
[FIX] CocosDenshion: Define some constants for defaults, make const parameter on buffer asynch load method
[FIX] CCArray: insertObjectAtIndex checks bounds (issue #1121)
[FIX] Director: Fixed possible crash when purging the TextureCache
[FIX] Layer: Deprecated. CCMultiplexLayer deprecated. New name is CCLayerMultiplex
[FIX] Particles: consumes less memory (12 bytes less per particle) and are a bit faster
[FIX] ProgressTimer: Consumes less memory
[FIX] RenderTexture: Added possibility to save buffer in any place (issue #1100)
[FIX] RenderTexture: re-added getUIImageFromBuffer method. Supports RetinaDisplay
[FIX] Sprite: flipx/flipy don't modify the contentSize (issue #1073)
[FIX] SpriteFrame: setRect sets pixels too. setRectInPixels sets points too (issue #1088)
[FIX] Templates: ItunesArtwork renamed to iTunesArtwork (issue #1092)
[FIX] Templates: HelloWorld → HelloWorldLayer and other improvements (issue #873)
[FIX] TextureCache: asyncObject#dealloc uses CCLOGINFO instead of CCLOG (issue #1096)
[FIX] TiledMap: TMX maps work with zlib compression (Tiled v0.6)
[FIX-MAC] Director: runLoop enables NSTimers events (issue #1107)
[FIX-MAC] EventDispatcher: flagsChanged is triggered correctly (issue #1066)
[FIX-MAC] EventDispatcher: queue & dispatch events are synced (issue #1083)
[FIX-MAC] LabelTTF: alignment works OK (issue #1073)
[FIX-MAC] Menu: Menu doesn't hang up with invisible menus (issue #1070)
[FIX-MAC] Menu: Tracking “touches” works as expected (issue #1114)
[FIX-MAC] Templates includes AudioToolbox and OpenAL frameworks