源码下载地址:

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. python基础之面向对象编程介绍、类和对象

    面向对象变成介绍 面向过程编程 核心是过程(流水线式思维),过程即解决问题的步骤,面向过程的设计就好比精心设计好一条流水线,考虑周全什么时候处理什么东西.主要应用在一旦完成很少修改的地方,如linux ...

  2. spark的排序方法

    今天我们来介绍spark中排序的操作,spark的排序很简单,我们可以直接使用sortBy来进行,这个里面我们使用case clas,使用case class的好处是1.不用newjiukeyi 搞出 ...

  3. Flume是什么

    分布式流式实时收集日志文件系统,便于实时在线的流式计算,常配合 Storm 和 spark streming 使用. Flume is a distributed分布式的, reliable可靠的, ...

  4. 9,K-近邻算法(KNN)

    导引: 如何进行电影分类 众所周知,电影可以按照题材分类,然而题材本身是如何定义的?由谁来判定某部电影属于哪 个题材?也就是说同一题材的电影具有哪些公共特征?这些都是在进行电影分类时必须要考虑的问 题 ...

  5. Java线程和多线程(六)——守护线程

    当我们在Java中创建线程的时候,这个线程在默认的情况下是一个用户线程,并且,如果这个线程在运行,那么JVM就不会终结这个应用.和用户线程不同,当一个线程被标记为守护线程的时候,JVM在用户线程结束的 ...

  6. SpringMVC---springMVC配置文件(springweb.xml)简介

    再web.xml中设置HTTP请求的中央调度处理器DispatcherServlet时,会指定SpringMVC配置文件,这里取名springweb.xml是因设置DispatcherServlet时 ...

  7. iOS算法笔记-快速排序-OC实现

    快速排序(Quicksort)是对冒泡排序的一种改进. 快速排序由C. A. R. Hoare在1962年提出.它的基本思想是:通过一趟排序将要排序的数据分割成独立的两部分,其中一部分的所有数据都比另 ...

  8. 剑指Offer - 九度1351 - 数组中只出现一次的数字

    剑指Offer - 九度1351 - 数组中只出现一次的数字2013-11-23 01:23 题目描述: 一个整型数组里除了两个数字之外,其他的数字都出现了两次.请写程序找出这两个只出现一次的数字. ...

  9. Hastable和Dictionary以及ArrayList和(List,LinkedList,数组)的区别

    Hastable和Dictionary的区别:(键值对) 1:单线程程序中推荐使用 Dictionary, 有泛型优势, 且读取速度较快, 容量利用更充分. 2:多线程程序中推荐使用 Hashtabl ...

  10. QQ网页强制聊天,微博一键关注

    <!doctype html> <!-- 微博关注需要的js --> <html xmlns:wb="http://open.weibo.com/wb" ...