ITeye博客

俺是一个瓜娃!!!

xiaozhao-521 · 共 254 篇文章

iPhone 多线程

iPhone 多线程 多线程在各种编程语言中都是难点,很多语言中实现起来很麻烦,objective-c虽然源于c,但其多线程编程却相当简单,可以与java相媲美。这篇文章主要从线程创建与启动、线程的同步与锁、线程的交互、线程池等等四个方面简单的讲解一下iphone中的多线程编程。 一、线程创建与启动 线程创建主要有二种方式: - (id)init; // designated initializer - (id)initWithTarget:(id)target selector:(SEL)selector object:(id)argument; 当然,还有一种比较特殊,就是使用所谓的co…

2010-09-01 16:56 · objective-c · 评论(2) · C · Objective-C · 编程 · thread · 多线程

Cocos2d API 解析之ClickAndMoveTest

//触发点击动作 self.isTouchEnabled = YES; //定义一个颜色层 id layer = [ColorLayer layerWithColor: ccc4(255,255,0,255)]; [self addChild: layer z:-1]; //颜色层可以执行动作 [layer runAction: [RepeatForever actionWithAction: [Sequence actions: [FadeIn actionWithDuration:1], [FadeOut actionWithDuration:1], nil] ] ];

2010-06-20 14:59 · objective-c · 评论(0)

Cocos2d API 解析之AtlasSpriteTest之二

