Keep on improving fonts.
This commit is contained in:
@ -8,4 +8,5 @@ target_sources(${DAWN_TARGET_NAME}
|
||||
PRIVATE
|
||||
PixelVNScene.cpp
|
||||
PokerVNScene.cpp
|
||||
TestUIScene.cpp
|
||||
)
|
54
src/dawnpokergame/scenes/TestUIScene.cpp
Normal file
54
src/dawnpokergame/scenes/TestUIScene.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "TestUIScene.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
TestUIScene::TestUIScene(DawnGame *game) : Scene(game) {
|
||||
|
||||
}
|
||||
|
||||
std::vector<Asset*> TestUIScene::getRequiredAssets() {
|
||||
std::vector<Asset*> assets;
|
||||
AssetManager *man = &this->game->assetManager;
|
||||
assets.push_back(man->get<TrueTypeAsset>("truetype_alice"));
|
||||
assets.push_back(man->get<TextureAsset>("texture_test"));
|
||||
return assets;
|
||||
}
|
||||
|
||||
void TestUIScene::stage() {
|
||||
AssetManager *man = &this->game->assetManager;
|
||||
|
||||
// Camera
|
||||
this->camera = Camera::create(this);
|
||||
this->camera->transform->lookAt(glm::vec3(3, 3, 3), glm::vec3(0, 0, 0));
|
||||
|
||||
auto testCube = SimpleSpinningCubePrefab::create(this);
|
||||
|
||||
// UI
|
||||
this->canvas = UICanvas::create(this);
|
||||
|
||||
// auto text = man->get<TextureAsset>("texture_test");
|
||||
// auto border = this->canvas->addElement<UIBorder>();
|
||||
// border->texture = &text->texture;
|
||||
// border->setBorderSize(glm::vec2(4, 4));
|
||||
// border->setTransform(
|
||||
// UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH,
|
||||
// glm::vec4(0, 0, 0, 0),
|
||||
// 0.0f
|
||||
// );
|
||||
|
||||
auto assetFont = man->get<TrueTypeAsset>("truetype_alice");
|
||||
auto label = this->canvas->addElement<UILabel>();
|
||||
label->setFont(&assetFont->font);
|
||||
label->setText("test.1");
|
||||
label->setFontSize(24);
|
||||
label->setTransform(
|
||||
UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH,
|
||||
glm::vec4(0, 0, 0, 0),
|
||||
0.0f
|
||||
);
|
||||
}
|
25
src/dawnpokergame/scenes/TestUIScene.hpp
Normal file
25
src/dawnpokergame/scenes/TestUIScene.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 "scene/Scene.hpp"
|
||||
#include "game/DawnGame.hpp"
|
||||
#include "scene/components/ui/UICanvas.hpp"
|
||||
#include "ui/UILabel.hpp"
|
||||
#include "ui/UIBorder.hpp"
|
||||
#include "prefabs/SimpleSpinningCubePrefab.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class TestUIScene : public Scene {
|
||||
private:
|
||||
Camera *camera = nullptr;
|
||||
UICanvas *canvas = nullptr;
|
||||
|
||||
public:
|
||||
TestUIScene(DawnGame *game);
|
||||
std::vector<Asset*> getRequiredAssets() override;
|
||||
void stage() override;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user