46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
// Copyright (c) 2022 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#pragma once
|
|
#include "ui/PokerGameBorder.hpp"
|
|
#include "visualnovel/ui/VisualNovelTextbox.hpp"
|
|
#include "asset/assets/TrueTypeAsset.hpp"
|
|
|
|
namespace Dawn {
|
|
class PokerGameTextbox {
|
|
public:
|
|
static std::vector<Asset*> getAssets(AssetManager *man) {
|
|
assertNotNull(man);
|
|
|
|
std::vector<Asset*> assets;
|
|
vectorAppend(&assets, &PokerGameBorder::getAssets(man));
|
|
assets.push_back(man->get<TrueTypeAsset>("truetype_ark"));
|
|
return assets;
|
|
}
|
|
|
|
static void apply(VisualNovelTextbox *textbox) {
|
|
assertNotNull(textbox);
|
|
|
|
auto assetFont = textbox->getGame()->assetManager.get<TrueTypeAsset>("truetype_ark");
|
|
PokerGameBorder::apply(&textbox->border);
|
|
textbox->setFont(&assetFont->font);
|
|
textbox->setFontSize(40);
|
|
textbox->setLabelPadding(glm::vec2(10, 8));
|
|
}
|
|
|
|
static VisualNovelTextbox * create(UICanvas *canvas) {
|
|
assertNotNull(canvas);
|
|
|
|
auto textbox = canvas->addElement<VisualNovelTextbox>();
|
|
PokerGameTextbox::apply(textbox);
|
|
textbox->setTransform(
|
|
UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_END,
|
|
glm::vec4(0, 238, 0, 0),
|
|
0.0f
|
|
);
|
|
return textbox;
|
|
}
|
|
};
|
|
} |