5. and much more
• Unreal Engine : Unreal Development Kit for
iOS
• https://www.youtube.com/watch?
v=J9hAHv-Lhzc
• Marmalade, Stonetrip S3D
13년 2월 7일 목
6. cocos2d games
Tap Pet Hotel: #1 Free Zombie Farm: #6 Free
Tap Zoo: #2 Free iStunt 2: #6 Free
13년 2월 7일 목
7. cocos2d games
Air Penguin: #1 Paid ZombieSmash: #1 Paid
Fishing Frenzy: #7 Paid Trainyard: #2 Paid
13년 2월 7일 목
9. Cocos2D
• 오픈 소스 2D 프레임워크
• 2D 게임, 데모, 그래픽, 대화식 응용프로그램
• 2008년 9월 0.3.0 발표
• 수백개 이상의 앱이 Cocos2D로 개발되어 앱
스토어에 등록됨
13년 2월 7일 목
10. 특징
• Flow Control
• 서로 다른 Scene간의 흐름제어
• Sprite
• 손쉽고 빠른 스프라이트 활용
• Action
• move, rotate, scale등의 액션 수행
13년 2월 7일 목
11. 특징
• Effect
• Wave, twirl, lens등의 다양한 2D 효과
• Tiled Maps, Transition, Menus, Text
Rendering
• 물리엔진제공 : Chipmunk, Box2d, Particle
System
13년 2월 7일 목
12. 특징
• Parallax scrolling
• High Score server(Cocos live)
• OpenGL ES 1.1 기반 - iOS
• OpenGL 1.5 기반 - Mac
13년 2월 7일 목
13. 장점
• 예제코드가 많이 포함되어 있다
• OpenGL ES의 Wrapping이다.
• OpenGL에 관한 지식이 있다면 매우 쉽게
배울 수 있다
• 용량이 적은 게임개발이 가능하며 풍부한 API
가 제공된다
13년 2월 7일 목
14. Cocos3D
• 2012.11. - cocos3d 0.7.2
• Objective-C 언어로 작성됨
13년 2월 7일 목
15. Cocos3D Features
• Seamless integration with cocos2d
• pluggable loading framework for 3d models
• 3d 모델 선택가능, 터치가능
• 3d 애니메이션 지원
• scene graph 구조를 통한 3d manipulation
• ......
http://brenwill.com/cocos3d/
13년 2월 7일 목
49. CCNode:
Transformation
- (CGAffineTransform)nodeToParentTransform;
- (CGAffineTransform)parentToNodeTransform;
- (CGAffineTransform)nodeToWorldTransform;
- (CGAffineTransform)worldToNodeTransform;
- (CGPoint)convertToNodeSpace:(CGPoint)worldPoint;
- (CGPoint)convertToWorldSpace:(CGPoint)nodePoint;
13년 2월 7일 목
50. CCNode: Actions
• Modify node’s attributes by time
• position/rotation/scale/opacity/grid
• Interval actions and Instant actions
13년 2월 7일 목
51. Scene Graph 구조
• 하나의 Scene이나 Layer에 객체들을 자식으로
추가(addChild)하여 이 객체들이 상호작용하
도록 프로그래밍함
• 객체들은 계층적으로 추가되거나 삭제될 수
있다
• 모든 객체들은 visible 속성을 가진다
13년 2월 7일 목
52. Scene Graph
CCScene
CCLayer CCLayer CCLayer
CCSprite CCMenu CCSprite
13년 2월 7일 목
53. Scene Graph 구조
• 벡터기반 그래픽스 시스템
에서 일반적으로 사용
• Acrobat 3D, Java 3D,
AutoCAD,VRML, Open
Inventor등에서 사용
• 트리형태의 노드를 이용하
여 장면을 구성
13년 2월 7일 목
54. CCNode 클래스
• Cocos2D의 가장 중요한 클래스
• CCScene, CCLayer, CCSprite, CCMenu가
가장 자주 사용되는 Cocos2D 클래스이며 이
들은 모두 CCNode의 자식이다
• CCNode를 포함할 수 있다. schedule 메소드
를 주기적으로 callback할 수 있다
• 액션을 수행할 수 있다
13년 2월 7일 목
55. CCNode 클래스
• 속성값
• rotation, scaleX_, scaleY_,position,
visible_, anchorPointInPixels_,
anchorPoint_, isRelativeAnchorPoint_,
contentSize_, transform_, inverse_,
vertexZ_, camera_, grid, zOrder_,
children_
13년 2월 7일 목
56. CCNode 클래스
• 속성값
• tag_, userData, isRunning_,
isTransformDirty_, isInverseDirty_,
isTransformGLDirty_, ...
13년 2월 7일 목
57. 주요속성
• 위치, 스케일(x,y),회전(degree,시계방
향),CCCamera(gluLookAt 함수의
interface), 앵커포인트, 크기, visible, z-order,
OpenGL의 z 위치
• tag 속성
• Scene Graph내의 노드를 구분하는 정수 값
13년 2월 7일 목
58. CCArray
• Scene Graph의 객체를 편리하게 다루기 위한
NSArray 클래스의 대용 클래스
• NSFastEnumeration, NSCoding 프로토콜을
준수
• count, capacity, indexOfObject, addObject,
insertObject, removeObject,
removeAllObjects등의 메소드를 가짐
13년 2월 7일 목
60. removeChild
-(void) removeChild: (CCNode*)child cleanup:(BOOL)cleanup
{
! if (child == nil)
! ! return;
!
! if ( [children_ containsObject:child] )
! ! [self detachChild:child cleanup:cleanup];
}
• Node객체의 하위 객체를 Scene Graph 구조에서 제
거함
• NSMutableArray *children_; 이라는 속
성값이 CCNode에 있으며 children_ 배열에
CCNode 객체를 추가하거나 제거하는 것이
addChild, removeChild가 하는 일이다.
13년 2월 7일 목
78. runWithScene
• runWithScene이 하는 일
디폴트 디렉터는 CCTimerDirector임
13년 2월 7일 목
79. runWithScene
• runWithScene이 하는 일
디폴트 디렉터는 CCTimerDirector임
13년 2월 7일 목
80. runWithScene
• runWithScene이 하는 일
디폴트 디렉터는 CCTimerDirector임
역시 NSTimer를 통해 특정 루프를 호출
13년 2월 7일 목
81. runWithScene
• runWithScene이 하는 일
디폴트 디렉터는 CCTimerDirector임
역시 NSTimer를 통해 특정 루프를 호출
13년 2월 7일 목
82. CCScene
• CCScene은 anchor point를 화면의 중심으로
둔다
• 모든 노드의 부모 노드 역할
13년 2월 7일 목
83. CCLayer
• UIAccelerometerDelegate, CCStandardTouchDelegate,
CCTargetedTouchDelegate 프로토콜을 구현
• 터치 이벤트를 처리하는 방식으로 Targeted Touch Delegate는
1)싱글 터치만을 처리하는 메소드를 제공함, 2) ccTouchBegan
메소드가 필수 메소드임(부울형 YES/NO를 반환함)
• CCStandardTouchDelegate는 멀티터치를 지원함
13년 2월 7일 목
84. CCLayer
• CCLayer는 Accelerometer, Touch를 처리하
는 메소드를 가진다
• 레이어의 색상이나 크기를 지정할 수 있는 메
소드를 가진다
• draw 메소드를 통하여 Blending이나 texture
를 표현할 수 있다
13년 2월 7일 목
85. CCMenu
• CCLayer의 자식 클래스(Touch를 받아야 하
므로)
• MenuItem을 추가하는 기능(CCMenuItem 클
래스의 객체들만 자식으로 추가할 수 있다)
• 수직, 수평 정렬기능
13년 2월 7일 목
86. CCMenuItem
• CCNode의 자식 클래스
• CCMenuItemImage, CCMenuItemFont,
CCMenuItemAtlasFont,
CCMenuItemLabel, CCMenuItemSprite등의
하위클래스를 가짐
• NSInvocation 객체를 통해 메뉴선택시 메소
드를 invoke시킴
13년 2월 7일 목
87. CCAction
• originalTarget(id형), target (id형), tag(int 형)
속성을 가짐
• NSObject의 자식 클래스-하위 노드를 가질
수 있음
• CCAction의 하위클래스
• CCIntervalAction, CCFiniteTimeAction,
CCSpeed, CCRepeatForever, CCFollow
13년 2월 7일 목