Skip to content

Commit b34257c

Browse files
committed
Isometric tilemap test. Environment variable to jump into a specific test.
1 parent 42b0f0a commit b34257c

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

cocos2d-ui-tests/MainMenu.m

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ - (id) init
7070
self = [super init];
7171
if (!self) return NULL;
7272

73-
// Load resources
74-
[[CCSpriteFrameCache sharedSpriteFrameCache] registerSpriteFramesFile:@"Interface.plist"];
75-
[[CCSpriteFrameCache sharedSpriteFrameCache] registerSpriteFramesFile:@"Sprites.plist"];
76-
[[CCSpriteFrameCache sharedSpriteFrameCache] registerSpriteFramesFile:@"TilesAtlassed.plist"];
77-
7873
// Make the node the same size as the parent container (i.e. the screen)
7974
self.contentSizeType = CCSizeTypeNormalized;
8075
self.contentSize = CGSizeMake(1, 1);

cocos2d-ui-tests/ios/AppDelegate.m

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#import "AppDelegate.h"
2828
#import "MainMenu.h"
29+
#import "TestBase.h"
2930

3031
@implementation AppController
3132

@@ -44,6 +45,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
4445
[[NSBundle mainBundle] resourcePath],
4546
nil];
4647

48+
// Register spritesheets.
49+
[[CCSpriteFrameCache sharedSpriteFrameCache] registerSpriteFramesFile:@"Interface.plist"];
50+
[[CCSpriteFrameCache sharedSpriteFrameCache] registerSpriteFramesFile:@"Sprites.plist"];
51+
[[CCSpriteFrameCache sharedSpriteFrameCache] registerSpriteFramesFile:@"TilesAtlassed.plist"];
52+
4753
[self setupCocos2dWithOptions:@{
4854
CCSetupDepthFormat: @GL_DEPTH24_STENCIL8,
4955
CCSetupTabletScale2X: @YES,
@@ -57,7 +63,13 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
5763

5864
- (CCScene*) startScene
5965
{
60-
return [MainMenu scene];
66+
const char *testName = getenv("Test");
67+
68+
if(testName){
69+
return [TestBase sceneWithTestName:[NSString stringWithCString:testName encoding:NSUTF8StringEncoding]];
70+
} else {
71+
return [MainMenu scene];
72+
}
6173
}
6274

6375
//// I'm going to leave this in for testing the fixed size screen mode in the future.

cocos2d-ui-tests/tests/TilemapTest.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,16 @@ -(void) setupTilemap5Test
7575
[self.contentNode addChild:scroll];
7676
}
7777

78+
-(void) setupTilemap6Test
79+
{
80+
self.subTitle = @"TileMaps/iso-test-bug787.tmx";
81+
82+
CCNode *map = [CCTiledMap tiledMapWithFile:self.subTitle];
83+
CCScrollView *scroll = [[CCScrollView alloc] initWithContentNode:map];
84+
scroll.flipYCoordinates = NO;
85+
86+
[self.contentNode addChild:scroll];
87+
scroll.scrollPosition = ccp(map.contentSizeInPoints.width/2 - scroll.contentSizeInPoints.width/2, 0);
88+
}
89+
7890
@end

0 commit comments

Comments
 (0)