mirror of
https://github.com/devZoGok/vb01.git
synced 2026-08-26 19:43:30 +00:00
updated text sample
This commit is contained in:
+11
-6
@@ -28,7 +28,7 @@ int main(){
|
|||||||
wstring texts[] = {
|
wstring texts[] = {
|
||||||
L"대한민국",
|
L"대한민국",
|
||||||
L"ĄČĘĖĮŠŲŪ„“",
|
L"ĄČĘĖĮŠŲŪ„“",
|
||||||
L"عشر",
|
L"عشرة",
|
||||||
L"中華民國"
|
L"中華民國"
|
||||||
};
|
};
|
||||||
string fonts[] = {
|
string fonts[] = {
|
||||||
@@ -57,22 +57,26 @@ int main(){
|
|||||||
Material *textMat = new Material(PATH + "text");
|
Material *textMat = new Material(PATH + "text");
|
||||||
textMat->addBoolUniform("texturingEnabled", true);
|
textMat->addBoolUniform("texturingEnabled", true);
|
||||||
|
|
||||||
|
//Loads the assets to be stored and retrievable at a later time
|
||||||
string frames[]{TEX_PATH + "bricks.jpg", TEX_PATH + "defaultTexture.jpg"};
|
string frames[]{TEX_PATH + "bricks.jpg", TEX_PATH + "defaultTexture.jpg"};
|
||||||
AssetManager::getSingleton()->load(frames[0]);
|
AssetManager::getSingleton()->load(frames[0]);
|
||||||
AssetManager::getSingleton()->load(frames[1]);
|
AssetManager::getSingleton()->load(frames[1]);
|
||||||
|
|
||||||
Texture *texture = new Texture(frames, 2, false);
|
Texture *texture = new Texture(frames, 2, false);
|
||||||
textMat->addTexUniform("textures[0]", texture, true);
|
textMat->addTexUniform("textures[0]", texture, true);
|
||||||
|
|
||||||
for(int i = 0; i < numTexts; i++){
|
for(int i = 0; i < numTexts; i++){
|
||||||
AssetManager::getSingleton()->load(FONT_PATH + fonts[i]);
|
string font = FONT_PATH + fonts[i];
|
||||||
|
AssetManager::getSingleton()->load(font);
|
||||||
|
|
||||||
Text *text = new Text(FONT_PATH + fonts[i], texts[i], 0, 60000);
|
//Specifies the range where to look for characters used in the current font
|
||||||
|
Text *text = new Text(font, texts[i], 0, 60000);
|
||||||
text->setLeftToRight(leftToRight[i]);
|
text->setLeftToRight(leftToRight[i]);
|
||||||
text->setScale(.5);
|
text->setScale(.5);
|
||||||
text->setHorizontal(horizontal[i]);
|
text->setHorizontal(horizontal[i]);
|
||||||
text->setMaterial(textMat);
|
text->setMaterial(textMat);
|
||||||
|
|
||||||
Node *textNode = new Node(Vector3(0, 50 * (i + 1), 0), Quaternion::QUAT_W, Vector3::VEC_IJK, "");
|
Node *textNode = new Node(Vector3(0, 50 * (i + 1), 0));
|
||||||
textNode->addText(text);
|
textNode->addText(text);
|
||||||
guiNode->attachChild(textNode);
|
guiNode->attachChild(textNode);
|
||||||
|
|
||||||
@@ -101,7 +105,8 @@ int main(){
|
|||||||
KeyframeChannel::createKeyframe(Keyframe::LINEAR, 0, 29)
|
KeyframeChannel::createKeyframe(Keyframe::LINEAR, 0, 29)
|
||||||
});
|
});
|
||||||
|
|
||||||
Animation *anim = new Animation("tex");
|
string animName = "tex";
|
||||||
|
Animation *anim = new Animation(animName);
|
||||||
anim->addKeyframeChannel(kcA);
|
anim->addKeyframeChannel(kcA);
|
||||||
anim->addKeyframeChannel(kcB);
|
anim->addKeyframeChannel(kcB);
|
||||||
anim->addKeyframeChannel(kcC);
|
anim->addKeyframeChannel(kcC);
|
||||||
@@ -115,7 +120,7 @@ int main(){
|
|||||||
AnimationChannel *channel = new AnimationChannel();
|
AnimationChannel *channel = new AnimationChannel();
|
||||||
controller->addAnimationChannel(channel);
|
controller->addAnimationChannel(channel);
|
||||||
channel->addAnimatable(texture);
|
channel->addAnimatable(texture);
|
||||||
channel->setAnimationName("tex");
|
channel->setAnimationName(animName);
|
||||||
channel->setLoop(true);
|
channel->setLoop(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user