Working on time and input

This commit is contained in:
2022-10-27 23:38:04 -07:00
parent 942de96e16
commit 37eaa706b7
16 changed files with 196 additions and 18 deletions

View File

@ -5,11 +5,12 @@
#include "DawnPokerGame.hpp"
#include "asset/assets/TextureAsset.hpp"
#include "ui/UIBorder.hpp"
#include "asset/assets/TrueTypeAsset.hpp"
#include "visualnovel/ui/VisualNovelTextbox.hpp"
using namespace Dawn;
std::shared_ptr<TrueTypeAsset> asset;
std::shared_ptr<TrueTypeAsset> assetFont;
std::shared_ptr<TextureAsset> assetTexture;
DawnGame::DawnGame(DawnHost &host) :
@ -31,17 +32,19 @@ int32_t DawnGame::init() {
auto canvas = UICanvas::createCanvas(this->scene);
asset = this->assetManager.load<TrueTypeAsset>("truetype_ark");
assetFont = this->assetManager.load<TrueTypeAsset>("truetype_ark");
assetTexture = this->assetManager.load<TextureAsset>("texture_test");
while(!asset->loaded || !assetTexture->loaded) {
while(!assetFont->loaded || !assetTexture->loaded) {
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 textbox = canvas->addElement<VisualNovelTextbox>();
textbox->border.texture = assetTexture->texture.get();
textbox->label.setFont(&assetFont->font);
textbox->label.setFontSize(40);
textbox->setTransform(
UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_END,
glm::vec4(0, 250, 0, 0), 0.0f
);
// auto sprite = canvas->addElement<UISprite>();
@ -59,6 +62,7 @@ int32_t DawnGame::init() {
int32_t DawnGame::update(float_t delta) {
this->assetManager.update();
this->inputManager.update();
this->timeManager.update(delta);
if(this->scene != nullptr) this->scene->update();

View File

@ -5,7 +5,4 @@
#pragma once
#include "game/DawnGame.hpp"
#include "scene/components/Components.hpp"
#include "ui/UILabel.hpp"
#include "ui/UISprite.hpp"
#include "asset/assets/TrueTypeAsset.hpp"
#include "scene/components/Components.hpp"