diff --git a/assets/test_cube.json b/assets/test_cube.json index 3f0c13fd..cd5a6bb3 100644 --- a/assets/test_cube.json +++ b/assets/test_cube.json @@ -13,7 +13,8 @@ "components": { "mat": { "type": "SimpleTexturedMaterial", - "color": "blue" + "color": "blue", + "texture": "rosa" }, "renderer": { diff --git a/src/dawn/asset/loader/PrefabLoader.cpp b/src/dawn/asset/loader/PrefabLoader.cpp index 4f7674dc..9089e49a 100644 --- a/src/dawn/asset/loader/PrefabLoader.cpp +++ b/src/dawn/asset/loader/PrefabLoader.cpp @@ -34,6 +34,7 @@ void PrefabLoader::updateSync() { assertNotNull(this->jsonLoader, "JSON Loader is NULL?"); if(!this->jsonLoader->loaded) return; this->state = PrefabLoaderState::LOADING_DEPENDENCIES; + this->setupDependencies(); break; case PrefabLoaderState::LOADING_DEPENDENCIES: @@ -46,8 +47,6 @@ void PrefabLoader::updateSync() { this->state = PrefabLoaderState::DEPENDENCIES_LOADED; this->loaded = true; - - break; default: diff --git a/src/dawn/game/IGame.cpp b/src/dawn/game/IGame.cpp index 93e4c746..a017edf4 100644 --- a/src/dawn/game/IGame.cpp +++ b/src/dawn/game/IGame.cpp @@ -41,13 +41,10 @@ void IGame::init() { this->initManagers(); // TEST - auto scene = this->assetManager->get("test_scene.json"); + auto scene = this->assetManager->get(this->getInitialScene()); while(!this->assetManager->isEverythingLoaded()) { this->assetManager->update(); } - - // auto initialScene = this->getInitialScene(); - // nextFrameScene = std::make_shared(selfAsGame, initialScene); nextFrameScene = scene->getScene(); } diff --git a/src/dawn/game/IGame.hpp b/src/dawn/game/IGame.hpp index 436dae7d..e2e047d9 100644 --- a/src/dawn/game/IGame.hpp +++ b/src/dawn/game/IGame.hpp @@ -36,7 +36,7 @@ namespace Dawn { * * @return The initial scene. */ - // virtual std::function getInitialScene() = 0; + virtual std::string getInitialScene() = 0; /** * Initializes the game managers. diff --git a/src/dawn/scene/SceneComponent.hpp b/src/dawn/scene/SceneComponent.hpp index ebd2e525..3a1ad8b0 100644 --- a/src/dawn/scene/SceneComponent.hpp +++ b/src/dawn/scene/SceneComponent.hpp @@ -30,7 +30,7 @@ namespace Dawn { template std::shared_ptr getAsset(const std::string &j) const { auto it = assets.find(j); - assertTrue(it != assets.end(), "Asset not found."); + assertTrue(it != assets.end(), "Asset %s not found.", j.c_str()); auto asset = std::dynamic_pointer_cast(it->second); assertNotNull(asset, "Asset is not of the correct type."); return asset; diff --git a/src/dawnrpg/game/Game.cpp b/src/dawnrpg/game/Game.cpp index 9ba9fb46..48a0fd64 100644 --- a/src/dawnrpg/game/Game.cpp +++ b/src/dawnrpg/game/Game.cpp @@ -12,9 +12,9 @@ Game::Game() : IGame() { } -// std::function Game::getInitialScene() { -// return rpgScene; -// } +std::string Game::getInitialScene() { + return "test_scene.json"; +} void Game::initManagers() { diff --git a/src/dawnrpg/game/Game.hpp b/src/dawnrpg/game/Game.hpp index df80afc7..b5d2c2c8 100644 --- a/src/dawnrpg/game/Game.hpp +++ b/src/dawnrpg/game/Game.hpp @@ -9,7 +9,7 @@ namespace Dawn { class Game : public IGame { protected: - // std::function getInitialScene() override; + std::string getInitialScene() override; void initManagers() override; public: