Dawn/src/dawnbarrygame/prefabs/VisualNovelTextboxPrefab.hpp

36 lines
1.1 KiB
C++

// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "prefabs/UIBorderPrefab.hpp"
#include "visualnovel/ui/VisualNovelTextbox.hpp"
namespace Dawn {
class VisualNovelTextboxPrefab : public UIPrefab<VisualNovelTextbox> {
public:
static std::vector<Asset*> getAssets(AssetManager *man) {
std::vector<Asset*> assets{
man->get<TrueTypeAsset>("truetype_ark")
};
vectorAppend(&assets, &UIBorderPrefab::getAssets(man));
return assets;
}
static void uiApply(VisualNovelTextbox *textbox) override {
assertNotNull(textbox);
auto assetFont = textbox->getGame()->assetManager.get<TrueTypeAsset>("truetype_ark");
UIBorderPrefab::uiApply(&textbox->border);
textbox->setFont(&assetFont->font);
textbox->setFontSize(40);
textbox->setLabelPadding(glm::vec2(10, 8));
textbox->setTransform(
UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_END,
glm::vec4(0, 238, 0, 0),
0.0f
);
}
}
}