Cocos2d-x 기본 자료형 (Point , Size , Rect) 예제
c++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #include "HelloWorldScene.h" #include "SimpleAudioEngine.h" USING_NS_CC; Scene* HelloWorld::createScene() { auto scene = Scene::create(); auto layer = HelloWorld::create(); scene->addChild(layer); return scene; } bool HelloWorld::init() { if ( !Layer::init() ) { return false; } auto visibleSize = Director::getInstance()->getVisibleSize(); Vec2 origin = Director::getInstance()->getVisibleOrigin(); /** 코코스2d 기본자료형 */ //Point Point point = Point(240,160); CCLOG("x : %f , y : %f", point.x , point.y); //Size Size size = Size(100, 100); CCLOG("width : %f , height : %f", size.width , size.height); //Rect Rect rect = Rect(240, 160, 100, 100); CCLOG("(x,y) : (%f,%f) , width : %f , height : %f" , rect.origin.x , rect.origin.y , rect.size.width , rect.size.height); return true; } | cs |
결과
1 2 3 4 | x : 240.000000 , y : 160.000000 width : 100.000000 , height : 100.000000 (x,y) : (240.000000,160.000000) , width : 100.000000 , height : 100.000000 | cs |
'IT > - 프로그래밍' 카테고리의 다른 글
코코스 Cocos 기본 메서드 예제 (setOpacity , setScale , setRotation , setFlippedX) (0) | 2017.01.12 |
---|---|
C/C++ Visual Studio 2015 설치하기 (0) | 2017.01.11 |
안드로이드 Error:java.lang.OutOfMemoryError: GC overhead limit exceeded 에러 (0) | 2017.01.09 |
코코스 전체 이미지중 일부 이미지만 보여주기 및 레이어 이동하기 (0) | 2017.01.06 |
코코스 Hello World 및 이미지 추가하기 (0) | 2017.01.05 |