源码下载地址:

http://code.google.com/p/cocos2d-iphone/downloads/list

https://github.com/cocos2d/cocos2d-iphone-classic/releases?after=release-0.2

问题:[[CCDirector sharedDirector] runWithScene: [sysMenu scene]];导演是怎么把screen放到屏幕上的呢?

找了老半天发现只有这个- (void) pushScene: (CCScene*) scene,把这个注了,就显示不了了,

后来又找了很长时间终于找到了,

EAGLView里

- (void) layoutSubviews

[director performSelectorOnMainThread:@selector(drawScene) withObject:nil waitUntilDone:YES];

-(void) mainLoop
{
[self drawScene];
}

- (void) startAnimation
{
NSAssert( isRunning == NO, @"isRunning must be NO. Calling startAnimation twice?");

// XXX:
// XXX: release autorelease objects created
// XXX: between "use fast director" and "runWithScene"
// XXX:
[autoreleasePool release];
autoreleasePool = nil;

if ( gettimeofday( &lastUpdate_, NULL) != 0 ) {
CCLOG(@"cocos2d: Director: Error in gettimeofday");
}

isRunning = YES;

SEL selector = @selector(mainLoop);
NSMethodSignature* sig = [[[CCDirector sharedDirector] class]
instanceMethodSignatureForSelector:selector];
NSInvocation* invocation = [NSInvocation
invocationWithMethodSignature:sig];
[invocation setTarget:[CCDirector sharedDirector]];
[invocation setSelector:selector];
[invocation performSelectorOnMainThread:@selector(invokeWithTarget:)
withObject:[CCDirector sharedDirector] waitUntilDone:NO];

// NSInvocationOperation *loopOperation = [[[NSInvocationOperation alloc]
// initWithTarget:self selector:@selector(mainLoop) object:nil]
// autorelease];
//
// [loopOperation performSelectorOnMainThread:@selector(start) withObject:nil
// waitUntilDone:NO];
}

- (void) startAnimation
{
NSAssert( displayLink == nil, @"displayLink must be nil. Calling startAnimation twice?");

if ( gettimeofday( &lastUpdate_, NULL) != 0 ) {
CCLOG(@"cocos2d: DisplayLinkDirector: Error on gettimeofday");
}

// approximate frame rate
// assumes device refreshes at 60 fps
int frameInterval = (int) floor(animationInterval_ * 60.0f);

CCLOG(@"cocos2d: Frame interval: %d", frameInterval);

displayLink = [NSClassFromString(@"CADisplayLink") displayLinkWithTarget:self selector:@selector(mainLoop:)];
[displayLink setFrameInterval:frameInterval];
[displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
}

cocos2d-iphone心得的更多相关文章

  1. (转载)如何学好iphone游戏开发

    转自:http://www.cnblogs.com/zilongshanren/archive/2011/09/19/2181558.html 自从发布<如何学习iphone游戏开发>到 ...

  2. [cocos2d demo]新科娘收集水表

    讲述的是新科娘在沙滩上遇到一大波水表的故事... 下载地址 链接:http://pan.baidu.com/share/link?shareid=2141087190&uk=293716439 ...

  3. 我常用的iphone开发学习网站[原创]

    引用地址:http://www.cnblogs.com/fuleying/archive/2011/08/13/2137032.html Google 翻译 Box2d 托德的Box2D的教程! Bo ...

  4. iPhone Tutorials

    http://www.raywenderlich.com/tutorials This site contains a ton of fun written tutorials – so many t ...

  5. A星寻路算法介绍

    你是否在做一款游戏的时候想创造一些怪兽或者游戏主角,让它们移动到特定的位置,避开墙壁和障碍物呢? 如果是的话,请看这篇教程,我们会展示如何使用A星寻路算法来实现它! 在网上已经有很多篇关于A星寻路算法 ...

  6. A星寻路算法(A* Search Algorithm)

    你是否在做一款游戏的时候想创造一些怪兽或者游戏主角,让它们移动到特定的位置,避开墙壁和障碍物呢? 如果是的话,请看这篇教程,我们会展示如何使用A星寻路算法来实现它! 在网上已经有很多篇关于A星寻路算法 ...

  7. A*算法介绍

    你是否在做一款游戏的时候想创造一些怪兽或者游戏主角,让它们移动到特定的位置,避开墙壁和障碍物呢? 如果是的话,请看这篇教程,我们会展示如何使用A星寻路算法来实现它! 在网上已经有很多篇关于A星寻路算法 ...

  8. 如何用TexturePacker打包素材

    如何用TexturePacker打包素材 TexturePacker是一个非常好用的图片素材打包工具,它能帮助你减少游戏的图片内存使用. 官方下载地址:http://www.codeandweb.co ...

  9. [转载]A星寻路算法介绍

    转载自:http://www.raywenderlich.com/zh-hans/21503/a%E6%98%9F%E5%AF%BB%E8%B7%AF%E7%AE%97%E6%B3%95%E4%BB% ...

  10. iPhone开发与cocos2d 经验谈

    转CSDN jilongliang : 首先,对于一个完全没有mac开发经验,甚至从没摸过苹果系统的开发人员来说,首先就是要熟悉apple的那一套开发框架(含开发环境IDE.开发框架uikit,还有开 ...

随机推荐

  1. C++ 基础 初始化列表

    当一个类组合了其他类,或者使用了 const 成员,就要用 初始化列表. Class A {...}; Class B {...}; Class C { private: A a; B b; int ...

  2. python——获取数据类型

    在python中,可使用type()和isinstance()内置函数获取数据类型 如: (1)type()的使用方法: >>> a = '230'         >> ...

  3. Aizu:0009- Prime Number

    Prime Number Time limit 1000 ms Memory limit 131072 kB Problem Description Write a program which rea ...

  4. Ubuntu设置root密码[repost]

    From: http://hi.baidu.com/busybox/item/283e7d31433db7179cc65ef3 安装完Ubuntu后在终端使用命令:su -然后输入密码,总是不正确.原 ...

  5. 玩转Linux之pwd命令

    玩转Linux之pwd命令 你有没有遇到过需要知道当前所在目录却无从得知?有没有想要复制出当前所在目录层次却不知如何下手?俗话说有困难找警察,想知道目录层次自然要找pwd了.那么问题来了: 什么是pw ...

  6. BFC相关知识

    一.什么是BFC css布局主要采用盒子模型(BOX),元素的类型和 display 属性,决定了 Box 的类型,常见的盒子类型有两种: block-level box:display 属性为 bl ...

  7. iOS笔记056 - UI总结02

    九宫格布局 UICollectionViewController 创建控制器一定要指定默认的布局样式. // 加载一个九宫格布局的控制器,必须指定布局样式 UICollectionViewFlowLa ...

  8. CS局域网射击

    2/3D游戏:3D 辅助插件:角色控制器 游戏制作难度系数:中级 用到的其他工具:network 一.解决由于子弹射击速度过快而无法打到物体的问题 //方法一: ; Vector3 originalP ...

  9. CSU-1989 赶路的小X

    题目链接 http://acm.csu.edu.cn:20080/csuoj/problemset/problem?pid=1989 题目 Description A国一共有N座城市,由M条双向公路连 ...

  10. PhpStorm快捷键设置/个性化设置,如何多项目共存?如何更换主题?

    #常用快捷键  设置快捷键:File -> Settings -> IDE Settings -> Keymap -> 选择“Eclipse” -> 然后“Copy”一份 ...