例子6:(展示AtlasSpriteManager这个集合的action动作情况) @implementation Atlas6 -(id) init { if( (self=[super init]) ) { // small capacity. Testing resizing // Don't use capacity=1 in your real game. It is expensive to resize the capacity AtlasSpriteManager *mgr = [AtlasSpriteManager spriteManagerWithFile:@"gross…

2010-06-20 14:57 · objective-c · 评论(0) · 360

Cocos2d API 解析之AtlasSpriteTest

AtlasSpriteManager :定义一个的精灵集合 AtlasSprite是一个CocosNode对象实现CocosNodeFrames和CocosNodeRGBA协议。 AtlasSprite可以作为替代的Sprite。 AtlasSprite has all the features from CocosNode with the following additions and limitations: New features(新的特征) It is MUCH faster than Sprite supports flipX, flipY Limitations(一些限制) …

2010-06-20 14:51 · objective-c · 评论(0) · 360

Cocos2d API 解析之IntervalTest

ParticleSystem* sun = [ParticleSun node] ParticleSun:是粒子特效中的太阳效果 ParticleSnow:下雪效果 该例子主要展示的是定时(Interval)调用的例子: label1 = [Label labelWithString:@"0" fontName:@"Courier" fontSize:32]; [self schedule: @selector(step1:) interval: 0.5f]; //每隔0.5秒执行一次 -(void) step1: (ccTime) delta { // time1 +=delta; //时…

2010-06-20 14:34 · objective-c · 评论(0) · SUN

Cocos2d API 解析之TileMapAtlas

原文:http://www.cocoachina.com/bbs/read.php?tid-8238-keyword-TileMapAtlas.html 问: TileMapAtlas *tilemap = [TileMapAtlas tileMapAtlasWithTileFile:@"tiles.png" mapFile:@"levelmap.tga" tileWidth:16 tileHeight:16]; 这句是cocos2d的例子,有几点不明白,忘大大相告。 1。.tga是什么文件,他跟tiles.png的关系是什么? 2。.png里面的图像是自动根据.tga的格式来画图?如果不是…

2010-06-20 14:22 · objective-c · 评论(0) · HTML · BBS · PHP

Cocos2d API解析之TextureAtlas

TextureAtlas (以下内容是:cocoachina的猪头解释的,原贴在:http://www.cocoachina.com/bbs/read.php?tid-8261.html) 供AtlasSpriteManager与AtlasSprite的材质类 从Texture2D继承而来,在其基础上增加了一个非常重要的成员变量 ccV3F_C4B_T2F_Quad * quads 实际上AtlasSprite相比Sprite能快更得进行大批量渲染也是因为这个 TextureAtlas维护了一个ccV3F_C4B_T2F_Quad数组,使用一张texture进行batch render 其他…

2010-06-20 14:17 · objective-c · 评论(0) · BBS · PHP · DOS

Cocos2d API解析之RotateWorldTest

该函数演示的是:旋转功能 @implementation MainLayer -(id) init { if( ! [super init] ) return nil; float x,y; CGSize size = [[Director sharedDirector] winSize]; x = size.width; y = size.height; //ColorLayer是实现CocosNodeRGBA的子层,他除了有Layer的所有功能之外, //并且有以下特征:opacity(不透明) RGB颜色 CocosNode* blue = [ColorLayer layerWithC…

2010-06-20 14:12 · objective-c · 评论(0)

Cocos2d API解析之SceneTest

-(void) onPushScene: (id) sender { //Layer2定义一个新的场景 Scene * scene = [[Scene node] addChild: [Layer2 node] z:0]; //pushScene:终止正在运行的场景,把它放到暂停场景的堆栈(内存)中去,新的场景将被执行, //尽量避免一个大的场景被推送到堆栈,以减少内存的分配(被堆出的场景没被真正的release终止,而是放到内存中了) [[Director sharedDirector] pushScene: scene]; //replaceScene:用一个新的场景去替换掉正在运行的场…

2010-06-20 14:07 · objective-c · 评论(0) · HTML · 活动 · Apple

cocos2d api分析

http://blog.sina.com.cn/s/blog_6233b7b70100f5u6.html 先放在这里有时间整理一下

2010-06-19 15:42 · objective-c · 评论(0) · HTML · Blog

box2d 英文教材

http://www.emanueleferonato.com/category/box2d/

2010-06-12 10:05 · objective-c · 评论(0)

Cocoachina教学:Core Animation入门

今天,Cocoachina会开始一个Core Animation的入门教学,和大家共同学习Core Animation的使用。本站介绍过不少Core Animation的文章,这篇文章是一个入门教学,从头帮助你了解Core Animation以及如何入门。 Core Animation是苹果在Leopard中加入的新API,主要用于利用显卡硬件制作动态的用户界面。同时,在iPhone SDK中也支持这种API。在Leopard和iPhone中,你会看到苹果大量使用这种很酷的效果,比如iTunes/iPhone的 CoverFlow效果: Core Animation的好处 Core Anim…

2010-05-20 15:25 · objective-c · 评论(0) · quartz · Objective-C · Xcode · Cocoa · Adobe

Core animation

第一章 Core animation简介 1. 简介 Core animation 是以objc语言封装的一套图形渲染,投影及动画的库的集合。 Core animation 使创建用户界面变得非常容易,通过以下方法: 1. 使用简单的编程方法实现高性能的合成 2. 使用层对象创建复杂的用户界面 3. 轻量型数据结构,能够同时使几百个层产生动画。 4. 不依赖于应用程序主线程,动画在单独的线程里运行。 5. 改进了应用程序性能。应用程序只需要重画它变化的部分(局部刷新)。 6. 灵活的布局管理模式。 2. 相关类 使用core animation,开发者不需要使用底层的API或者OpenGL就…

2010-05-19 17:47 · objective-c · 评论(0) · 数据结构 · Cocoa · 设计模式 · Apple · 多线程

Creating an iPhone Application

At a high level, the process for creating an iPhone application is similar to that for creating a Mac OS X application. Both use the same tools and many of the same basic libraries. Despite the similarities, there are also significant differences. An iPhone is not a desktop computer; it has a diffe…

2010-05-19 13:34 · objective-c · 评论(0) · quartz · Objective-C · OS · Xcode · Windows Phone

js---统计表排序功能

只对表格的第一行有效

2010-04-22 18:34 · 代码 · 评论(0)