I'm just starting out with cocos2d and working with some tutorials to construct a simple App with Cocos2d that displays an image. But the App crashes immediately on load.
This is the file implementation file for the scene I made that has the image.
#import "Main_Menu.h"
#import "Sprite.h"
#import "cocos2d.h"
@implementation Main_Menu
-(id) init
{
self = [super init];
if(self != nil)
{
Sprite *background = [Sprite spriteWithFile:@"Main_Menu_bg.png"];
background.position = ccp(240,160);
[self addChild:background];
}
return self;
}
@end
#import "Cat_TrapAppDelegate.h"
#import "Main_Menu.h"
@implementation Cat_TrapAppDelegate
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
UIWindow *window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
[window setUserInteractionEnabled:YES];
[window setMultipleTouchEnabled:YES];
[[Director sharedDirector] setPixelFormat:kRGBA8];
[[Director sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];
[[Director sharedDirector] attachInWindow:window];
[window makeKeyAndVisible];
Main_Menu *mainMenu = [Main_Menu node];
[[Director sharedDirector] runWithScene: mainMenu];
}
@end
I'm using the latest version of cocos2d and I'm not receiving any warnings or errors. I'm new to all of this so any help is appreciated.