Fork me on GitHub
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 125 下一页

2012年5月3日

摘要: http://blog.csdn.net/pjk1129/article/details/71613831、绘图总结:绘图前设置:CGContextSetRGBFillColor/CGContextSetFillColorWithColor//填充色 CGContextSetRGBStrokeColor/CGContextSetStrokeColorWithColor//笔颜色 CGContextSetLineWidth//线宽度绘图后设置:注: 画完图后,必须 先用CGContextStrokePath来描线,即形状,后用CGContextFillPath来填充形状内的颜色.2.常见图形绘制 阅读全文
posted @ 2012-05-03 17:28 pengyingh 阅读(307) 评论(0) 推荐(0)
摘要: http://blog.sina.com.cn/s/blog_7a2ffd5c0100x4q6.htmlSprite如果经过了缩放,那么构建的CCMenuItemSprite显示的位置会不正确。一个Sprite经过缩放后,实际尺寸不再等于contentSize,而是需要乘以scale系数,但是在CCMenuItemSprite构造时,仍然设定了Sprite的contenSize大小:[self setContentSize: [normalImage_ contentSize]];而后设定3种状态的Sprite时,会将其锚点设为(0,0),如:-(void) setNormalImage:(C 阅读全文
posted @ 2012-05-03 12:17 pengyingh 阅读(808) 评论(0) 推荐(0)
摘要: http://www.cocoachina.com/bbs/simple/?t69462.html最近在游戏的制作中想要加入一个类似技能使用后的“冷却效果”,第一个想到的就是cocos2d中的ProgressTo。于是看了一下自带的sample,感觉不错,于是就实践了一下,但是发现了如下的问题:1.ProgressTo无法和CCSprite一同使用,必须使用在ProgressTimer对象上2.ProgressTimer无法和CCMenuItemSprite一起使用当Sprite数量很少时,可以单个使用ProgressTo + ProgressTimer,但是当Sprite很多并使用CCMen 阅读全文
posted @ 2012-05-03 10:01 pengyingh 阅读(507) 评论(0) 推荐(0)
摘要: http://blog.csdn.net/tangaowen/article/details/7370475iphone使用keychain来存取用户名和密码 以下文字转载自:http://blog.csdn.net/bl1988530/article/details/6887946,向原作者表示感谢和敬意。 iOS的keychain服务提供了一种安全的保存私密信息(密码,序列号,证书等)的方式。每个ios程序都有一个独立的keychain存储。从ios 3.0开始,跨程序分享keychain变得可行。下面就使用keychain来实现存取用户名和密码。苹果已经有现成的类封装... 阅读全文
posted @ 2012-05-03 09:52 pengyingh 阅读(2226) 评论(0) 推荐(0)
摘要: http://blog.csdn.net/tangaowen/article/details/7380408cocos2d支持以下几种坐标系:1.屏幕坐标系 原点在左上角,X轴向右,Y轴向下。2.GL坐标系 原点在左下角,X轴向右,Y轴向上。3.世界坐标系 指相对于整个屏幕的坐标系,(0,0)就是屏幕的左下角,(320,480)就是屏幕的右上角。4.本地坐标系 相对于父对象的坐标基本的两个坐标系:屏幕坐标系和GL坐标系。屏幕坐标系x轴朝右,y轴朝下。默认原点在左上角。GL坐标系x轴朝右,y轴朝上。默认原点在左下角。在调用任何需要设置位置的函数,或从函数获取位置信息前,必须要明确这个函数使用哪个 阅读全文
posted @ 2012-05-03 09:50 pengyingh 阅读(215) 评论(0) 推荐(0)
摘要: 原文:http://blog.csdn.net/tangaowen/article/details/7342021切记 cocos2d中一个CCAction 对象只能被使用到一个Sprite对象上 在cocos2d中,经常需要将一个action施加到多个Sprites上面,以达到相同的效果。 所以经常会有下面的代码:CCMoveTo * move =[CCMoveTo actionWithDuration:DESK_ANIMATE_TIME position:point]; [deskImage runAction:move]; [HeadImageSprite r... 阅读全文
posted @ 2012-05-03 09:47 pengyingh 阅读(270) 评论(0) 推荐(0)
摘要: 以下文字转载自:http://blog.csdn.net/lbj05/article/details/6297214,对原作者表示感谢和敬意。 iPhone SDK提供了多种动画手段,UIView、UIImageView和CALayer都支持动画。但如何处理常见的gif动画呢?UIWebView提供了答案,代码如下:// 设定位置和大小CGRect frame = CGRectMake(50,50,0,0);frame.size = [UIImage imageNamed:@"anim.gif"].size;// 读取gif图片数据NSData *gif = [NSData 阅读全文
posted @ 2012-05-03 09:44 pengyingh 阅读(1768) 评论(0) 推荐(0)

2012年5月2日

摘要: // Obtain the shared instance of the cacheCCSpriteFrameCache *cache = [CCSpriteFrameCache sharedSpriteFrameCache;// load the frames[cache addSpriteFramesWithFile:@"frames.plist"];// It loads the frame named "frame1.png".// IMPORTANT: It doesn't load the image "frame1.png 阅读全文
posted @ 2012-05-02 17:26 pengyingh 阅读(5243) 评论(0) 推荐(0)
摘要: http://www.ityran.com/thread-27-1-1.html有时候为了方便需要是不是需要把UIImage转换成精灵 ,而有时候又需要把精灵转换成UIImage, 有木有为这些在烦恼的,有的话顶起来-(CCSprite *) convertImageToSprite:(UIImage *) image { CCTexture2D *texture = [[CCTexture2D alloc] initWithImage:image]; CCSprite *sprite = [CCSprite spriteWithTexture:texture]; [texture r... 阅读全文
posted @ 2012-05-02 17:19 pengyingh 阅读(904) 评论(1) 推荐(2)
摘要: 我创建了一个自定义的CCSprite,然后添加了一张png图片。CCTexture2D *paddleTexture = [[CCTextureCache sharedTextureCache] addImage:@"1.png"];MySprite *mSprite = [MySprite paddleWithTexture:paddleTexture];当手指触摸到这个CCSprite时,我该如何判断当前触摸的位置是否是在图片上的透明区域,还是在图片的图像上。请高手们帮帮忙,谢谢。备注://判断触摸点是否在CCSprite上- (BOOL)containsTouchLo 阅读全文
posted @ 2012-05-02 17:15 pengyingh 阅读(1290) 评论(0) 推荐(0)
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 125 下一页

导航