千锋3G学院-iOS开发视频教程-愤怒的小鸟-第09讲-坐标转换.pdf

  • 文件大小: 5.76MB
  • 文件类型: pdf
  • 上传日期: 2025-08-17
  • 下载次数: 0

概要信息:

源⾃自清华 值得信赖 
中国移动互联⺴⽹网研发培训专家 
欧阳坚 
视频、源代码、交流网址 
www.1000phone.net 
源⾃自清华 值得信赖 
中国移动互联⺴⽹网研发培训专家 
源⾃自清华 值得信赖 
中国移动互联⺴⽹网研发培训专家 
2.  ccTouches标准触摸 
1.  OpenGL和UIView坐标系统 
4.  CGRectContainsPoint 
3.  ccTouch Cocos2D特有触摸 
源⾃自清华 值得信赖 
中国移动互联⺴⽹网研发培训专家 
Y坐标 箭头方向为正	
X
坐
标
箭
头
⽅方
向
为
正
	
源⾃自清华 值得信赖 
中国移动互联⺴⽹网研发培训专家 
X坐标 箭头方向为正	
Y
坐
标
箭
头
⽅方
向
为
正
	
源⾃自清华 值得信赖 
中国移动互联⺴⽹网研发培训专家 
世界坐标: 
      屏幕上原点基于(0,0)的笛卡尔坐标系(此时原点为屏幕左下
⾓角), 坐标x向右增⻓长,y向上增⻓长. x,y都是⼤大于等于0. 
  
对象窗⼝口内的坐标: 
      窗⼝口原点基于(0,0)的笛卡尔坐标系(此时原点为窗⼝口左下⾓角), 
坐标x向右增⻓长,y向上增⻓长. x,y都是⼤大于等于0. 
  
基于锚点的窗⼝口内的坐标: 
      窗⼝口原点基于锚点(x,y)的笛卡尔坐标系(此时原点为锚点), 坐标x
向右增⻓长,y向上增⻓长。 x,y可以为负数或者正数以及0。 
 
源⾃自清华 值得信赖 
中国移动互联⺴⽹网研发培训专家 
location = [[CCDirector sharedDirector]  
                              convertToGL:location]; 
 
把UIView坐标转换成OpenGL坐标 
-(CGPoint)convertToGL:(CGPoint)uiPoint 
 
把OpenGL坐标转换成UIView坐标 
-(CGPoint)convertToUI:(CGPoint)glPoint 
 
源⾃自清华 值得信赖 
中国移动互联⺴⽹网研发培训专家 
这个函数把世界坐标转换为对象窗⼝口内的坐标。 
- (CGPoint)convertToNodeSpace:(CGPoint)worldPoint 
这个函数把世界坐标转换为基于锚点的窗⼝口内的坐标。 
- (CGPoint)convertToNodeSpaceAR:(CGPoint)worldPoint 
这个函数把对象窗⼝口内的坐标转换为世界坐标。 
- (CGPoint)convertToWorldSpace:(CGPoint)nodePoint 
这个函数把基于锚点的对象窗⼝口内的坐标转换为世界坐标。 
- (CGPoint)convertToWorldSpaceAR:(CGPoint)nodePoint 
封装函数 
- (CGPoint)convertTouchToNodeSpace:(UITouch *)touch 
- (CGPoint)convertTouchToNodeSpaceAR:(UITouch *)touch 
 
源⾃自清华 值得信赖 
中国移动互联⺴⽹网研发培训专家 
}  CCStandardTouchDelegate标准代理函数 
@protocol CCStandardTouchDelegate  
@optional 
- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; 
- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; 
- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; 
- (void)ccTouchesCancelled:(NSSet *)touches withEvent:(UIEvent 
*)event; 
@end 
源⾃自清华 值得信赖 
中国移动互联⺴⽹网研发培训专家 
}  CCTargetedTouchDelegate 代理函数 
@protocol CCTargetedTouchDelegate  
- (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event; 
@optional 
- (void)ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event; 
- (void)ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event; 
- (void)ccTouchCancelled:(UITouch *)touch withEvent:(UIEvent *)event; 
@end 
-(void) addTargetedDelegate:(id) 
          delegate priority:(int)priority  
          swallowsTouches:(BOOL)swallowsTouches; 
源⾃自清华 值得信赖 
中国移动互联⺴⽹网研发培训专家 
- (CGRect) boundingBox; 
boundingBox 函数⽤用来取得经过缩放和旋转之后的
外框⼤大⼩小 
源⾃自清华 值得信赖 
中国移动互联⺴⽹网研发培训专家 
bool CGRectContainsPoint( 
                  CGRect rect, CGPoint point) 
 
bool CGRectIntersectsRect( 
                  CGRect rect1, CGRect rect2) 
bool CGRectContainsRect( 
                  CGRect rect1, CGRect rect2) 
源⾃自清华 值得信赖 
中国移动互联⺴⽹网研发培训专家 
} 千锋互联:          www.1000phone.com 
} 千锋3G学院:       www.mobiletrain.org 
} 千锋嵌入式学院:  www.embedtrain.org

缩略图:

  • 缩略图1
  • 缩略图2
  • 缩略图3
  • 缩略图4
  • 缩略图5
当前页面二维码

广告: