Just breaking stuff
This commit is contained in:
25
archive/dawnpokergame/prefabs/ui/UIBorderPrefab.hpp
Normal file
25
archive/dawnpokergame/prefabs/ui/UIBorderPrefab.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "prefab/UIPrefab.hpp"
|
||||
#include "ui/UIBorder.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class UIBorderPrefab : public UIPrefab<UIBorder, UIBorderPrefab> {
|
||||
public:
|
||||
static std::vector<Asset*> prefabAssets(AssetManager *man) {
|
||||
std::vector<Asset*> assets;
|
||||
assets.push_back(man->get<TextureAsset>("texture_test"));
|
||||
return assets;
|
||||
}
|
||||
|
||||
static void prefabApply(AssetManager *man, UIBorder *border) {
|
||||
auto text = man->get<TextureAsset>("texture_test");
|
||||
border->texture = &text->texture;
|
||||
border->setBorderSize(glm::vec2(4, 4));
|
||||
}
|
||||
};
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "prefabs/ui/UIBorderPrefab.hpp"
|
||||
#include "visualnovel/ui/VisualNovelTextbox.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class VisualNovelTextboxPrefab :
|
||||
public UIPrefab<VisualNovelTextbox, VisualNovelTextboxPrefab>
|
||||
{
|
||||
public:
|
||||
static std::vector<Asset*> prefabAssets(AssetManager *man) {
|
||||
std::vector<Asset*> assets;
|
||||
assets.push_back(man->get<TrueTypeAsset>("truetype_bizudp"));
|
||||
vectorAppend(&assets, UIBorderPrefab::getRequiredAssets(man));
|
||||
return assets;
|
||||
}
|
||||
|
||||
static void prefabApply(AssetManager *man, VisualNovelTextbox *textbox) {
|
||||
auto assetFont = man->get<TrueTypeAsset>("truetype_bizudp");
|
||||
UIBorderPrefab::apply(&textbox->border);
|
||||
textbox->setFont(&assetFont->font);
|
||||
textbox->setFontSize(36.0f);
|
||||
textbox->setLabelPadding(glm::vec2(2, 2));
|
||||
textbox->label.textColor = COLOR_WHITE;
|
||||
|
||||
textbox->setTransform(
|
||||
UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_END,
|
||||
glm::vec4(
|
||||
0,
|
||||
(assetFont->font.getLineHeight(textbox->getFontSize()) * 4) +
|
||||
(textbox->border.getBorderSize().y * 2.0f) +
|
||||
(textbox->getLabelPadding().y * 2.0f),
|
||||
0, 0
|
||||
),
|
||||
0.0f
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user