TTF Loading Fixed

This commit is contained in:
2023-04-27 21:52:19 -07:00
parent e1f615c774
commit 54cfc89f38
13 changed files with 192 additions and 59 deletions

View File

@ -18,4 +18,7 @@ add_subdirectory(save)
# Assets
set(LIMINAL_ASSETS_DIR ${DAWN_ASSETS_DIR}/games/liminal)
tool_vnscene(${LIMINAL_ASSETS_DIR}/test.xml)
tool_vnscene(${LIMINAL_ASSETS_DIR}/test.xml)
tool_prefab(${LIMINAL_ASSETS_DIR}/VNTextbox.xml)
tool_truetype(font_main ${DAWN_ASSETS_DIR}/ark-pixel.ttf)

View File

@ -10,6 +10,6 @@
using namespace Dawn;
Scene * Dawn::dawnGameGetInitialScene(DawnGame *game) {
// return new HelloWorldScene(game);
return new TestScene(game);
return new HelloWorldScene(game);
// return new TestScene(game);
}

View File

@ -7,14 +7,7 @@
#include "scene/Scene.hpp"
#include "scene/components/display/Camera.hpp"
#include "prefabs/SimpleSpinningCubePrefab.hpp"
#include "games/vn/components/VNManager.hpp"
#include "games/vn/events/VNDummyEvent.hpp"
#include "games/vn/events/VNTextEvent.hpp"
#include "games/vn/events/VNPositionEvent.hpp"
#include "games/vn/events/VNSetEvent.hpp"
#include "games/vn/events/VNChoiceEvent.hpp"
#include "games/vn/events/VNParallelEvent.hpp"
#include "games/vn/events/VNWaitEvent.hpp"
#include "prefabs/VNTextbox.hpp"
namespace Dawn {
class HelloWorldScene : public Scene {
@ -33,52 +26,15 @@ namespace Dawn {
auto cube = SimpleSpinningCubePrefab::create(this);
auto vnItem = this->createSceneItem();
auto vnManager = vnItem->addComponent<VNManager>();
auto eventTest = vnManager->createEvent<VNDummyEvent>();
auto positionEvent = vnManager->createEvent<VNPositionEvent>();
positionEvent->to.x = 2.0f;
positionEvent->item = cube;
positionEvent->duration = 3.0f;
auto vnTextEvent = vnManager->createEvent<VNTextEvent>();
vnTextEvent->text = "Hello World!";
auto setPropertyEvent = vnManager->createEvent<VNSetEvent<int32_t>>();
setPropertyEvent->modifies = &test;
setPropertyEvent->to = 10;
auto choiceEvent = vnManager->createEvent<VNChoiceEvent>();
choiceEvent->text = "Choice?";
choiceEvent->choices["state0"] = "State 0";
choiceEvent->choices["state1"] = "State 1";
choiceEvent->choices["state2"] = "State 2";
choiceEvent->choices["state3"] = "State 3";
auto parallelEvent = vnManager->createEvent<VNParallelEvent>();
auto wait0 = vnManager->createEvent<VNWaitEvent>();
wait0->duration = 1.0f;
parallelEvent->events.push_back(wait0);
auto wait1 = vnManager->createEvent<VNWaitEvent>();
wait1->duration = 3.0f;
parallelEvent->events.push_back(wait1);
eventTest
->then(parallelEvent)
->then(positionEvent)
// ->then(vnTextEvent)
// ->then(setPropertyEvent)
// ->then(choiceEvent)
;
vnManager->setEvent(eventTest);
auto textbox = VNTextbox::create(this);
textbox->transform.setParent(canvas->transform);
}
std::vector<Asset*> getRequiredAssets() override {
auto assMan = &this->game->assetManager;
std::vector<Asset*> assets;
vectorAppend(&assets, SimpleSpinningCubePrefab::prefabAssets(assMan));
vectorAppend(&assets, VNTextbox::prefabAssets(assMan));
return assets;
}