IT/- 프로그래밍
코코스 CharMap 폰트 사용하기
혁준7519
2017. 1. 23. 09:19
CharMap 폰트 사용하기
Resources 폴더에 CharMap 폰트파일 추가 (.png 파일)
c++)
createWithCharMap() 함수 사용
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 | #include "test84.hpp" USING_NS_CC; Scene* Test84::createScene() { auto scene = Scene::create(); auto layer = Test84::create(); scene->addChild(layer); return scene; } bool Test84::init() { if ( !Layer::init()) { return false; } //createWithCharMap(CharMap폰트명, 글자너비, 글자높이, 이미지에서 아스크코드값) auto label = Label::createWithCharMap("labelatlas.png", 16, 32, '.'); label->setString("012345"); //텍스트 label->setAnchorPoint(Point(0.5, 0.5)); //앵커포인트 (기본앵커포인트 : 0,0) label->setPosition(Point(150, 150)); this->addChild(label); return true; } | cs |
결과