poorman
분류 전체보기
(417)
Algorithm
(18)
Baekjoon
(18)
Programming
(321)
OpenCV
(23)
Lumberyard
(3)
OpenGL
(3)
Deep Learning
(15)
MFC
(89)
WPF
(36)
Git
(20)
Unity
(13)
Cocos
(2)
Python
(12)
Django
(13)
Spark
(1)
Linux Coding
(65)
C Library
(3)
PIC - Microchip
(2)
Error Message
(19)
Note
(0)
MAC
(2)
TPG
(5)
Cthulhu
(5)
Poorman Cellar
(13)
Poorman Tool
(5)
Poorman Lib
(2)
Poorman GUI
(3)
Useful Software
(3)
Private
(39)
Movie
(7)
Book
(1)
My Novel
(4)
Magazine
(2)
Jpop
(6)
Food
(5)
BoardGame
(4)
Diary
(10)
Trip
(4)
Japan
(4)
Study
(2)
Chinese
(0)
English
(2)
TISTORY
(8)
HTML
(2)
Event
(6)
Beta
(7)
홈
태그
미디어로그
위치로그
방명록
poorman-code
/
/
[기본] 기본 소스 코드
2016. 10. 16. 21:50
// on "init" you need to initialize your instance bool HelloWorld::init() { ////////////////////////////// // 1. super init first if ( !Layer::init() ) { return false; } auto visibleSize = Director::getInstance()->getVisibleSize(); Vec2 origin = Director::getInstance()->getVisibleOrigin(); ///////////////////////////// // 2. add a menu item with "X" image, which is clicked to quit the program // you may modify it. // add a "close" icon to exit the progress. it's an autorelease object auto closeItem = MenuItemImage::create( "CloseNormal.png", "CloseSelected.png", CC_CALLBACK_1(HelloWorld::menuCloseCallback, this)); closeItem->setPosition(Vec2(origin.x + visibleSize.width - closeItem->getContentSize().width/2 , origin.y + closeItem->getContentSize().height/2)); // create menu, it's an autorelease object auto menu = Menu::create(closeItem, NULL); menu->setPosition(Vec2::ZERO); this->addChild(menu, 1); ///////////////////////////// // 3. add your codes below... // add a label shows "Hello World" // create and initialize a label auto label = Label::createWithTTF("Hello World", "fonts/Marker Felt.ttf", 24); // position the label on the center of the screen label->setPosition(Vec2(origin.x + visibleSize.width/2, origin.y + visibleSize.height - label->getContentSize().height)); // add the label as a child to this layer this->addChild(label, 1); // add "HelloWorld" splash screen" auto sprite = Sprite::create("HelloWorld.png"); // position the sprite on the center of the screen sprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); // add the sprite as a child to this layer this->addChild(sprite, 0); return true; }
공유하기
URL 복사
카카오톡 공유
페이스북 공유
엑스 공유
게시글 관리
구독하기
poorman
'
Programming
>
Cocos
' 카테고리의 다른 글
[기본] 튜토리얼 소스 코드
(0)
2016.10.16
+ Recent posts
Powered by
Tistory
, Designed by
wallel
Rss Feed
and
Twitter
,
Facebook
,
Youtube
,
Google+
티스토리툴바
닫기
단축키
내 블로그
내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W
블로그 게시글
글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C
모든 영역
이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift
+
/
⇧
+
/
* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.