cocos2d-iphone心得
源码下载地址:
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心得的更多相关文章
- (转载)如何学好iphone游戏开发
转自:http://www.cnblogs.com/zilongshanren/archive/2011/09/19/2181558.html 自从发布<如何学习iphone游戏开发>到 ...
- [cocos2d demo]新科娘收集水表
讲述的是新科娘在沙滩上遇到一大波水表的故事... 下载地址 链接:http://pan.baidu.com/share/link?shareid=2141087190&uk=293716439 ...
- 我常用的iphone开发学习网站[原创]
引用地址:http://www.cnblogs.com/fuleying/archive/2011/08/13/2137032.html Google 翻译 Box2d 托德的Box2D的教程! Bo ...
- iPhone Tutorials
http://www.raywenderlich.com/tutorials This site contains a ton of fun written tutorials – so many t ...
- A星寻路算法介绍
你是否在做一款游戏的时候想创造一些怪兽或者游戏主角,让它们移动到特定的位置,避开墙壁和障碍物呢? 如果是的话,请看这篇教程,我们会展示如何使用A星寻路算法来实现它! 在网上已经有很多篇关于A星寻路算法 ...
- A星寻路算法(A* Search Algorithm)
你是否在做一款游戏的时候想创造一些怪兽或者游戏主角,让它们移动到特定的位置,避开墙壁和障碍物呢? 如果是的话,请看这篇教程,我们会展示如何使用A星寻路算法来实现它! 在网上已经有很多篇关于A星寻路算法 ...
- A*算法介绍
你是否在做一款游戏的时候想创造一些怪兽或者游戏主角,让它们移动到特定的位置,避开墙壁和障碍物呢? 如果是的话,请看这篇教程,我们会展示如何使用A星寻路算法来实现它! 在网上已经有很多篇关于A星寻路算法 ...
- 如何用TexturePacker打包素材
如何用TexturePacker打包素材 TexturePacker是一个非常好用的图片素材打包工具,它能帮助你减少游戏的图片内存使用. 官方下载地址:http://www.codeandweb.co ...
- [转载]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% ...
- iPhone开发与cocos2d 经验谈
转CSDN jilongliang : 首先,对于一个完全没有mac开发经验,甚至从没摸过苹果系统的开发人员来说,首先就是要熟悉apple的那一套开发框架(含开发环境IDE.开发框架uikit,还有开 ...
随机推荐
- 统计输入任意的字符中中英文字母,空格和其他字符的个数 python
这里用到了三个函数: #判断是否为数字:str.isdigit()#是否为字母:str.isalpha()#是否为空格:str.isspace() def tongji(str): alpha = 0 ...
- 笔记-mysql-管理及基础操作
笔记-mysql使用-管理及基础操作 1. 简介 mysql是一个免费的关系型数据库,不过好像被oracle收购了.... 希望它继续免费. 1.1. 相关术语 数据库,表,列,行,冗 ...
- Android 渗透小知识点
客户端用于 ADB 通信的默认端口始终是 5037,设备使用从 5555 到 5585 的端口 adb devices用于显示所有已连接设备, 有时候会出现一些问题, 这时候需要使用adb kill- ...
- Robolectric
今天学习了单元测试框架,Robolectric.初步感觉,可能我测试的少,没有感觉Robolectric能有多大的帮助.虽然可以帮助创建activity.可以模拟点击事件.可是有什么呢. 好吧,讲下使 ...
- Android 布局开发之百分比布局、弹性布局
1.百分比布局 很简单,超级简单.引用之后就可以使用了. compile 'com.android.support:percent:23+' git地址: https://github.com/Jul ...
- HTTP协议中POST方法和GET方法有那些区别?
GET用于向服务器请求数据,POST用于提交数据 GET请求,请求参数拼接形式暴露在地址栏,而POST请求参数则放在请求体里面,因此GET请求不适合用于验证密码等操作 GET请求的URL有长度限制1k ...
- APPIUM-----自动发现兼容的Chromedrivers
使用Appium Desired Capabilities:chromedriverExecutableDir chromeDriver所有版本下载路径:https://chromedriver.st ...
- django-settings里mysql连接配置
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'dailyfresh', 'HOST': 'loca ...
- CodeForces-1061D TV Shows
题目链接 https://vjudge.net/problem/CodeForces-1061D 题面 Description There are nn TV shows you want to wa ...
- GCC 7.3 for Windows
GCC 6.1x Compilers 下载地址1: Mingw gcc 6.30下载 这个是某微软员工编译的版本 MinGW is a port of GCC to Windows. It is fr ...