Skip to content
Browse files

Merge branch 'develop' into reorderSprite

  • Loading branch information...
2 parents 992938f + 7c7f805 commit e4fdea1940b6072022690dcd7f63fdfd6ca3cff8 @ricardoquesada ricardoquesada committed Mar 1, 2011
Showing with 108 additions and 105 deletions.
  1. +6 −4 AUTHORS
  2. +3 −1 CHANGELOG
  3. +1 −10 CocosDenshion/CocosDenshion/CocosDenshion.m
  4. +3 −10 cocos2d/Support/CCArray.m
  5. +4 −4 templates/cocos2d_app/Classes/{HelloWorldScene.h → HelloWorldLayer.h}
  6. +7 −6 templates/{cocos2d_mac/Classes/HelloWorldScene.m → cocos2d_app/Classes/HelloWorldLayer.m}
  7. +2 −2 templates/cocos2d_app/Classes/___PROJECTNAMEASIDENTIFIER___AppDelegate.m
  8. +6 −6 templates/cocos2d_app/___PROJECTNAME___.xcodeproj/project.pbxproj
  9. +5 −6 templates/cocos2d_box2d_app/Classes/{HelloWorldScene.h → HelloWorldLayer.h}
  10. +9 −7 templates/cocos2d_box2d_app/Classes/{HelloWorldScene.mm → HelloWorldLayer.mm}
  11. +2 −2 templates/cocos2d_box2d_app/Classes/___PROJECTNAMEASIDENTIFIER___AppDelegate.mm
  12. +6 −6 templates/cocos2d_box2d_app/___PROJECTNAME___.xcodeproj/project.pbxproj
  13. +6 −5 templates/cocos2d_chipmunk_app/Classes/{HelloWorldScene.h → HelloWorldLayer.h}
  14. +21 −8 templates/cocos2d_chipmunk_app/Classes/{HelloWorldScene.m → HelloWorldLayer.m}
  15. +2 −2 templates/cocos2d_chipmunk_app/Classes/___PROJECTNAMEASIDENTIFIER___AppDelegate.m
  16. +6 −6 templates/cocos2d_chipmunk_app/___PROJECTNAME___.xcodeproj/project.pbxproj
  17. +4 −4 templates/cocos2d_mac/Classes/{HelloWorldScene.h → HelloWorldLayer.h}
  18. +7 −6 templates/{cocos2d_app/Classes/HelloWorldScene.m → cocos2d_mac/Classes/HelloWorldLayer.m}
  19. +2 −2 templates/cocos2d_mac/Classes/___PROJECTNAMEASIDENTIFIER___AppDelegate.m
  20. +6 −6 templates/cocos2d_mac/___PROJECTNAME___.xcodeproj/project.pbxproj
  21. +0 −2 tests/ActionsTest.m
