텍스트 출력예제 (SystemFont 사용)



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
#include "test74.hpp"
#include "SimpleAudioEngine.h"
 
USING_NS_CC;
 
Scene* Test74::createScene()
{
    auto scene = Scene::create();
    
    auto layer = Test74::create();
    scene->addChild(layer);
    
    return scene;
}
 
 
bool Test74::init()
{
    if ( !Layer::init())
    {
        return false;
    }
 
    //Label 사용 예제
    //SystemFont : 내장되어 있는 ttf 파일 사용
    //createWithSystemFont("텍스트" , "폰트이름" , "폰트크기")
    auto label = Label::createWithSystemFont("Hello World""arial"34);
    label->setPosition(Point(240,160));
    this->addChild(label);
    
    
    return true;
}
cs



결과




+ Recent posts