Lots of UI Component Updates

This commit is contained in:
2022-10-27 08:16:55 -07:00
parent 57b3354d4c
commit 942de96e16
25 changed files with 387 additions and 56 deletions

View File

@ -5,13 +5,12 @@
#include "DawnPokerGame.hpp"
#include "asset/assets/TextureAsset.hpp"
#include "ui/UIBorder.hpp"
using namespace Dawn;
std::shared_ptr<TrueTypeAsset> asset;
std::shared_ptr<TextureAsset> assetTexture;
std::shared_ptr<UILabel> label;
float_t fs = 1.0f;
DawnGame::DawnGame(DawnHost &host) :
host(host),
@ -38,6 +37,13 @@ int32_t DawnGame::init() {
this->assetManager.update();
}
auto border = canvas->addElement<UIBorder>();
border->texture = assetTexture->texture.get();
border->setTransform(
UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH,
glm::vec4(32, 32, 32, 32), 0.0f
);
// auto sprite = canvas->addElement<UISprite>();
// sprite->setTransform(
// UI_COMPONENT_ALIGN_START,
@ -47,17 +53,6 @@ int32_t DawnGame::init() {
// );
// sprite->texture = &asset->font.getTexture();
label = canvas->addElement<UILabel>();
label->setTransform(
UI_COMPONENT_ALIGN_START,
UI_COMPONENT_ALIGN_START,
glm::vec4(0, 0, 200, 200),
0
);
label->setText("Hello World\nHow are you today?");
label->setFont(&asset->font);
return DAWN_GAME_INIT_RESULT_SUCCESS;
}
@ -66,8 +61,6 @@ int32_t DawnGame::update(float_t delta) {
this->inputManager.update();
if(this->scene != nullptr) this->scene->update();
label->setFontSize(fs += delta);
this->renderManager.update();