- 浏览: 321243 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
ljl961890233bear:
...
利用MySQL Cluster 7.0 + LVS 搭建高可用环境 -
wang1352083:
$m->listDBs(); 返回的是一个有dbnam ...
MongoDB PHP API 及用法 -
走忽闪953:
...
putty PasswordAuthentication -
jxhgzs001:
很好 很强大,不顶你一下 觉得过意不去啊
cocos2d 的一些实用代码 -
lingtianlan:
我实际测试的结果却和你不一样,调用顺序是awakeFromNi ...
[转]loadView/viewDidLoad/initWithNibName/awakeFromNib/initWithCoder的用法
-(void) draw { CGSize s = [[CCDirector sharedDirector] winSize]; // draw a simple line // The default state is: // Line Width: 1 // color: 255,255,255,255 (white, non-transparent) // Anti-Aliased glEnable(GL_LINE_SMOOTH); ccDrawLine( ccp(0, 0), ccp(s.width, s.height) ); // line: color, width, aliased // glLineWidth > 1 and GL_LINE_SMOOTH are not compatible // GL_SMOOTH_LINE_WIDTH_RANGE = (1,1) on iPhone glDisable(GL_LINE_SMOOTH); glLineWidth( 5.0f ); glColor4ub(255,0,0,255); ccDrawLine( ccp(0, s.height), ccp(s.width, 0) ); // TIP: // If you are going to use always the same color or width, you don't // need to call it before every draw // // Remember: OpenGL is a state-machine. // draw big point in the center glPointSize(64); glColor4ub(0,0,255,128); ccDrawPoint( ccp(s.width / 2, s.height / 2) ); // draw 4 small points CGPoint points[] = { ccp(60,60), ccp(70,70), ccp(60,70), ccp(70,60) }; glPointSize(4); glColor4ub(0,255,255,255); ccDrawPoints( points, 4); // draw a green circle with 10 segments glLineWidth(16); glColor4ub(0, 255, 0, 255); ccDrawCircle( ccp(s.width/2, s.height/2), 100, 0, 10, NO); // draw a green circle with 50 segments with line to center glLineWidth(2); glColor4ub(0, 255, 255, 255); ccDrawCircle( ccp(s.width/2, s.height/2), 50, CC_DEGREES_TO_RADIANS(90), 50, YES); // open yellow poly glColor4ub(255, 255, 0, 255); glLineWidth(10); CGPoint vertices[] = { ccp(0,0), ccp(50,50), ccp(100,50), ccp(100,100), ccp(50,100) }; ccDrawPoly( vertices, 5, NO); // closed purble poly glColor4ub(255, 0, 255, 255); glLineWidth(2); CGPoint vertices2[] = { ccp(30,130), ccp(30,230), ccp(50,200) }; ccDrawPoly( vertices2, 3, YES); // closed purble poly 正方形 glColor4ub(255, 0, 255, 255); glLineWidth(2); CGPoint vertices3[] = { ccp(30,130), ccp(30,230), ccp(60,230), ccp(60,130) }; ccDrawPoly( vertices3, 4, YES); // draw quad bezier path ccDrawQuadBezier(ccp(0,s.height), ccp(s.width/2,s.height/2), ccp(s.width,s.height), 50); // draw cubic bezier path ccDrawCubicBezier(ccp(s.width/2, s.height/2), ccp(s.width/2+30,s.height/2+50), ccp(s.width/2+60,s.height/2-50),ccp(s.width, s.height/2),100); // restore original values glLineWidth(1); glColor4ub(255,255,255,255); glPointSize(1); }
蜘蛛例子
// Only draw this debugging information in, well, debug builds. -(void) draw { #if DEBUG // Iterate through all nodes of the layer. CCNode* node; CCARRAY_FOREACH([self children], node) { // Make sure the node is a CCSprite and has the right tags. if ([node isKindOfClass:[CCSprite class]] && (node.tag == 1 || node.tag == 2)) { // The sprite's collision radius is a percentage of its image width. Use that to draw a circle // which represents the sprite's collision radius. CCSprite* sprite = (CCSprite*)node; float radius = [sprite texture].contentSize.width * 0.4f; float angle = 0; int numSegments = 10; bool drawLineToCenter = NO; ccDrawCircle(sprite.position, radius, angle, numSegments, drawLineToCenter); } } #endif CGSize screenSize = [[CCDirector sharedDirector] winSize]; // always keep variables you have to calculate only once outside the loop float threadCutPosition = screenSize.height * 0.75f; // Draw a spider thread using OpenGL // CCARRAY_FOREACH is a bit faster than regular for loop CCSprite* spider; CCARRAY_FOREACH(spiders, spider) { // only draw thread up to a certain point if (spider.position.y > threadCutPosition) { // vary thread position a little so it looks a bit more dynamic float threadX = spider.position.x + (CCRANDOM_0_1() * 2.0f - 1.0f); glColor4f(0.5f, 0.5f, 0.5f, 1.0f); ccDrawLine(spider.position, CGPointMake(threadX, screenSize.height)); } } } @end
发表评论
-
sprite list 白边
2012-01-17 11:32 824很奇怪的白边问题 就是sprite list!切图会变成白色 ... -
cocos2d 内存整理
2011-12-31 11:29 1492[[CCSpriteFrameCache sharedSp ... -
CCTransitionScene
2011-12-28 19:08 1020//淡入淡出 CCFadTransition *tran = ... -
(转)cocos2d的常用动作及效果总结之五:Animation
2011-12-12 15:57 0这一篇是讲一下如何在cocos2d中实现动画。 实现动画的步 ... -
(转)cocos2d的常用动作及效果总结之四:Special Actions
2011-12-12 15:53 1971Special Actions 个人理解包含三部分,一个是函数 ... -
(转)cocos2d的常用动作及效果总结之三:Ease actions
2011-12-12 15:51 6289Ease actions 影响的是动作的时间线性。 举个例子 ... -
cocos2d的常用动作及效果总结之二:Composition actions
2011-12-12 15:49 1929上一篇整理了 basice action 基本动作的部分,这 ... -
(转)cocos2d的常用动作及效果总结之一: Basic actions
2011-12-12 15:47 3578在官方网站上,对cocos2d ... -
xcode 4 Add Existing Framework
2011-11-14 11:52 1241现在的记性十分不好!老是记不住xcode 4如何Add Exi ... -
(转)iphone应用开发:发送短信/邮件/打电话
2011-11-10 10:46 1184+ (void) makeCall:(NSString *)p ... -
cocos2d 添加 原生得空间的类:CCUIViewWrapper 的用法
2011-11-03 11:55 1910UIView *myView = [[[UIView allo ... -
【转】【Cocos2d游戏开发之一】多触点与触屏事件详解(单一监听、事件分发)
2011-09-20 11:46 1396原文地址:http://blog.csdn ... -
cocos2d 的一些实用代码
2011-09-15 10:51 22951.问题描述: 如果我想让一个 sprite 显示3秒钟然后消 ... -
mac 的一些基本操作
2011-09-08 13:34 8041.寻找共享文件: 以前在windows上输入:\\192 ... -
[转]Cocos2D的4个基本概念
2011-09-06 18:35 1809开发cocos2d 应用程序,必须先了解如下4个概念: Sce ... -
(转) iphone 开发常用到的代码
2011-07-12 11:01 2116- (NSString *)URLEncodedString: ... -
iphone 升级到4.3.3 编译出现的问题
2011-05-25 15:46 1810unable to load symbol file: una ... -
iphone sdk 更新
2011-05-25 12:01 1175ipad被升级到4.3.3版本,但是使用device测试的时候 ... -
iphone in-app-purchase 注意的地方
2011-05-24 12:03 2034使用apple in-app-purchase 还是很麻烦! ... -
iphone 开发的一些错误 与答案
2011-05-23 17:47 7691。local declaration of 'delegat ...
相关推荐
MFC下实现全屏OpenGL,绘制三维茶壶,支持鼠标键盘控制视图
draw 3D object in openGL
基于mfc的opengl绘图案例,主要为在mfc下绘制opengl图形提供一个框架。
在windows 下,使用qt opengl 绘制纹理,并将两张图片采样色彩混合成一张图片。
使用opengl 绘制水印。qt,win10环境下。注意必须先绘制水印,再绘制图片。不然水印会被图片覆盖。
OPENGL is a visual component, which provides a simple user interface for drawing simple OPENGL. User can draw nodes (vertices) on the control s client area and link them together (graph s edges or ...
OpenGL 深度测试OpenGL 深度测试OpenGL 深度测试OpenGL 深度测试OpenGL 深度测试OpenGL 深度测试OpenGL 深度测试OpenGL 深度测试OpenGL 深度测试OpenGL 深度测试OpenGL 深度测试OpenGL 深度测试OpenGL 深度测试...
opengl es base introduction
OpenGL论文 OpenGL论文 OpenGL论文 OpenGL论文 OpenGL论文
OpenGL教程 OpenGL教程 OpenGL教程 OpenGL教程 OpenGL教程
OpenGL 混合OpenGL 混合OpenGL 混合OpenGL 混合OpenGL 混合OpenGL 混合OpenGL 混合OpenGL 混合OpenGL 混合OpenGL 混合OpenGL 混合OpenGL 混合OpenGL 混合OpenGL 混合OpenGL 混合OpenGL 混合OpenGL 混合OpenGL 混合...
OpenGL实例 OpenGL实例 OpenGL实例 OpenGL实例 OpenGL实例
opengl c++opengl c++opengl c++opengl c++opengl c++opengl c++
OpenGL教材 OpenGL教材 OpenGL教材 OpenGL教材 OpenGL教材
OpenGL3.3_Instance_Base.rarOpenGL3.3_Instance_Base.rarOpenGL3.3_Instance_Base.rarOpenGL3.3_Instance_Base.rarOpenGL3.3_Instance_Base.rar
NeHe OpenGL NeHe OpenGL NeHe OpenGL NeHe OpenGL
OpenGL教程OpenGL教程OpenGL教程OpenGL教程OpenGL教程
OpenGL+qt抗锯齿OpenGL+qt抗锯齿OpenGL+qt抗锯齿OpenGL+qt抗锯齿OpenGL+qt抗锯齿OpenGL+qt抗锯齿OpenGL+qt抗锯齿OpenGL+qt抗锯齿OpenGL+qt抗锯齿OpenGL+qt抗锯齿OpenGL+qt抗锯齿OpenGL+qt抗锯齿OpenGL+qt抗锯齿...
visual c++ 中运用openGL绘图,包含3d绘图,点、线、面的绘制,功能强大
画一个3D图像...........非常易于学习