본문 바로가기

카테고리 없음

[cocos2d-x]기타 메소드를 이용한 라벨 예제

 

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
#include "HelloWorldScene.h"
 
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 label_0 = Label::createWithSystemFont("Hello World""Thonburi"50 );
    label_0->setPosition(Point(240220));
  //label_0->setColor(Color3B(255, 0, 0));
    label_0->setColor(Color3B(010255));
    this->addChild(label_0);
 
    auto label_1 = Label::createWithSystemFont("Shadow""Thonburi"50);
    label_1->setPosition(Point(240160));
    //label_1->enableShadow(Color4B::BLUE, Size(2, 2));
    label_1->enableShadow(Color4B::ORANGE, Size(4-3));
    this->addChild(label_1);
 
    auto label_2 = Label::createWithTTF("Outline""arial.ttf"50);
    label_2->setPosition(Point(240100));
  //label_2->enableOutline(Color4B::RED, 2);
    label_2->enableOutline(Color4B::GREEN, 3);
    this->addChild(label_2);
 
    return true;
}
cs
 

실행 결과



수정 결과