在跟着千峰的视频写一个angrybirds
但是自己太水,真的是一步一个坑,自己跳的可爽了,明明是视频怎么教我怎么写的但是,。。。。。
创建精灵,模拟器的大小明明是 480 * 320 我的图片也是 480 * 320但是就是显示不全
//
// LoadingScene.m
// AngryBirds
//
// Created by lee on 16/1/6.
// Copyright © 2016年 ltybrp. All rights reserved.
//
#import "LoadingScene.h"
@implementation LoadingScene
+(id) scene{
CCScene *sc = [CCScene node];
LoadingScene *ls = [LoadingScene node];
[sc addChild:ls];
return sc;
}
-(id) init{
self =[ super init];
if(self){
CGSize winSize = [[CCDirector sharedDirector] winSize];
CCSprite *sp = [CCSprite spriteWithFile:@"loading.png"];
[sp setPosition:ccp(winSize.width/2.0f, winSize.height/2.0f)];
printf("%f %f\n",winSize.width/2.0f, winSize.height/2.0f);
[self addChild:sp];
}
return self;
}
@end
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
_window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
_window.rootViewController = [[UIViewController alloc]init];
_window.backgroundColor = [UIColor blackColor];
// Override point for customization after application launch.
if (![CCDirector setDirectorType:kCCDirectorTypeDisplayLink]) {
[CCDirector setDirectorType:kCCDirectorTypeDefault];
return NO;
}
CCDirector *director = [CCDirector sharedDirector];
EAGLView *glView = [EAGLView viewWithFrame:self.window.bounds pixelFormat: kEAGLColorFormatRGB565 depthFormat:0];
[director setOpenGLView:glView];
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
[director setAnimationInterval:1.0f/60.0f];
[director setDisplayFPS:YES];
RootViewController *rvc = [[RootViewController alloc] init];
[rvc setView:glView];
[_window setRootViewController:rvc];
[rvc release];
[_window makeKeyAndVisible];
//First scene
CCScene *sc = [LoadingScene scene];
[[CCDirector sharedDirector] runWithScene:sc];
return YES;
}
(https://img-ask.csdn.net/upload/201601/06/1452070848_2723.png)