View
10 AUTHORS
@@ -284,6 +284,7 @@ People/companies who were/are contributing code to cocos2d for iPhone (alphabeti
Added reorder node performance test
Added multisampling anti-aliasing support in EAGLView, ESRenderer
RenderTexture: getUIImageFromBuffer supports RetinaDisplay. patch.
+ CCArray: check for bounds in insertObjectAtIndex. patch.
* marcu.catalin:
Menu items are not consumed is items are not visible
* Mark Cooke:
@@ -337,6 +338,11 @@ People/companies who were/are contributing code to cocos2d for iPhone (alphabeti
Texture fails gracefully if PVR image can't be loaded (patch)
* Patrick Wolowicz:
mkatlas: added artifact removal by copying borders to margins
+ * Paul Hampson (TBBle) (http://blog.tbble.org/)
+ CCSpriteFrameCache textureFileName is relative to path
+ CCSprite: correctly overrides setIsRelativeAnchorPoint
+ libpng doesn't compile pngtest.c. patch.
+ Templates: HelloWorld -> HelloWorldLayer and other improvements. patch.
* Piero Tofy (http://indieappsalliance.org):
Web: Author of the scraper script used to parse games data in the cocos2d site
* Pieter van de Bruggen
@@ -427,10 +433,6 @@ People/companies who were/are contributing code to cocos2d for iPhone (alphabeti
Added ProfilingTimer: Director and Particles supports it when enabled
* svenito:
Fixed artifacts in PageTurnTransition
- * TBBle (http://blog.tbble.org/)
- CCSpriteFrameCache textureFileName is relative to path
- CCSprite: correctly overrides setIsRelativeAnchorPoint
- libpng doesn't compile pngtest.c. patch.
* TheArsenik:
added BezierTo action
* thoechsm:
View
4 CHANGELOG
@@ -1,4 +1,4 @@
-version 1.0-beta - XX-XXX-2011
+version 1.0-beta - 01-Mar-2011
. [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
@@ -7,6 +7,7 @@ version 1.0-beta - XX-XXX-2011
. [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
@@ -16,6 +17,7 @@ version 1.0-beta - XX-XXX-2011
. [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)
View
11 CocosDenshion/CocosDenshion/CocosDenshion.m
@@ -836,12 +836,7 @@ - (ALuint)playSound:(int) soundId sourceGroupId:(int)sourceGroupId pitch:(float)
#endif
return CD_MUTE;
}
-
-#if TARGET_IPHONE_SIMULATOR
- //Fix for issue reported by Walzer, prevents speaker destruction when running in simulator ;)
- gain = clampf(gain, 0.0f, 2.0f);
-#endif
-
+
int sourceIndex = [self _getSourceIndexForSourceGroup:sourceGroupId];//This method ensures sourceIndex is valid
if (sourceIndex != CD_NO_SOURCE) {
@@ -1076,10 +1071,6 @@ - (void) setPitch:(float) newPitchValue {
- (void) setGain:(float) newGainValue {
if (!mute_) {
-#if TARGET_IPHONE_SIMULATOR
- //Fix for issue reported by Walzer, prevents speaker destruction when running in simulator ;)
- gain = clampf(gain, 0.0f, 2.0f);
-#endif
alSourcef(_sourceId, AL_GAIN, newGainValue);
} else {
_preMuteGain = newGainValue;
View
13 cocos2d/Support/CCArray.m
@@ -81,8 +81,6 @@ - (id) initWithNSArray:(NSArray*)otherArray
return self;
}
-
-
- (id) initWithCoder:(NSCoder*)coder
{
self = [self initWithNSArray:[coder decodeObjectForKey:@"nsarray"]];
@@ -93,8 +91,6 @@ - (void)encodeWithCoder:(NSCoder *)coder
[coder encodeObject:[self getNSArray] forKey:@"nsarray"];
}
-
-
- (NSUInteger) count
{
return data->num;
@@ -112,9 +108,7 @@ - (NSUInteger) indexOfObject:(id)object
- (id) objectAtIndex:(NSUInteger)index
{
- if( index >= data->num )
- [NSException raise:NSRangeException
- format: @"index out of range in objectAtIndex(%d)", data->num ];
+ NSAssert2( index < data->num && index >= 0, @"index out of range in objectAtIndex(%d), index %i", data->num, index );
return data->arr[index];
}
@@ -166,9 +160,8 @@ - (void) insertObject:(id)object atIndex:(NSUInteger)index
- (void) removeLastObject
{
- if( data->num == 0 )
- [NSException raise:NSRangeException
- format: @"no objects added"];
+ NSAssert( data->num > 0, @"no objects added" );
+
ccArrayRemoveObjectAtIndex(data, data->num-1);
}
View
8 ...tes/cocos2d_app/Classes/HelloWorldScene.h → ...tes/cocos2d_app/Classes/HelloWorldLayer.h
@@ -10,12 +10,12 @@
// When you import this file, you import all the cocos2d classes
#import "cocos2d.h"
-// HelloWorld Layer
-@interface HelloWorld : CCLayer
+// HelloWorldLayer
+@interface HelloWorldLayer : CCLayer
{
}
-// returns a Scene that contains the HelloWorld as the only child
-+(id) scene;
+// returns a CCScene that contains the HelloWorldLayer as the only child
++(CCScene *) scene;
@end
View
13 ...tes/cocos2d_mac/Classes/HelloWorldScene.m → ...tes/cocos2d_app/Classes/HelloWorldLayer.m
@@ -6,19 +6,20 @@
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//
+
// Import the interfaces
-#import "HelloWorldScene.h"
+#import "HelloWorldLayer.h"
-// HelloWorld implementation
-@implementation HelloWorld
+// HelloWorldLayer implementation
+@implementation HelloWorldLayer
-+(id) scene
++(CCScene *) scene
{
// 'scene' is an autorelease object.
CCScene *scene = [CCScene node];
// 'layer' is an autorelease object.
- HelloWorld *layer = [HelloWorld node];
+ HelloWorldLayer *layer = [HelloWorldLayer node];
// add layer as a child to scene
[scene addChild: layer];
@@ -32,7 +33,7 @@ -(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
- if( (self=[super init] )) {
+ if( (self=[super init])) {
// create and initialize a Label
CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64];
View
4 templates/cocos2d_app/Classes/___PROJECTNAMEASIDENTIFIER___AppDelegate.m
@@ -10,7 +10,7 @@
#import "___PROJECTNAMEASIDENTIFIER___AppDelegate.h"
#import "GameConfig.h"
-#import "HelloWorldScene.h"
+#import "HelloWorldLayer.h"
#import "RootViewController.h"
@implementation ___PROJECTNAMEASIDENTIFIER___AppDelegate
@@ -110,7 +110,7 @@ - (void) applicationDidFinishLaunching:(UIApplication*)application
[self removeStartupFlicker];
// Run the intro Scene
- [[CCDirector sharedDirector] runWithScene: [HelloWorld scene]];
+ [[CCDirector sharedDirector] runWithScene: [HelloWorldLayer scene]];
}
View
12 templates/cocos2d_app/___PROJECTNAME___.xcodeproj/project.pbxproj
@@ -27,7 +27,7 @@
50674855107A3AF30090963A /* ZAttributedStringPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 50674852107A3AF30090963A /* ZAttributedStringPrivate.h */; };
506EDB88102F4C4000A389B3 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 506EDB87102F4C4000A389B3 /* libz.dylib */; };
506EDBA5102F4C9F00A389B3 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 506EDBA4102F4C9F00A389B3 /* AVFoundation.framework */; };
- 506EDC31102F528A00A389B3 /* HelloWorldScene.m in Sources */ = {isa = PBXBuildFile; fileRef = 506EDC30102F528A00A389B3 /* HelloWorldScene.m */; };
+ 506EDC31102F528A00A389B3 /* HelloWorldLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 506EDC30102F528A00A389B3 /* HelloWorldLayer.m */; };
506EE1A91030508200A389B3 /* libcocos2d libraries.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 506EE05E10304ED200A389B3 /* libcocos2d libraries.a */; };
507ED63C11C638C6002ED3FC /* CDAudioManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 507ED63311C638C6002ED3FC /* CDAudioManager.h */; };
507ED63D11C638C6002ED3FC /* CDAudioManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 507ED63411C638C6002ED3FC /* CDAudioManager.m */; };
@@ -276,8 +276,8 @@
50674852107A3AF30090963A /* ZAttributedStringPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZAttributedStringPrivate.h; sourceTree = "<group>"; };
506EDB87102F4C4000A389B3 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
506EDBA4102F4C9F00A389B3 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
- 506EDC2F102F528A00A389B3 /* HelloWorldScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloWorldScene.h; sourceTree = "<group>"; };
- 506EDC30102F528A00A389B3 /* HelloWorldScene.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HelloWorldScene.m; sourceTree = "<group>"; };
+ 506EDC2F102F528A00A389B3 /* HelloWorldLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloWorldLayer.h; sourceTree = "<group>"; };
+ 506EDC30102F528A00A389B3 /* HelloWorldLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HelloWorldLayer.m; sourceTree = "<group>"; };
506EE05E10304ED200A389B3 /* libcocos2d libraries.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libcocos2d libraries.a"; sourceTree = BUILT_PRODUCTS_DIR; };
507ED63311C638C6002ED3FC /* CDAudioManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDAudioManager.h; sourceTree = "<group>"; };
507ED63411C638C6002ED3FC /* CDAudioManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDAudioManager.m; sourceTree = "<group>"; };
@@ -588,8 +588,8 @@
isa = PBXGroup;
children = (
E0F80F5D120A0182005866B8 /* GameConfig.h */,
- 506EDC2F102F528A00A389B3 /* HelloWorldScene.h */,
- 506EDC30102F528A00A389B3 /* HelloWorldScene.m */,
+ 506EDC2F102F528A00A389B3 /* HelloWorldLayer.h */,
+ 506EDC30102F528A00A389B3 /* HelloWorldLayer.m */,
E0F80F5E120A0182005866B8 /* RootViewController.h */,
E0F80F5F120A0182005866B8 /* RootViewController.m */,
1F3B9A2C0EF2145700286867 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.h */,
@@ -1133,7 +1133,7 @@
files = (
1D60589B0D05DD56006BFB54 /* main.m in Sources */,
1F3B9A2D0EF2145700286867 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.m in Sources */,
- 506EDC31102F528A00A389B3 /* HelloWorldScene.m in Sources */,
+ 506EDC31102F528A00A389B3 /* HelloWorldLayer.m in Sources */,
E0F80F60120A0182005866B8 /* RootViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
View
11 ...cos2d_box2d_app/Classes/HelloWorldScene.h → ...cos2d_box2d_app/Classes/HelloWorldLayer.h
@@ -1,5 +1,5 @@
//
-// HelloWorldScene.h
+// HelloWorldLayer.h
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
@@ -12,16 +12,15 @@
#import "Box2D.h"
#import "GLES-Render.h"
-// HelloWorld Layer
-@interface HelloWorld : CCLayer
+// HelloWorldLayer
+@interface HelloWorldLayer : CCLayer
{
b2World* world;
GLESDebugDraw *m_debugDraw;
}
-// returns a Scene that contains the HelloWorld as the only child
-+(id) scene;
-
+// returns a CCScene that contains the HelloWorldLayer as the only child
++(CCScene *) scene;
// adds a new sprite at a given coordinate
-(void) addNewSpriteWithCoords:(CGPoint)p;
View
16 ...os2d_box2d_app/Classes/HelloWorldScene.mm → ...os2d_box2d_app/Classes/HelloWorldLayer.mm
@@ -1,5 +1,5 @@
//
-// HelloWorldScene.mm
+// HelloWorldLayer.mm
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
@@ -8,7 +8,7 @@
// Import the interfaces
-#import "HelloWorldScene.h"
+#import "HelloWorldLayer.h"
//Pixel to metres ratio. Box2D uses metres as the unit for measurement.
//This ratio defines how many pixels correspond to 1 Box2D "metre"
@@ -24,16 +24,16 @@
};
-// HelloWorld implementation
-@implementation HelloWorld
+// HelloWorldLayer implementation
+@implementation HelloWorldLayer
-+(id) scene
++(CCScene *) scene
{
// 'scene' is an autorelease object.
CCScene *scene = [CCScene node];
// 'layer' is an autorelease object.
- HelloWorld *layer = [HelloWorld node];
+ HelloWorldLayer *layer = [HelloWorldLayer node];
// add layer as a child to scene
[scene addChild: layer];
@@ -42,9 +42,11 @@ +(id) scene
return scene;
}
-// initialize your instance here
+// on "init" you need to initialize your instance
-(id) init
{
+ // always call "super" init
+ // Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {
// enable touches
View
4 templates/cocos2d_box2d_app/Classes/___PROJECTNAMEASIDENTIFIER___AppDelegate.mm
@@ -10,7 +10,7 @@
#import "___PROJECTNAMEASIDENTIFIER___AppDelegate.h"
#import "GameConfig.h"
-#import "HelloWorldScene.h"
+#import "HelloWorldLayer.h"
#import "RootViewController.h"
@implementation ___PROJECTNAMEASIDENTIFIER___AppDelegate
@@ -111,7 +111,7 @@ - (void) applicationDidFinishLaunching:(UIApplication*)application
[self removeStartupFlicker];
// Run the intro Scene
- [[CCDirector sharedDirector] runWithScene: [HelloWorld scene]];
+ [[CCDirector sharedDirector] runWithScene: [HelloWorldLayer scene]];
}
View
12 templates/cocos2d_box2d_app/___PROJECTNAME___.xcodeproj/project.pbxproj
@@ -27,7 +27,7 @@
50674865107A3B340090963A /* ZAttributedStringPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 50674862107A3B340090963A /* ZAttributedStringPrivate.h */; };
506EDB88102F4C4000A389B3 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 506EDB87102F4C4000A389B3 /* libz.dylib */; };
506EDBA5102F4C9F00A389B3 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 506EDBA4102F4C9F00A389B3 /* AVFoundation.framework */; };
- 506EDC31102F528A00A389B3 /* HelloWorldScene.mm in Sources */ = {isa = PBXBuildFile; fileRef = 506EDC30102F528A00A389B3 /* HelloWorldScene.mm */; };
+ 506EDC31102F528A00A389B3 /* HelloWorldLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 506EDC30102F528A00A389B3 /* HelloWorldLayer.mm */; };
506EE1A91030508200A389B3 /* libcocos2d libraries.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 506EE05E10304ED200A389B3 /* libcocos2d libraries.a */; };
507ED65C11C638E2002ED3FC /* CDAudioManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 507ED65311C638E2002ED3FC /* CDAudioManager.h */; };
507ED65D11C638E2002ED3FC /* CDAudioManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 507ED65411C638E2002ED3FC /* CDAudioManager.m */; };
@@ -350,8 +350,8 @@
50674862107A3B340090963A /* ZAttributedStringPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZAttributedStringPrivate.h; sourceTree = "<group>"; };
506EDB87102F4C4000A389B3 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
506EDBA4102F4C9F00A389B3 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
- 506EDC2F102F528A00A389B3 /* HelloWorldScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloWorldScene.h; sourceTree = "<group>"; };
- 506EDC30102F528A00A389B3 /* HelloWorldScene.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HelloWorldScene.mm; sourceTree = "<group>"; };
+ 506EDC2F102F528A00A389B3 /* HelloWorldLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloWorldLayer.h; sourceTree = "<group>"; };
+ 506EDC30102F528A00A389B3 /* HelloWorldLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HelloWorldLayer.mm; sourceTree = "<group>"; };
506EE05E10304ED200A389B3 /* libcocos2d libraries.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libcocos2d libraries.a"; sourceTree = BUILT_PRODUCTS_DIR; };
507ED65311C638E2002ED3FC /* CDAudioManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDAudioManager.h; sourceTree = "<group>"; };
507ED65411C638E2002ED3FC /* CDAudioManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDAudioManager.m; sourceTree = "<group>"; };
@@ -741,8 +741,8 @@
E0F81061120A17DF005866B8 /* GameConfig.h */,
50F4143710692D7D002A0D5E /* GLES-Render.h */,
50F4143810692D7D002A0D5E /* GLES-Render.mm */,
- 506EDC2F102F528A00A389B3 /* HelloWorldScene.h */,
- 506EDC30102F528A00A389B3 /* HelloWorldScene.mm */,
+ 506EDC2F102F528A00A389B3 /* HelloWorldLayer.h */,
+ 506EDC30102F528A00A389B3 /* HelloWorldLayer.mm */,
E0F81062120A17DF005866B8 /* RootViewController.h */,
E0F81063120A17DF005866B8 /* RootViewController.m */,
1F3B9A2C0EF2145700286867 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.h */,
@@ -1454,7 +1454,7 @@
files = (
1D60589B0D05DD56006BFB54 /* main.m in Sources */,
1F3B9A2D0EF2145700286867 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.mm in Sources */,
- 506EDC31102F528A00A389B3 /* HelloWorldScene.mm in Sources */,
+ 506EDC31102F528A00A389B3 /* HelloWorldLayer.mm in Sources */,
50F4143910692D7D002A0D5E /* GLES-Render.mm in Sources */,
E0F81064120A17DF005866B8 /* RootViewController.m in Sources */,
);
View
11 ...2d_chipmunk_app/Classes/HelloWorldScene.h → ...2d_chipmunk_app/Classes/HelloWorldLayer.h
@@ -1,25 +1,26 @@
//
-// HelloWorldScene.m
+// HelloWorldLayer.h
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//
+
// When you import this file, you import all the cocos2d classes
#import "cocos2d.h"
// Importing Chipmunk headers
#import "chipmunk.h"
-// HelloWorld Layer
-@interface HelloWorld : CCLayer
+// HelloWorldLayer
+@interface HelloWorldLayer : CCLayer
{
cpSpace *space;
}
-// returns a Scene that contains the HelloWorld as the only child
-+(id) scene;
+// returns a CCScene that contains the HelloWorldLayer as the only child
++(CCScene *) scene;
-(void) step: (ccTime) dt;
-(void) addNewSpriteX:(float)x y:(float)y;
View
29 ...2d_chipmunk_app/Classes/HelloWorldScene.m → ...2d_chipmunk_app/Classes/HelloWorldLayer.m
@@ -1,5 +1,5 @@
//
-// HelloWorldScene.m
+// HelloWorldLayer.m
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
@@ -8,7 +8,7 @@
// Import the interfaces
-#import "HelloWorldScene.h"
+#import "HelloWorldLayer.h"
enum {
kTagBatchNode = 1,
@@ -31,16 +31,16 @@
}
}
-// HelloWorld implementation
-@implementation HelloWorld
+// HelloWorldLayer implementation
+@implementation HelloWorldLayer
-+(id) scene
++(CCScene *) scene
{
// 'scene' is an autorelease object.
CCScene *scene = [CCScene node];
// 'layer' is an autorelease object.
- HelloWorld *layer = [HelloWorld node];
+ HelloWorldLayer *layer = [HelloWorldLayer node];
// add layer as a child to scene
[scene addChild: layer];
@@ -49,7 +49,6 @@ +(id) scene
return scene;
}
-
-(void) addNewSpriteX: (float)x y:(float)y
{
int posx, posy;
@@ -89,8 +88,12 @@ -(void) addNewSpriteX: (float)x y:(float)y
cpSpaceAddShape(space, shape);
}
+
+// on "init" you need to initialize your instance
-(id) init
{
+ // always call "super" init
+ // Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {
self.isTouchEnabled = YES;
@@ -136,10 +139,20 @@ -(id) init
[self schedule: @selector(step:)];
}
-
return self;
}
+// on "dealloc" you need to release all your retained objects
+- (void) dealloc
+{
+ // in case you have something to dealloc, do it in this method
+ cpSpaceFree(space);
+ space = NULL;
+
+ // don't forget to call "super dealloc"
+ [super dealloc];
+}
+
-(void) onEnter
{
[super onEnter];
View
4 templates/cocos2d_chipmunk_app/Classes/___PROJECTNAMEASIDENTIFIER___AppDelegate.m
@@ -10,7 +10,7 @@
#import "___PROJECTNAMEASIDENTIFIER___AppDelegate.h"
#import "GameConfig.h"
-#import "HelloWorldScene.h"
+#import "HelloWorldLayer.h"
#import "RootViewController.h"
@implementation ___PROJECTNAMEASIDENTIFIER___AppDelegate
@@ -111,7 +111,7 @@ - (void) applicationDidFinishLaunching:(UIApplication*)application
[self removeStartupFlicker];
// Run the intro Scene
- [[CCDirector sharedDirector] runWithScene: [HelloWorld scene]];
+ [[CCDirector sharedDirector] runWithScene: [HelloWorldLayer scene]];
}
View
12 templates/cocos2d_chipmunk_app/___PROJECTNAME___.xcodeproj/project.pbxproj
@@ -28,7 +28,7 @@
506EDBA5102F4C9F00A389B3 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 506EDBA4102F4C9F00A389B3 /* AVFoundation.framework */; };
506EE1A91030508200A389B3 /* libcocos2d libraries.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 506EE05E10304ED200A389B3 /* libcocos2d libraries.a */; };
507022A4107672FA00393637 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 507022A2107672FA00393637 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.m */; };
- 507022A5107672FA00393637 /* HelloWorldScene.m in Sources */ = {isa = PBXBuildFile; fileRef = 507022A3107672FA00393637 /* HelloWorldScene.m */; };
+ 507022A5107672FA00393637 /* HelloWorldLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 507022A3107672FA00393637 /* HelloWorldLayer.m */; };
507023151076758E00393637 /* grossini_dance_atlas.png in Resources */ = {isa = PBXBuildFile; fileRef = 507023141076758E00393637 /* grossini_dance_atlas.png */; };
507ED67E11C63903002ED3FC /* CDAudioManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 507ED67511C63903002ED3FC /* CDAudioManager.h */; };
507ED67F11C63903002ED3FC /* CDAudioManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 507ED67611C63903002ED3FC /* CDAudioManager.m */; };
@@ -331,10 +331,10 @@
50674873107A3B5E0090963A /* ZAttributedStringPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZAttributedStringPrivate.h; sourceTree = "<group>"; };
506EDB87102F4C4000A389B3 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
506EDBA4102F4C9F00A389B3 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
- 506EDC2F102F528A00A389B3 /* HelloWorldScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloWorldScene.h; sourceTree = "<group>"; };
+ 506EDC2F102F528A00A389B3 /* HelloWorldLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloWorldLayer.h; sourceTree = "<group>"; };
506EE05E10304ED200A389B3 /* libcocos2d libraries.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libcocos2d libraries.a"; sourceTree = BUILT_PRODUCTS_DIR; };
507022A2107672FA00393637 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "___PROJECTNAMEASIDENTIFIER___AppDelegate.m"; sourceTree = "<group>"; };
- 507022A3107672FA00393637 /* HelloWorldScene.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HelloWorldScene.m; sourceTree = "<group>"; };
+ 507022A3107672FA00393637 /* HelloWorldLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HelloWorldLayer.m; sourceTree = "<group>"; };
507023141076758E00393637 /* grossini_dance_atlas.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = grossini_dance_atlas.png; sourceTree = "<group>"; };
507ED67511C63903002ED3FC /* CDAudioManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDAudioManager.h; sourceTree = "<group>"; };
507ED67611C63903002ED3FC /* CDAudioManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDAudioManager.m; sourceTree = "<group>"; };
@@ -702,8 +702,8 @@
isa = PBXGroup;
children = (
E0F81035120A173C005866B8 /* GameConfig.h */,
- 507022A3107672FA00393637 /* HelloWorldScene.m */,
- 506EDC2F102F528A00A389B3 /* HelloWorldScene.h */,
+ 507022A3107672FA00393637 /* HelloWorldLayer.m */,
+ 506EDC2F102F528A00A389B3 /* HelloWorldLayer.h */,
E0F81036120A173C005866B8 /* RootViewController.h */,
E0F81037120A173C005866B8 /* RootViewController.m */,
1F3B9A2C0EF2145700286867 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.h */,
@@ -1382,7 +1382,7 @@
files = (
1D60589B0D05DD56006BFB54 /* main.m in Sources */,
507022A4107672FA00393637 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.m in Sources */,
- 507022A5107672FA00393637 /* HelloWorldScene.m in Sources */,
+ 507022A5107672FA00393637 /* HelloWorldLayer.m in Sources */,
E0F81038120A173C005866B8 /* RootViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
View
8 ...tes/cocos2d_mac/Classes/HelloWorldScene.h → ...tes/cocos2d_mac/Classes/HelloWorldLayer.h
@@ -10,12 +10,12 @@
// When you import this file, you import all the cocos2d classes
#import "cocos2d.h"
-// HelloWorld Layer
-@interface HelloWorld : CCLayer
+// HelloWorldLayer
+@interface HelloWorldLayer : CCLayer
{
}
-// returns a Scene that contains the HelloWorld as the only child
-+(id) scene;
+// returns a CCScene that contains the HelloWorldLayer as the only child
++(CCScene *) scene;
@end
View
13 ...tes/cocos2d_app/Classes/HelloWorldScene.m → ...tes/cocos2d_mac/Classes/HelloWorldLayer.m
@@ -6,19 +6,20 @@
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//
+
// Import the interfaces
-#import "HelloWorldScene.h"
+#import "HelloWorldLayer.h"
-// HelloWorld implementation
-@implementation HelloWorld
+// HelloWorldLayer implementation
+@implementation HelloWorldLayer
-+(id) scene
++(CCScene *) scene
{
// 'scene' is an autorelease object.
CCScene *scene = [CCScene node];
// 'layer' is an autorelease object.
- HelloWorld *layer = [HelloWorld node];
+ HelloWorldLayer *layer = [HelloWorldLayer node];
// add layer as a child to scene
[scene addChild: layer];
@@ -32,7 +33,7 @@ -(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
- if( (self=[super init] )) {
+ if( (self=[super init])) {
// create and initialize a Label
CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64];
View
4 templates/cocos2d_mac/Classes/___PROJECTNAMEASIDENTIFIER___AppDelegate.m
@@ -7,7 +7,7 @@
//
#import "___PROJECTNAMEASIDENTIFIER___AppDelegate.h"
-#import "HelloWorldScene.h"
+#import "HelloWorldLayer.h"
@implementation ___PROJECTNAMEASIDENTIFIER___AppDelegate
@synthesize window=window_, glView=glView_;
@@ -29,7 +29,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
[window_ setAcceptsMouseMovedEvents:NO];
- [director runWithScene:[HelloWorld scene]];
+ [director runWithScene:[HelloWorldLayer scene]];
}
- (BOOL) applicationShouldTerminateAfterLastWindowClosed: (NSApplication *) theApplication
View
12 templates/cocos2d_mac/___PROJECTNAME___.xcodeproj/project.pbxproj
@@ -11,7 +11,6 @@
E01E6B36121EDCED001A484F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E036A79E121B5C870037C5C6 /* QuartzCore.framework */; };
E01E6B49121EDCF4001A484F /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E036A79C121B5C720037C5C6 /* OpenGL.framework */; };
E02A83D9129F000100341C97 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E02A83D3129F000100341C97 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.m */; };
- E02A83DA129F000100341C97 /* HelloWorldScene.m in Sources */ = {isa = PBXBuildFile; fileRef = E02A83D6129F000100341C97 /* HelloWorldScene.m */; };
E02A83F6129F01DF00341C97 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E02A83EE129F01DF00341C97 /* InfoPlist.strings */; };
E02A83F7129F01DF00341C97 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = E02A83F0129F01DF00341C97 /* MainMenu.xib */; };
E02A83F8129F01DF00341C97 /* fps_images.png in Resources */ = {isa = PBXBuildFile; fileRef = E02A83F2129F01DF00341C97 /* fps_images.png */; };
@@ -30,6 +29,7 @@
E02A8484129F083600341C97 /* CDXPropertyModifierAction.h in Headers */ = {isa = PBXBuildFile; fileRef = E02A840F129F083500341C97 /* CDXPropertyModifierAction.h */; };
E02A8485129F083600341C97 /* CDXPropertyModifierAction.m in Sources */ = {isa = PBXBuildFile; fileRef = E02A8410129F083500341C97 /* CDXPropertyModifierAction.m */; };
E02A8529129F109200341C97 /* icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = E02A8528129F109200341C97 /* icon.icns */; };
+ E0507118131760D700EAE33F /* HelloWorldLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = E0507117131760D700EAE33F /* HelloWorldLayer.m */; };
E076E5B71225E97900DE0DA2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
E076E5B81225E97900DE0DA2 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E036A79C121B5C720037C5C6 /* OpenGL.framework */; };
E076E5B91225E97900DE0DA2 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E036A79E121B5C870037C5C6 /* QuartzCore.framework */; };
@@ -213,8 +213,6 @@
E01E6A3D121EDCD3001A484F /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = System/Library/Frameworks/ApplicationServices.framework; sourceTree = SDKROOT; };
E02A83D2129F000100341C97 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "___PROJECTNAMEASIDENTIFIER___AppDelegate.h"; sourceTree = "<group>"; };
E02A83D3129F000100341C97 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "___PROJECTNAMEASIDENTIFIER___AppDelegate.m"; sourceTree = "<group>"; };
- E02A83D5129F000100341C97 /* HelloWorldScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloWorldScene.h; sourceTree = "<group>"; };
- E02A83D6129F000100341C97 /* HelloWorldScene.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HelloWorldScene.m; sourceTree = "<group>"; };
E02A83EB129F01DF00341C97 /* ___PROJECTNAMEASIDENTIFIER____Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "___PROJECTNAMEASIDENTIFIER____Prefix.pch"; path = "Resources/___PROJECTNAMEASIDENTIFIER____Prefix.pch"; sourceTree = "<group>"; };
E02A83EC129F01DF00341C97 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Resources/Info.plist; sourceTree = "<group>"; };
E02A83EF129F01DF00341C97 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = InfoPlist.strings; sourceTree = "<group>"; };
@@ -237,6 +235,8 @@
E02A8528129F109200341C97 /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = icon.icns; path = Resources/icon.icns; sourceTree = "<group>"; };
E036A79C121B5C720037C5C6 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
E036A79E121B5C870037C5C6 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
+ E0507116131760D700EAE33F /* HelloWorldLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloWorldLayer.h; sourceTree = "<group>"; };
+ E0507117131760D700EAE33F /* HelloWorldLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HelloWorldLayer.m; sourceTree = "<group>"; };
E076E5C01225E97900DE0DA2 /* ___PROJECTNAME___.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "___PROJECTNAME___.app"; sourceTree = BUILT_PRODUCTS_DIR; };
E076E61F1225EC1E00DE0DA2 /* LICENSE.cocos2d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE.cocos2d; sourceTree = "<group>"; };
E076E6201225EC1E00DE0DA2 /* LICENSE.cocosdenshion */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE.cocosdenshion; sourceTree = "<group>"; };
@@ -500,11 +500,11 @@
E02A83D1129F000100341C97 /* Classes */ = {
isa = PBXGroup;
children = (
+ E0507116131760D700EAE33F /* HelloWorldLayer.h */,
+ E0507117131760D700EAE33F /* HelloWorldLayer.m */,
E02A83FB129F023B00341C97 /* main.m */,
E02A83D2129F000100341C97 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.h */,
E02A83D3129F000100341C97 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.m */,
- E02A83D5129F000100341C97 /* HelloWorldScene.h */,
- E02A83D6129F000100341C97 /* HelloWorldScene.m */,
);
path = Classes;
sourceTree = "<group>";
@@ -1009,8 +1009,8 @@
buildActionMask = 2147483647;
files = (
E02A83D9129F000100341C97 /* ___PROJECTNAMEASIDENTIFIER___AppDelegate.m in Sources */,
- E02A83DA129F000100341C97 /* HelloWorldScene.m in Sources */,
E02A83FC129F023B00341C97 /* main.m in Sources */,
+ E0507118131760D700EAE33F /* HelloWorldLayer.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
2 tests/ActionsTest.m
@@ -14,8 +14,6 @@
static int sceneIdx=-1;
static NSString *transitions[] = {
- @"ActionBlink",
-
@"ActionManual",
@"ActionMove",
@"ActionRotate",

0 comments on commit e4fdea1

Please sign in to comment.
Something went wrong with that request. Please try again.