diff --git a/PROJECT.md b/PROJECT.md deleted file mode 100644 index b48ab8b4..00000000 --- a/PROJECT.md +++ /dev/null @@ -1,26 +0,0 @@ -# Project update 2023-02-26 -Things are going quite smoothly but I feel like I'm a bit stuck where I am now. -There are parts of the engine that actually work really great and a few parts -that do not. - -Currently, here are the parts of the engine that I think need a total rework, or -need more work to make good; - - Fonts. Currently they work "ok" but it's difficult to common font things, and - they are acting inconsistent. All fonts should "basically be the same", but - whenever I change fonts the baselines and line heights go WAY off. I also - believe it should be easier to change font colors, including in the MIDDLE of - a word. I also still need to handle things like variable replacement mid-text - so that I can do, say, %playername% or similar. - - Physics. It is brand new and still generally good how it is, but it will for - sure need revisiting at some point. - - State Management. This is more of a conceptual thing but I'd like to make it - easier for states to be influenced by properties, e.g. changing position can - be done with a simple += rather than a get() and set(). - - Item Repositories. At the moment Scene items are attached to the scene, and - then components are attached to those, it should be more performant to simply - have each scene item type have a repo, and then map sceneitem ids to those. - That will improve performance of a lot of things, and make the memory - footprint smaller too. - - Using std:: methods more. I've learned a tonne of C++ since I started this - project, I'd love to use std pointers if they weren't a bit annoying, and - also use the std::function to support anonymous functions. \ No newline at end of file diff --git a/README.md b/README.md index 254972e8..362069fd 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,3 @@ -# Dawn Project -Simple in code, complex in structure game engine for creating small, fast and -reusable games. - -## Folder Structure -```Markdown -. -├── assets # Game Assets and Files (before optimization) -├── cmake -| ├── modules # Tools to allow CMake to find third-party libraries -| ├── targets # Variable lists to control what will be built -├── lib # Third-Party Submodule Libraries -├── src -| ├── dawn # Game engine, common project tools and utilities -| ├── dawnglfw # Engine files for GLFW Support -| ├── dawnopengl # Engine files for OpenGL Support -| ├── dawnpokergame # Poker Game Project -| ├── dawnwin32 # Engine files for WIN32 Host -``` \ No newline at end of file +# Dawn Project +Simple in code, complex in structure game engine for creating small, fast and +reusable games. \ No newline at end of file diff --git a/src/dawnplatformergame/CMakeLists.txt b/archive/dawnplatformergame/CMakeLists.txt similarity index 100% rename from src/dawnplatformergame/CMakeLists.txt rename to archive/dawnplatformergame/CMakeLists.txt diff --git a/src/dawnplatformergame/components/CMakeLists.txt b/archive/dawnplatformergame/components/CMakeLists.txt similarity index 95% rename from src/dawnplatformergame/components/CMakeLists.txt rename to archive/dawnplatformergame/components/CMakeLists.txt index 2715dc32..9d71746e 100644 --- a/src/dawnplatformergame/components/CMakeLists.txt +++ b/archive/dawnplatformergame/components/CMakeLists.txt @@ -1,10 +1,10 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - PlayerController.cpp +# Copyright (c) 2023 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + PlayerController.cpp ) \ No newline at end of file diff --git a/src/dawnplatformergame/components/PlayerController.cpp b/archive/dawnplatformergame/components/PlayerController.cpp similarity index 96% rename from src/dawnplatformergame/components/PlayerController.cpp rename to archive/dawnplatformergame/components/PlayerController.cpp index 58637b2f..21126364 100644 --- a/src/dawnplatformergame/components/PlayerController.cpp +++ b/archive/dawnplatformergame/components/PlayerController.cpp @@ -1,35 +1,35 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "PlayerController.hpp" -#include "game/DawnGame.hpp" - -using namespace Dawn; - -PlayerController::PlayerController(SceneItem *i) : SceneItemComponent(i) {} - -void PlayerController::onSceneUpdate() { - auto im = &getGame()->inputManager; - auto delta = getGame()->timeManager.delta; - - glm::vec2 iMove = im->getAxis2D( - INPUT_BIND_NEGATIVE_X, INPUT_BIND_POSITIVE_X, - INPUT_BIND_NEGATIVE_Y, INPUT_BIND_POSITIVE_Y - ); - - glm::vec2 pos = this->transform->getLocalPosition(); - this->transform->setLocalPosition( - this->transform->getLocalPosition() + glm::vec3(iMove * delta * 20.0f, 0) - ); -} - -void PlayerController::onStart() { - assertNotNull(this->camera); - getScene()->eventSceneUnpausedUpdate.addListener(this, &PlayerController::onSceneUpdate); -} - -PlayerController::~PlayerController() { - getScene()->eventSceneUnpausedUpdate.removeListener(this, &PlayerController::onSceneUpdate); +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "PlayerController.hpp" +#include "game/DawnGame.hpp" + +using namespace Dawn; + +PlayerController::PlayerController(SceneItem *i) : SceneItemComponent(i) {} + +void PlayerController::onSceneUpdate() { + auto im = &getGame()->inputManager; + auto delta = getGame()->timeManager.delta; + + glm::vec2 iMove = im->getAxis2D( + INPUT_BIND_NEGATIVE_X, INPUT_BIND_POSITIVE_X, + INPUT_BIND_NEGATIVE_Y, INPUT_BIND_POSITIVE_Y + ); + + glm::vec2 pos = this->transform->getLocalPosition(); + this->transform->setLocalPosition( + this->transform->getLocalPosition() + glm::vec3(iMove * delta * 20.0f, 0) + ); +} + +void PlayerController::onStart() { + assertNotNull(this->camera); + getScene()->eventSceneUnpausedUpdate.addListener(this, &PlayerController::onSceneUpdate); +} + +PlayerController::~PlayerController() { + getScene()->eventSceneUnpausedUpdate.removeListener(this, &PlayerController::onSceneUpdate); } \ No newline at end of file diff --git a/src/dawnplatformergame/components/PlayerController.hpp b/archive/dawnplatformergame/components/PlayerController.hpp similarity index 95% rename from src/dawnplatformergame/components/PlayerController.hpp rename to archive/dawnplatformergame/components/PlayerController.hpp index af101cc6..532cc3c7 100644 --- a/src/dawnplatformergame/components/PlayerController.hpp +++ b/archive/dawnplatformergame/components/PlayerController.hpp @@ -1,23 +1,23 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/components/Components.hpp" - -namespace Dawn { - class PlayerController : public SceneItemComponent { - protected: - void onSceneUpdate(); - - public: - Camera *camera = nullptr; - - PlayerController(SceneItem *item); - - void onStart() override; - - ~PlayerController(); - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "scene/components/Components.hpp" + +namespace Dawn { + class PlayerController : public SceneItemComponent { + protected: + void onSceneUpdate(); + + public: + Camera *camera = nullptr; + + PlayerController(SceneItem *item); + + void onStart() override; + + ~PlayerController(); + }; } \ No newline at end of file diff --git a/src/dawnpokergame/game/CMakeLists.txt b/archive/dawnplatformergame/game/CMakeLists.txt similarity index 100% rename from src/dawnpokergame/game/CMakeLists.txt rename to archive/dawnplatformergame/game/CMakeLists.txt diff --git a/src/dawnplatformergame/game/DawnGame.cpp b/archive/dawnplatformergame/game/DawnGame.cpp similarity index 95% rename from src/dawnplatformergame/game/DawnGame.cpp rename to archive/dawnplatformergame/game/DawnGame.cpp index ea220067..5c35475f 100644 --- a/src/dawnplatformergame/game/DawnGame.cpp +++ b/archive/dawnplatformergame/game/DawnGame.cpp @@ -1,40 +1,40 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "DawnGame.hpp" -#include "scenes/TestScene.hpp" - -using namespace Dawn; - -DawnGame::DawnGame(DawnHost *host) : - host(host), - renderManager(this), - inputManager(this), - localeManager(this), - saveManager(this) -{ -} - -int32_t DawnGame::init() { - this->assetManager.init(); - this->localeManager.init(); - this->renderManager.init(); - - this->scene = new TestScene(this); - - return DAWN_GAME_INIT_RESULT_SUCCESS; -} - -int32_t DawnGame::update(float_t delta) { - this->assetManager.update(); - this->inputManager.update(); - this->timeManager.update(delta); - - if(this->scene != nullptr) this->scene->update(); - - this->renderManager.update(); - - return DAWN_GAME_UPDATE_RESULT_SUCCESS; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "DawnGame.hpp" +#include "scenes/TestScene.hpp" + +using namespace Dawn; + +DawnGame::DawnGame(DawnHost *host) : + host(host), + renderManager(this), + inputManager(this), + localeManager(this), + saveManager(this) +{ +} + +int32_t DawnGame::init() { + this->assetManager.init(); + this->localeManager.init(); + this->renderManager.init(); + + this->scene = new TestScene(this); + + return DAWN_GAME_INIT_RESULT_SUCCESS; +} + +int32_t DawnGame::update(float_t delta) { + this->assetManager.update(); + this->inputManager.update(); + this->timeManager.update(delta); + + if(this->scene != nullptr) this->scene->update(); + + this->renderManager.update(); + + return DAWN_GAME_UPDATE_RESULT_SUCCESS; } \ No newline at end of file diff --git a/src/dawnplatformergame/game/DawnGame.hpp b/archive/dawnplatformergame/game/DawnGame.hpp similarity index 96% rename from src/dawnplatformergame/game/DawnGame.hpp rename to archive/dawnplatformergame/game/DawnGame.hpp index 7eca5e7a..c6ece032 100644 --- a/src/dawnplatformergame/game/DawnGame.hpp +++ b/archive/dawnplatformergame/game/DawnGame.hpp @@ -1,27 +1,27 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "game/_DawnGame.hpp" -#include "scene/components/Components.hpp" -#include "save/DawnGameSaveManager.hpp" - -namespace Dawn { - class DawnGame : public IDawnGame { - public: - DawnHost *host; - RenderManager renderManager; - AssetManager assetManager; - InputManager inputManager; - TimeManager timeManager; - LocaleManager localeManager; - DawnGameSaveManager saveManager; - PhysicsManager physicsManager; - - DawnGame(DawnHost *host); - int32_t init() override; - int32_t update(float_t delta) override; - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "game/_DawnGame.hpp" +#include "scene/components/Components.hpp" +#include "save/DawnGameSaveManager.hpp" + +namespace Dawn { + class DawnGame : public IDawnGame { + public: + DawnHost *host; + RenderManager renderManager; + AssetManager assetManager; + InputManager inputManager; + TimeManager timeManager; + LocaleManager localeManager; + DawnGameSaveManager saveManager; + PhysicsManager physicsManager; + + DawnGame(DawnHost *host); + int32_t init() override; + int32_t update(float_t delta) override; + }; } \ No newline at end of file diff --git a/src/dawnplatformergame/input/InputBinds.hpp b/archive/dawnplatformergame/input/InputBinds.hpp similarity index 97% rename from src/dawnplatformergame/input/InputBinds.hpp rename to archive/dawnplatformergame/input/InputBinds.hpp index 70622120..8ec176af 100644 --- a/src/dawnplatformergame/input/InputBinds.hpp +++ b/archive/dawnplatformergame/input/InputBinds.hpp @@ -1,14 +1,14 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "input/InputManager.hpp" - -#define INPUT_BIND(n) ((inputbind_t)n) -#define INPUT_BIND_ACCEPT INPUT_BIND(1) -#define INPUT_BIND_NEGATIVE_X INPUT_BIND(2) -#define INPUT_BIND_POSITIVE_X INPUT_BIND(3) -#define INPUT_BIND_NEGATIVE_Y INPUT_BIND(4) +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "input/InputManager.hpp" + +#define INPUT_BIND(n) ((inputbind_t)n) +#define INPUT_BIND_ACCEPT INPUT_BIND(1) +#define INPUT_BIND_NEGATIVE_X INPUT_BIND(2) +#define INPUT_BIND_POSITIVE_X INPUT_BIND(3) +#define INPUT_BIND_NEGATIVE_Y INPUT_BIND(4) #define INPUT_BIND_POSITIVE_Y INPUT_BIND(5) \ No newline at end of file diff --git a/src/dawnplatformergame/prefabs/PlayerPrefab.hpp b/archive/dawnplatformergame/prefabs/PlayerPrefab.hpp similarity index 97% rename from src/dawnplatformergame/prefabs/PlayerPrefab.hpp rename to archive/dawnplatformergame/prefabs/PlayerPrefab.hpp index 5ee8689f..c7358d52 100644 --- a/src/dawnplatformergame/prefabs/PlayerPrefab.hpp +++ b/archive/dawnplatformergame/prefabs/PlayerPrefab.hpp @@ -1,46 +1,46 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "prefab/SceneItemPrefab.hpp" -#include "scene/components/Components.hpp" -#include "components/PlayerController.hpp" - -namespace Dawn { - class PlayerPrefab : public SceneItemPrefab { - public: - static std::vector prefabAssets(AssetManager *man) { - std::vector assets; - assets.push_back(man->get("tileset_aqua")); - assets.push_back(man->get("texture_aqua")); - return assets; - } - - // - MeshHost *meshHost; - TiledSprite *tiledSprite; - Material *material; - MeshRenderer *meshRenderer; - PlayerController *playerController; - - PlayerPrefab(Scene *s, sceneitemid_t i) : SceneItemPrefab(s, i) {} - - void prefabInit(AssetManager *man) override { - auto tileset = man->get("tileset_aqua"); - auto texture = man->get("texture_aqua"); - - meshHost = addComponent(); - tiledSprite = addComponent(); - material = addComponent(); - meshRenderer = addComponent(); - playerController = addComponent(); - - tiledSprite->setTilesetAndSize(&tileset->tileset); - tiledSprite->setTile(896); - - material->textureValues[material->getShader()->getParameterByName("u_Text")] = &texture->texture; - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "prefab/SceneItemPrefab.hpp" +#include "scene/components/Components.hpp" +#include "components/PlayerController.hpp" + +namespace Dawn { + class PlayerPrefab : public SceneItemPrefab { + public: + static std::vector prefabAssets(AssetManager *man) { + std::vector assets; + assets.push_back(man->get("tileset_aqua")); + assets.push_back(man->get("texture_aqua")); + return assets; + } + + // + MeshHost *meshHost; + TiledSprite *tiledSprite; + Material *material; + MeshRenderer *meshRenderer; + PlayerController *playerController; + + PlayerPrefab(Scene *s, sceneitemid_t i) : SceneItemPrefab(s, i) {} + + void prefabInit(AssetManager *man) override { + auto tileset = man->get("tileset_aqua"); + auto texture = man->get("texture_aqua"); + + meshHost = addComponent(); + tiledSprite = addComponent(); + material = addComponent(); + meshRenderer = addComponent(); + playerController = addComponent(); + + tiledSprite->setTilesetAndSize(&tileset->tileset); + tiledSprite->setTile(896); + + material->textureValues[material->getShader()->getParameterByName("u_Text")] = &texture->texture; + } + }; } \ No newline at end of file diff --git a/src/dawnplatformergame/save/CMakeLists.txt b/archive/dawnplatformergame/save/CMakeLists.txt similarity index 95% rename from src/dawnplatformergame/save/CMakeLists.txt rename to archive/dawnplatformergame/save/CMakeLists.txt index 0c216047..55265234 100644 --- a/src/dawnplatformergame/save/CMakeLists.txt +++ b/archive/dawnplatformergame/save/CMakeLists.txt @@ -1,10 +1,10 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - DawnGameSaveManager.cpp +# Copyright (c) 2022 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + DawnGameSaveManager.cpp ) \ No newline at end of file diff --git a/src/dawnplatformergame/save/DawnGameSaveManager.cpp b/archive/dawnplatformergame/save/DawnGameSaveManager.cpp similarity index 96% rename from src/dawnplatformergame/save/DawnGameSaveManager.cpp rename to archive/dawnplatformergame/save/DawnGameSaveManager.cpp index 049a34c9..b1dc374a 100644 --- a/src/dawnplatformergame/save/DawnGameSaveManager.cpp +++ b/archive/dawnplatformergame/save/DawnGameSaveManager.cpp @@ -1,28 +1,28 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "DawnGameSaveManager.hpp" - -using namespace Dawn; - -DawnGameSaveManager::DawnGameSaveManager(DawnGame *game) : SaveManager(game) { -} - -bool_t DawnGameSaveManager::validateSave(struct SaveFile raw) { - if(!raw.has(POKER_SAVE_KEY_EXAMPLE)) return true; - this->currentSave.copy(raw, POKER_SAVE_KEY_EXAMPLE); - - return false; -} - -void DawnGameSaveManager::setExample(int32_t val) { - savedata_t value; - value.i32 = val; - this->currentSave.set(POKER_SAVE_KEY_EXAMPLE, value); -} - -int32_t DawnGameSaveManager::getExample() { - return this->currentSave.get(POKER_SAVE_KEY_EXAMPLE).i32; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "DawnGameSaveManager.hpp" + +using namespace Dawn; + +DawnGameSaveManager::DawnGameSaveManager(DawnGame *game) : SaveManager(game) { +} + +bool_t DawnGameSaveManager::validateSave(struct SaveFile raw) { + if(!raw.has(POKER_SAVE_KEY_EXAMPLE)) return true; + this->currentSave.copy(raw, POKER_SAVE_KEY_EXAMPLE); + + return false; +} + +void DawnGameSaveManager::setExample(int32_t val) { + savedata_t value; + value.i32 = val; + this->currentSave.set(POKER_SAVE_KEY_EXAMPLE, value); +} + +int32_t DawnGameSaveManager::getExample() { + return this->currentSave.get(POKER_SAVE_KEY_EXAMPLE).i32; } \ No newline at end of file diff --git a/src/dawnplatformergame/save/DawnGameSaveManager.hpp b/archive/dawnplatformergame/save/DawnGameSaveManager.hpp similarity index 96% rename from src/dawnplatformergame/save/DawnGameSaveManager.hpp rename to archive/dawnplatformergame/save/DawnGameSaveManager.hpp index 3a339f20..8eb5164b 100644 --- a/src/dawnplatformergame/save/DawnGameSaveManager.hpp +++ b/archive/dawnplatformergame/save/DawnGameSaveManager.hpp @@ -1,22 +1,22 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "save/SaveManager.hpp" - -#define POKER_SAVE_KEY_EXAMPLE "poker.example" - -namespace Dawn { - class DawnGameSaveManager : public SaveManager { - protected: - virtual bool_t validateSave(struct SaveFile raw) override; - - public: - DawnGameSaveManager(DawnGame *game); - - void setExample(int32_t value); - int32_t getExample(); - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "save/SaveManager.hpp" + +#define POKER_SAVE_KEY_EXAMPLE "poker.example" + +namespace Dawn { + class DawnGameSaveManager : public SaveManager { + protected: + virtual bool_t validateSave(struct SaveFile raw) override; + + public: + DawnGameSaveManager(DawnGame *game); + + void setExample(int32_t value); + int32_t getExample(); + }; } \ No newline at end of file diff --git a/src/dawnplatformergame/scenes/TestScene.hpp b/archive/dawnplatformergame/scenes/TestScene.hpp similarity index 96% rename from src/dawnplatformergame/scenes/TestScene.hpp rename to archive/dawnplatformergame/scenes/TestScene.hpp index 7d0fdb91..885a8501 100644 --- a/src/dawnplatformergame/scenes/TestScene.hpp +++ b/archive/dawnplatformergame/scenes/TestScene.hpp @@ -1,33 +1,33 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/Scene.hpp" -#include "prefabs/PlayerPrefab.hpp" - -namespace Dawn { - class TestScene : public Scene { - protected: - void stage() override { - auto camera = Camera::create(this); - camera->type = CAMERA_TYPE_ORTHONOGRAPHIC; - camera->item->addComponent(); - camera->transform->lookAt(glm::vec3(0, 0, 10), glm::vec3(0, 0, 0)); - - auto player = PlayerPrefab::create(this); - player->playerController->camera = camera; - } - - std::vector getRequiredAssets() override { - auto assMan = &this->game->assetManager; - std::vector assets; - vectorAppend(&assets, PlayerPrefab::getRequiredAssets(assMan)); - return assets; - } - - public: - TestScene(DawnGame *game) : Scene(game) {} - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "scene/Scene.hpp" +#include "prefabs/PlayerPrefab.hpp" + +namespace Dawn { + class TestScene : public Scene { + protected: + void stage() override { + auto camera = Camera::create(this); + camera->type = CAMERA_TYPE_ORTHONOGRAPHIC; + camera->item->addComponent(); + camera->transform->lookAt(glm::vec3(0, 0, 10), glm::vec3(0, 0, 0)); + + auto player = PlayerPrefab::create(this); + player->playerController->camera = camera; + } + + std::vector getRequiredAssets() override { + auto assMan = &this->game->assetManager; + std::vector assets; + vectorAppend(&assets, PlayerPrefab::getRequiredAssets(assMan)); + return assets; + } + + public: + TestScene(DawnGame *game) : Scene(game) {} + }; } \ No newline at end of file diff --git a/src/dawnpokergame/CMakeLists.txt b/archive/dawnpokergame/CMakeLists.txt similarity index 100% rename from src/dawnpokergame/CMakeLists.txt rename to archive/dawnpokergame/CMakeLists.txt diff --git a/src/dawnplatformergame/game/CMakeLists.txt b/archive/dawnpokergame/game/CMakeLists.txt similarity index 95% rename from src/dawnplatformergame/game/CMakeLists.txt rename to archive/dawnpokergame/game/CMakeLists.txt index 08e54cdd..1e19b6d9 100644 --- a/src/dawnplatformergame/game/CMakeLists.txt +++ b/archive/dawnpokergame/game/CMakeLists.txt @@ -1,10 +1,10 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - DawnGame.cpp +# Copyright (c) 2022 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + DawnGame.cpp ) \ No newline at end of file diff --git a/src/dawnpokergame/game/DawnGame.cpp b/archive/dawnpokergame/game/DawnGame.cpp similarity index 100% rename from src/dawnpokergame/game/DawnGame.cpp rename to archive/dawnpokergame/game/DawnGame.cpp diff --git a/src/dawnpokergame/game/DawnGame.hpp b/archive/dawnpokergame/game/DawnGame.hpp similarity index 96% rename from src/dawnpokergame/game/DawnGame.hpp rename to archive/dawnpokergame/game/DawnGame.hpp index 28df37fb..22cc55e4 100644 --- a/src/dawnpokergame/game/DawnGame.hpp +++ b/archive/dawnpokergame/game/DawnGame.hpp @@ -1,31 +1,31 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "game/_DawnGame.hpp" -#include "scene/components/Components.hpp" -#include "save/PokerSaveManager.hpp" - -namespace Dawn { - class DawnGame : public IDawnGame { - private: - Scene *sceneToCutTo = nullptr; - - public: - DawnHost *host; - RenderManager renderManager; - AssetManager assetManager; - InputManager inputManager; - TimeManager timeManager; - LocaleManager localeManager; - PokerSaveManager saveManager; - AudioManager audioManager; - - DawnGame(DawnHost *host); - int32_t init() override; - int32_t update(float_t delta) override; - void sceneCutover(Scene *scene) override; - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "game/_DawnGame.hpp" +#include "scene/components/Components.hpp" +#include "save/PokerSaveManager.hpp" + +namespace Dawn { + class DawnGame : public IDawnGame { + private: + Scene *sceneToCutTo = nullptr; + + public: + DawnHost *host; + RenderManager renderManager; + AssetManager assetManager; + InputManager inputManager; + TimeManager timeManager; + LocaleManager localeManager; + PokerSaveManager saveManager; + AudioManager audioManager; + + DawnGame(DawnHost *host); + int32_t init() override; + int32_t update(float_t delta) override; + void sceneCutover(Scene *scene) override; + }; } \ No newline at end of file diff --git a/src/dawnpokergame/input/InputBinds.hpp b/archive/dawnpokergame/input/InputBinds.hpp similarity index 96% rename from src/dawnpokergame/input/InputBinds.hpp rename to archive/dawnpokergame/input/InputBinds.hpp index 1a97e236..951435ce 100644 --- a/src/dawnpokergame/input/InputBinds.hpp +++ b/archive/dawnpokergame/input/InputBinds.hpp @@ -1,15 +1,15 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "input/InputManager.hpp" - -#define dbind(n) ((inputbind_t)n) - -#define INPUT_BIND_ACCEPT dbind(1) -#define INPUT_BIND_NEGATIVE_X dbind(2) -#define INPUT_BIND_POSITIVE_X dbind(3) -#define INPUT_BIND_NEGATIVE_Y dbind(4) +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "input/InputManager.hpp" + +#define dbind(n) ((inputbind_t)n) + +#define INPUT_BIND_ACCEPT dbind(1) +#define INPUT_BIND_NEGATIVE_X dbind(2) +#define INPUT_BIND_POSITIVE_X dbind(3) +#define INPUT_BIND_NEGATIVE_Y dbind(4) #define INPUT_BIND_POSITIVE_Y dbind(5) \ No newline at end of file diff --git a/src/dawnpokergame/prefabs/CMakeLists.txt b/archive/dawnpokergame/prefabs/CMakeLists.txt similarity index 96% rename from src/dawnpokergame/prefabs/CMakeLists.txt rename to archive/dawnpokergame/prefabs/CMakeLists.txt index 3326c9c1..9cd7f30b 100644 --- a/src/dawnpokergame/prefabs/CMakeLists.txt +++ b/archive/dawnpokergame/prefabs/CMakeLists.txt @@ -1,6 +1,6 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - +# Copyright (c) 2022 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + add_subdirectory(characters) \ No newline at end of file diff --git a/src/dawnpokergame/prefabs/characters/CMakeLists.txt b/archive/dawnpokergame/prefabs/characters/CMakeLists.txt similarity index 95% rename from src/dawnpokergame/prefabs/characters/CMakeLists.txt rename to archive/dawnpokergame/prefabs/characters/CMakeLists.txt index 6fdb9d64..213aa4ff 100644 --- a/src/dawnpokergame/prefabs/characters/CMakeLists.txt +++ b/archive/dawnpokergame/prefabs/characters/CMakeLists.txt @@ -1,11 +1,11 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - CharacterPrefab.cpp - DeathPrefab.cpp +# Copyright (c) 2023 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + CharacterPrefab.cpp + DeathPrefab.cpp ) \ No newline at end of file diff --git a/src/dawnpokergame/prefabs/characters/CharacterPrefab.cpp b/archive/dawnpokergame/prefabs/characters/CharacterPrefab.cpp similarity index 96% rename from src/dawnpokergame/prefabs/characters/CharacterPrefab.cpp rename to archive/dawnpokergame/prefabs/characters/CharacterPrefab.cpp index 4adc71a2..96a966bd 100644 --- a/src/dawnpokergame/prefabs/characters/CharacterPrefab.cpp +++ b/archive/dawnpokergame/prefabs/characters/CharacterPrefab.cpp @@ -1,8 +1,8 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "CharacterPrefab.hpp" - +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "CharacterPrefab.hpp" + using namespace Dawn; \ No newline at end of file diff --git a/src/dawnpokergame/prefabs/characters/CharacterPrefab.hpp b/archive/dawnpokergame/prefabs/characters/CharacterPrefab.hpp similarity index 97% rename from src/dawnpokergame/prefabs/characters/CharacterPrefab.hpp rename to archive/dawnpokergame/prefabs/characters/CharacterPrefab.hpp index 1aed2d2b..ee5c43de 100644 --- a/src/dawnpokergame/prefabs/characters/CharacterPrefab.hpp +++ b/archive/dawnpokergame/prefabs/characters/CharacterPrefab.hpp @@ -1,82 +1,82 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "prefab/SceneItemPrefab.hpp" -#include "scene/Scene.hpp" -#include "scene/components/display/MeshRenderer.hpp" -#include "scene/components/display/AnimationController.hpp" -#include "scene/components/display/MeshHost.hpp" -#include "scene/components/display/material/SimpleTexturedMaterial.hpp" -#include "scene/components/audio/AudioSource.hpp" -#include "visualnovel/components/VisualNovelCharacter.hpp" - -namespace Dawn { - template - class CharacterPrefab : public SceneItemPrefab { - protected: - /** - * Character Prefab will request you to initialize your characters' - * emotions here, including loading assets, - * - * @return struct VisualNovelCharacterEmotion - */ - virtual struct VisualNovelCharacterEmotion defineAndGetInitialEmotion( - AssetManager *assMan - ) = 0; - - - public: - static std::vector prefabAssets(AssetManager *assMan) { - return std::vector{ - assMan->get(O::getCharacterTexture()), - assMan->get(O::getCharacterTileset()) - }; - } - - // Instance - VisualNovelCharacter *vnCharacter; - AnimationController *animation; - TextureAsset *characterTexture; - TilesetAsset *characterTileset; - MeshRenderer *meshRenderer; - MeshHost *meshHost; - SimpleTexturedMaterial *material; - TiledSprite *tiledSprite; - AudioSource *audioSource; - - CharacterPrefab(Scene *s, sceneitemid_t i) : SceneItemPrefab(s, i) {} - - void prefabInit(AssetManager *man) override { - characterTexture = man->get(O::getCharacterTexture()); - characterTileset = man->get(O::getCharacterTileset()); - - // Emotions - auto emotion = this->defineAndGetInitialEmotion(man); - - // Components - meshRenderer = this->template addComponent(); - meshHost = this->template addComponent(); - - material = this->template addComponent(); - material->texture = &characterTexture->texture; - - vnCharacter = this->template addComponent(); - vnCharacter->nameKey = O::getLanguagePrefix() + ".name"; - - animation = this->template addComponent(); - - tiledSprite = this->template addComponent(); - tiledSprite->setTileset(&characterTileset->tileset); - float_t ratio = characterTileset->tileset.getTileWidth() / characterTileset->tileset.getTileHeight(); - tiledSprite->setSize(glm::vec2(ratio, 1.0f)); - tiledSprite->setTile(emotion.tile); - - audioSource = this->template addComponent(); - - this->transform.setLocalPosition(glm::vec3(0, 0, 0)); - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "prefab/SceneItemPrefab.hpp" +#include "scene/Scene.hpp" +#include "scene/components/display/MeshRenderer.hpp" +#include "scene/components/display/AnimationController.hpp" +#include "scene/components/display/MeshHost.hpp" +#include "scene/components/display/material/SimpleTexturedMaterial.hpp" +#include "scene/components/audio/AudioSource.hpp" +#include "visualnovel/components/VisualNovelCharacter.hpp" + +namespace Dawn { + template + class CharacterPrefab : public SceneItemPrefab { + protected: + /** + * Character Prefab will request you to initialize your characters' + * emotions here, including loading assets, + * + * @return struct VisualNovelCharacterEmotion + */ + virtual struct VisualNovelCharacterEmotion defineAndGetInitialEmotion( + AssetManager *assMan + ) = 0; + + + public: + static std::vector prefabAssets(AssetManager *assMan) { + return std::vector{ + assMan->get(O::getCharacterTexture()), + assMan->get(O::getCharacterTileset()) + }; + } + + // Instance + VisualNovelCharacter *vnCharacter; + AnimationController *animation; + TextureAsset *characterTexture; + TilesetAsset *characterTileset; + MeshRenderer *meshRenderer; + MeshHost *meshHost; + SimpleTexturedMaterial *material; + TiledSprite *tiledSprite; + AudioSource *audioSource; + + CharacterPrefab(Scene *s, sceneitemid_t i) : SceneItemPrefab(s, i) {} + + void prefabInit(AssetManager *man) override { + characterTexture = man->get(O::getCharacterTexture()); + characterTileset = man->get(O::getCharacterTileset()); + + // Emotions + auto emotion = this->defineAndGetInitialEmotion(man); + + // Components + meshRenderer = this->template addComponent(); + meshHost = this->template addComponent(); + + material = this->template addComponent(); + material->texture = &characterTexture->texture; + + vnCharacter = this->template addComponent(); + vnCharacter->nameKey = O::getLanguagePrefix() + ".name"; + + animation = this->template addComponent(); + + tiledSprite = this->template addComponent(); + tiledSprite->setTileset(&characterTileset->tileset); + float_t ratio = characterTileset->tileset.getTileWidth() / characterTileset->tileset.getTileHeight(); + tiledSprite->setSize(glm::vec2(ratio, 1.0f)); + tiledSprite->setTile(emotion.tile); + + audioSource = this->template addComponent(); + + this->transform.setLocalPosition(glm::vec3(0, 0, 0)); + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/prefabs/characters/DeathPrefab.cpp b/archive/dawnpokergame/prefabs/characters/DeathPrefab.cpp similarity index 100% rename from src/dawnpokergame/prefabs/characters/DeathPrefab.cpp rename to archive/dawnpokergame/prefabs/characters/DeathPrefab.cpp diff --git a/src/dawnpokergame/prefabs/characters/DeathPrefab.hpp b/archive/dawnpokergame/prefabs/characters/DeathPrefab.hpp similarity index 100% rename from src/dawnpokergame/prefabs/characters/DeathPrefab.hpp rename to archive/dawnpokergame/prefabs/characters/DeathPrefab.hpp diff --git a/src/dawnpokergame/prefabs/characters/PennyPrefab.hpp b/archive/dawnpokergame/prefabs/characters/PennyPrefab.hpp similarity index 97% rename from src/dawnpokergame/prefabs/characters/PennyPrefab.hpp rename to archive/dawnpokergame/prefabs/characters/PennyPrefab.hpp index 2f528985..177a9b09 100644 --- a/src/dawnpokergame/prefabs/characters/PennyPrefab.hpp +++ b/archive/dawnpokergame/prefabs/characters/PennyPrefab.hpp @@ -1,68 +1,68 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "prefab/SceneItemPrefab.hpp" -#include "asset/AssetManager.hpp" -#include "poker/PokerPlayer.hpp" -#include "scene/components/Components.hpp" -#include "visualnovel/components/VisualNovelCharacter.hpp" -#include "display/animation/TiledSpriteAnimation.hpp" -#include "scene/components/display/material/SimpleTexturedMaterial.hpp" - -namespace Dawn { - class PennyPrefab : public SceneItemPrefab { - public: - VisualNovelCharacter *vnCharacter; - PokerPlayer *pokerPlayer; - SimpleTexturedMaterial *material; - - struct VisualNovelCharacterEmotion emotionHappy; - struct VisualNovelCharacterEmotion emotionSurprised; - struct VisualNovelCharacterEmotion emotionConcerned; - - static std::vector prefabAssets(AssetManager *assMan) { - return std::vector{ - assMan->get("texture_penny"), - assMan->get("tileset_penny") - }; - } - - PennyPrefab(Scene *scene, sceneitemid_t id) : SceneItemPrefab(scene, id){} - - void prefabInit(AssetManager *man) override { - // Assets - auto textureAsset = man->get("texture_penny"); - auto tilesetAsset = man->get("tileset_penny"); - - // Emotions - this->emotionHappy.tile = 0; - - this->emotionSurprised.tile = 1; - - this->emotionConcerned.tile = 2; - - // Components - auto meshRenderer = this->addComponent(); - auto meshHost = this->addComponent(); - - material = this->addComponent(); - material->texture = &textureAsset->texture; - - auto animation = this->addComponent(); - - pokerPlayer = this->addComponent(); - - vnCharacter = this->addComponent(); - vnCharacter->nameKey = "character.penny.name"; - - auto tiledSprite = this->addComponent(); - tiledSprite->setTilesetAndSize(&tilesetAsset->tileset); - tiledSprite->setTile(0); - - this->transform.setLocalPosition(glm::vec3(0, 0, 0)); - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "prefab/SceneItemPrefab.hpp" +#include "asset/AssetManager.hpp" +#include "poker/PokerPlayer.hpp" +#include "scene/components/Components.hpp" +#include "visualnovel/components/VisualNovelCharacter.hpp" +#include "display/animation/TiledSpriteAnimation.hpp" +#include "scene/components/display/material/SimpleTexturedMaterial.hpp" + +namespace Dawn { + class PennyPrefab : public SceneItemPrefab { + public: + VisualNovelCharacter *vnCharacter; + PokerPlayer *pokerPlayer; + SimpleTexturedMaterial *material; + + struct VisualNovelCharacterEmotion emotionHappy; + struct VisualNovelCharacterEmotion emotionSurprised; + struct VisualNovelCharacterEmotion emotionConcerned; + + static std::vector prefabAssets(AssetManager *assMan) { + return std::vector{ + assMan->get("texture_penny"), + assMan->get("tileset_penny") + }; + } + + PennyPrefab(Scene *scene, sceneitemid_t id) : SceneItemPrefab(scene, id){} + + void prefabInit(AssetManager *man) override { + // Assets + auto textureAsset = man->get("texture_penny"); + auto tilesetAsset = man->get("tileset_penny"); + + // Emotions + this->emotionHappy.tile = 0; + + this->emotionSurprised.tile = 1; + + this->emotionConcerned.tile = 2; + + // Components + auto meshRenderer = this->addComponent(); + auto meshHost = this->addComponent(); + + material = this->addComponent(); + material->texture = &textureAsset->texture; + + auto animation = this->addComponent(); + + pokerPlayer = this->addComponent(); + + vnCharacter = this->addComponent(); + vnCharacter->nameKey = "character.penny.name"; + + auto tiledSprite = this->addComponent(); + tiledSprite->setTilesetAndSize(&tilesetAsset->tileset); + tiledSprite->setTile(0); + + this->transform.setLocalPosition(glm::vec3(0, 0, 0)); + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/prefabs/ui/UIBorderPrefab.hpp b/archive/dawnpokergame/prefabs/ui/UIBorderPrefab.hpp similarity index 96% rename from src/dawnpokergame/prefabs/ui/UIBorderPrefab.hpp rename to archive/dawnpokergame/prefabs/ui/UIBorderPrefab.hpp index 39dfece2..70102d92 100644 --- a/src/dawnpokergame/prefabs/ui/UIBorderPrefab.hpp +++ b/archive/dawnpokergame/prefabs/ui/UIBorderPrefab.hpp @@ -1,25 +1,25 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "prefab/UIPrefab.hpp" -#include "ui/UIBorder.hpp" - -namespace Dawn { - class UIBorderPrefab : public UIPrefab { - public: - static std::vector prefabAssets(AssetManager *man) { - std::vector assets; - assets.push_back(man->get("texture_test")); - return assets; - } - - static void prefabApply(AssetManager *man, UIBorder *border) { - auto text = man->get("texture_test"); - border->texture = &text->texture; - border->setBorderSize(glm::vec2(4, 4)); - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "prefab/UIPrefab.hpp" +#include "ui/UIBorder.hpp" + +namespace Dawn { + class UIBorderPrefab : public UIPrefab { + public: + static std::vector prefabAssets(AssetManager *man) { + std::vector assets; + assets.push_back(man->get("texture_test")); + return assets; + } + + static void prefabApply(AssetManager *man, UIBorder *border) { + auto text = man->get("texture_test"); + border->texture = &text->texture; + border->setBorderSize(glm::vec2(4, 4)); + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/prefabs/ui/VisualNovelTextboxPrefab.hpp b/archive/dawnpokergame/prefabs/ui/VisualNovelTextboxPrefab.hpp similarity index 100% rename from src/dawnpokergame/prefabs/ui/VisualNovelTextboxPrefab.hpp rename to archive/dawnpokergame/prefabs/ui/VisualNovelTextboxPrefab.hpp diff --git a/src/dawnpokergame/save/CMakeLists.txt b/archive/dawnpokergame/save/CMakeLists.txt similarity index 95% rename from src/dawnpokergame/save/CMakeLists.txt rename to archive/dawnpokergame/save/CMakeLists.txt index 15aca32e..9ed28db6 100644 --- a/src/dawnpokergame/save/CMakeLists.txt +++ b/archive/dawnpokergame/save/CMakeLists.txt @@ -1,10 +1,10 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - PokerSaveManager.cpp +# Copyright (c) 2022 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + PokerSaveManager.cpp ) \ No newline at end of file diff --git a/src/dawnpokergame/save/PokerSaveManager.cpp b/archive/dawnpokergame/save/PokerSaveManager.cpp similarity index 96% rename from src/dawnpokergame/save/PokerSaveManager.cpp rename to archive/dawnpokergame/save/PokerSaveManager.cpp index 8015c4bd..0fc89da8 100644 --- a/src/dawnpokergame/save/PokerSaveManager.cpp +++ b/archive/dawnpokergame/save/PokerSaveManager.cpp @@ -1,28 +1,28 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "PokerSaveManager.hpp" - -using namespace Dawn; - -PokerSaveManager::PokerSaveManager(DawnGame *game) : SaveManager(game) { -} - -bool_t PokerSaveManager::validateSave(struct SaveFile raw) { - if(!raw.has(POKER_SAVE_KEY_EXAMPLE)) return true; - this->currentSave.copy(raw, POKER_SAVE_KEY_EXAMPLE); - - return false; -} - -void PokerSaveManager::setExample(int32_t val) { - savedata_t value; - value.i32 = val; - this->currentSave.set(POKER_SAVE_KEY_EXAMPLE, value); -} - -int32_t PokerSaveManager::getExample() { - return this->currentSave.get(POKER_SAVE_KEY_EXAMPLE).i32; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "PokerSaveManager.hpp" + +using namespace Dawn; + +PokerSaveManager::PokerSaveManager(DawnGame *game) : SaveManager(game) { +} + +bool_t PokerSaveManager::validateSave(struct SaveFile raw) { + if(!raw.has(POKER_SAVE_KEY_EXAMPLE)) return true; + this->currentSave.copy(raw, POKER_SAVE_KEY_EXAMPLE); + + return false; +} + +void PokerSaveManager::setExample(int32_t val) { + savedata_t value; + value.i32 = val; + this->currentSave.set(POKER_SAVE_KEY_EXAMPLE, value); +} + +int32_t PokerSaveManager::getExample() { + return this->currentSave.get(POKER_SAVE_KEY_EXAMPLE).i32; } \ No newline at end of file diff --git a/src/dawnpokergame/save/PokerSaveManager.hpp b/archive/dawnpokergame/save/PokerSaveManager.hpp similarity index 95% rename from src/dawnpokergame/save/PokerSaveManager.hpp rename to archive/dawnpokergame/save/PokerSaveManager.hpp index 38ae3332..07ca0547 100644 --- a/src/dawnpokergame/save/PokerSaveManager.hpp +++ b/archive/dawnpokergame/save/PokerSaveManager.hpp @@ -1,22 +1,22 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "save/SaveManager.hpp" - -#define POKER_SAVE_KEY_EXAMPLE "poker.example" - -namespace Dawn { - class PokerSaveManager : public SaveManager { - protected: - virtual bool_t validateSave(struct SaveFile raw) override; - - public: - PokerSaveManager(DawnGame *game); - - void setExample(int32_t value); - int32_t getExample(); - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "save/SaveManager.hpp" + +#define POKER_SAVE_KEY_EXAMPLE "poker.example" + +namespace Dawn { + class PokerSaveManager : public SaveManager { + protected: + virtual bool_t validateSave(struct SaveFile raw) override; + + public: + PokerSaveManager(DawnGame *game); + + void setExample(int32_t value); + int32_t getExample(); + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/CMakeLists.txt b/archive/dawnpokergame/scenes/CMakeLists.txt similarity index 95% rename from src/dawnpokergame/scenes/CMakeLists.txt rename to archive/dawnpokergame/scenes/CMakeLists.txt index 1928077e..8059dd7a 100644 --- a/src/dawnpokergame/scenes/CMakeLists.txt +++ b/archive/dawnpokergame/scenes/CMakeLists.txt @@ -1,10 +1,10 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - PokerVNScene.cpp +# Copyright (c) 2022 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + PokerVNScene.cpp ) \ No newline at end of file diff --git a/src/dawnpokergame/scenes/PokerVNScene.cpp b/archive/dawnpokergame/scenes/PokerVNScene.cpp similarity index 96% rename from src/dawnpokergame/scenes/PokerVNScene.cpp rename to archive/dawnpokergame/scenes/PokerVNScene.cpp index 529604b6..64f9b8af 100644 --- a/src/dawnpokergame/scenes/PokerVNScene.cpp +++ b/archive/dawnpokergame/scenes/PokerVNScene.cpp @@ -1,39 +1,39 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "PokerVNScene.hpp" - -using namespace Dawn; - -PokerVNScene::PokerVNScene(DawnGame *game) : SimpleVNScene(game) { - -} - -std::vector PokerVNScene::getRequiredAssets() { - auto assMan = &this->game->assetManager; - std::vector assets; - vectorAppend(&assets, SimpleVNScene::getRequiredAssets()); - vectorAppend(&assets, PokerPlayerDisplay::getAssets(assMan)); - return assets; -} - -void PokerVNScene::vnStage() { - - auto pokerGameItem = this->createSceneItem(); - this->pokerGame = pokerGameItem->addComponent(); - - this->pokerPlayers = this->getPokerPlayers(); - - auto it = this->pokerPlayers.begin(); - int32_t i = 0; - while(it != this->pokerPlayers.end()) { - auto player = *it; - // auto uiPlayer = canvas->addElement(); - // uiPlayer->setTransform(UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START, glm::vec4(i * 220, 0, 220, 200), 0); - // uiPlayer->setPlayer(player); - ++it; - ++i; - } +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "PokerVNScene.hpp" + +using namespace Dawn; + +PokerVNScene::PokerVNScene(DawnGame *game) : SimpleVNScene(game) { + +} + +std::vector PokerVNScene::getRequiredAssets() { + auto assMan = &this->game->assetManager; + std::vector assets; + vectorAppend(&assets, SimpleVNScene::getRequiredAssets()); + vectorAppend(&assets, PokerPlayerDisplay::getAssets(assMan)); + return assets; +} + +void PokerVNScene::vnStage() { + + auto pokerGameItem = this->createSceneItem(); + this->pokerGame = pokerGameItem->addComponent(); + + this->pokerPlayers = this->getPokerPlayers(); + + auto it = this->pokerPlayers.begin(); + int32_t i = 0; + while(it != this->pokerPlayers.end()) { + auto player = *it; + // auto uiPlayer = canvas->addElement(); + // uiPlayer->setTransform(UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START, glm::vec4(i * 220, 0, 220, 200), 0); + // uiPlayer->setPlayer(player); + ++it; + ++i; + } } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/PokerVNScene.hpp b/archive/dawnpokergame/scenes/PokerVNScene.hpp similarity index 96% rename from src/dawnpokergame/scenes/PokerVNScene.hpp rename to archive/dawnpokergame/scenes/PokerVNScene.hpp index d16ba98e..9f335add 100644 --- a/src/dawnpokergame/scenes/PokerVNScene.hpp +++ b/archive/dawnpokergame/scenes/PokerVNScene.hpp @@ -1,39 +1,39 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/scene/SimpleVNScene.hpp" -#include "poker/PokerGame.hpp" -#include "visualnovel/events/PokerBetLoopEvent.hpp" -#include "visualnovel/events/PokerInitialEvent.hpp" -#include "ui/PokerPlayerDisplay.hpp" - -namespace Dawn { - class PokerVNScene : public SimpleVNScene { - protected: - void vnStage() override; - std::vector getRequiredAssets() override; - - /** - * Returns the Poker Players that are in this poker scene. - * - * @return List of Poker Players. - */ - virtual std::vector getPokerPlayers() = 0; - - public: - PokerGame *pokerGame; - std::vector pokerPlayers; - std::map pokerPlayerDisplays; - - /** - * Create a simple Poker Visual Novel Scene. Simplifies some of the less - * interesting parts of a poker VN game. - * - * @param game Game that this poker scene belongs to. - */ - PokerVNScene(DawnGame *game); - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/scene/SimpleVNScene.hpp" +#include "poker/PokerGame.hpp" +#include "visualnovel/events/PokerBetLoopEvent.hpp" +#include "visualnovel/events/PokerInitialEvent.hpp" +#include "ui/PokerPlayerDisplay.hpp" + +namespace Dawn { + class PokerVNScene : public SimpleVNScene { + protected: + void vnStage() override; + std::vector getRequiredAssets() override; + + /** + * Returns the Poker Players that are in this poker scene. + * + * @return List of Poker Players. + */ + virtual std::vector getPokerPlayers() = 0; + + public: + PokerGame *pokerGame; + std::vector pokerPlayers; + std::map pokerPlayerDisplays; + + /** + * Create a simple Poker Visual Novel Scene. Simplifies some of the less + * interesting parts of a poker VN game. + * + * @param game Game that this poker scene belongs to. + */ + PokerVNScene(DawnGame *game); + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_10.hpp b/archive/dawnpokergame/scenes/Scene_10.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_10.hpp rename to archive/dawnpokergame/scenes/Scene_10.hpp index 34b90ef8..8b518a09 100644 --- a/src/dawnpokergame/scenes/Scene_10.hpp +++ b/archive/dawnpokergame/scenes/Scene_10.hpp @@ -1,45 +1,45 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/scene/SimpleVNScene.hpp" -#include "scenes/Scene_11.hpp" - -namespace Dawn { - class Scene_10 : public SimpleVNScene { - protected: - void vnStage() override { - - } - - void onSceneEnded() { - auto scene = new Scene_11(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - - public: - Scene_10(DawnGame *game) : SimpleVNScene(game) { - } - - std::vector getRequiredAssets() override { - std::vector assets = SimpleVNScene::getRequiredAssets(); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelPauseEvent(vnManager, 0.1f); - start - ->then(new VisualNovelTextboxEvent(vnManager, "scene.10.1")) - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_10::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/scene/SimpleVNScene.hpp" +#include "scenes/Scene_11.hpp" + +namespace Dawn { + class Scene_10 : public SimpleVNScene { + protected: + void vnStage() override { + + } + + void onSceneEnded() { + auto scene = new Scene_11(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + + public: + Scene_10(DawnGame *game) : SimpleVNScene(game) { + } + + std::vector getRequiredAssets() override { + std::vector assets = SimpleVNScene::getRequiredAssets(); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelPauseEvent(vnManager, 0.1f); + start + ->then(new VisualNovelTextboxEvent(vnManager, "scene.10.1")) + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_10::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_11.hpp b/archive/dawnpokergame/scenes/Scene_11.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_11.hpp rename to archive/dawnpokergame/scenes/Scene_11.hpp index 11301b8f..90d144d2 100644 --- a/src/dawnpokergame/scenes/Scene_11.hpp +++ b/archive/dawnpokergame/scenes/Scene_11.hpp @@ -1,45 +1,45 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/scene/SimpleVNScene.hpp" -#include "scenes/Scene_12.hpp" - -namespace Dawn { - class Scene_11 : public SimpleVNScene { - protected: - void vnStage() override { - - } - - void onSceneEnded() { - auto scene = new Scene_12(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - - public: - Scene_11(DawnGame *game) : SimpleVNScene(game) { - } - - std::vector getRequiredAssets() override { - std::vector assets = SimpleVNScene::getRequiredAssets(); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelPauseEvent(vnManager, 0.1f); - start - ->then(new VisualNovelTextboxEvent(vnManager, "scene.11.1")) - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_11::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/scene/SimpleVNScene.hpp" +#include "scenes/Scene_12.hpp" + +namespace Dawn { + class Scene_11 : public SimpleVNScene { + protected: + void vnStage() override { + + } + + void onSceneEnded() { + auto scene = new Scene_12(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + + public: + Scene_11(DawnGame *game) : SimpleVNScene(game) { + } + + std::vector getRequiredAssets() override { + std::vector assets = SimpleVNScene::getRequiredAssets(); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelPauseEvent(vnManager, 0.1f); + start + ->then(new VisualNovelTextboxEvent(vnManager, "scene.11.1")) + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_11::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_12.hpp b/archive/dawnpokergame/scenes/Scene_12.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_12.hpp rename to archive/dawnpokergame/scenes/Scene_12.hpp index 315e435a..ee5d7784 100644 --- a/src/dawnpokergame/scenes/Scene_12.hpp +++ b/archive/dawnpokergame/scenes/Scene_12.hpp @@ -1,66 +1,66 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "PokerVNScene.hpp" -#include "prefabs/characters/PennyPrefab.hpp" -#include "scenes/Scene_13.hpp" - -namespace Dawn { - class Scene_12 : public PokerVNScene { - protected: - PennyPrefab *penny; - PennyPrefab *julie; - PennyPrefab *sammy; - PennyPrefab *lucy; - - void vnStage() override { - penny = PennyPrefab::create(this); - julie = PennyPrefab::create(this); - sammy = PennyPrefab::create(this); - lucy = PennyPrefab::create(this); - - PokerVNScene::vnStage(); - } - - void onSceneEnded() { - auto scene = new Scene_13(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - - std::vector getPokerPlayers() override { - return std::vector{ - this->penny->getComponent(), - this->julie->getComponent(), - this->sammy->getComponent(), - this->lucy->getComponent() - }; - } - - public: - Scene_12(DawnGame *game) : PokerVNScene(game) {} - - std::vector getRequiredAssets() override { - auto assMan = &this->game->assetManager; - std::vector assets; - vectorAppend(&assets, PokerVNScene::getRequiredAssets()); - vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan)); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelTextboxEvent(vnManager, "scene.12.1"); - start - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_12::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "PokerVNScene.hpp" +#include "prefabs/characters/PennyPrefab.hpp" +#include "scenes/Scene_13.hpp" + +namespace Dawn { + class Scene_12 : public PokerVNScene { + protected: + PennyPrefab *penny; + PennyPrefab *julie; + PennyPrefab *sammy; + PennyPrefab *lucy; + + void vnStage() override { + penny = PennyPrefab::create(this); + julie = PennyPrefab::create(this); + sammy = PennyPrefab::create(this); + lucy = PennyPrefab::create(this); + + PokerVNScene::vnStage(); + } + + void onSceneEnded() { + auto scene = new Scene_13(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + + std::vector getPokerPlayers() override { + return std::vector{ + this->penny->getComponent(), + this->julie->getComponent(), + this->sammy->getComponent(), + this->lucy->getComponent() + }; + } + + public: + Scene_12(DawnGame *game) : PokerVNScene(game) {} + + std::vector getRequiredAssets() override { + auto assMan = &this->game->assetManager; + std::vector assets; + vectorAppend(&assets, PokerVNScene::getRequiredAssets()); + vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan)); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelTextboxEvent(vnManager, "scene.12.1"); + start + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_12::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_13.hpp b/archive/dawnpokergame/scenes/Scene_13.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_13.hpp rename to archive/dawnpokergame/scenes/Scene_13.hpp index 1f18dccb..6890badb 100644 --- a/src/dawnpokergame/scenes/Scene_13.hpp +++ b/archive/dawnpokergame/scenes/Scene_13.hpp @@ -1,45 +1,45 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/scene/SimpleVNScene.hpp" -#include "scenes/Scene_14.hpp" - -namespace Dawn { - class Scene_13 : public SimpleVNScene { - protected: - void vnStage() override { - - } - - void onSceneEnded() { - auto scene = new Scene_14(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - - public: - Scene_13(DawnGame *game) : SimpleVNScene(game) { - } - - std::vector getRequiredAssets() override { - std::vector assets = SimpleVNScene::getRequiredAssets(); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelPauseEvent(vnManager, 0.1f); - start - ->then(new VisualNovelTextboxEvent(vnManager, "scene.13.1")) - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_13::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/scene/SimpleVNScene.hpp" +#include "scenes/Scene_14.hpp" + +namespace Dawn { + class Scene_13 : public SimpleVNScene { + protected: + void vnStage() override { + + } + + void onSceneEnded() { + auto scene = new Scene_14(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + + public: + Scene_13(DawnGame *game) : SimpleVNScene(game) { + } + + std::vector getRequiredAssets() override { + std::vector assets = SimpleVNScene::getRequiredAssets(); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelPauseEvent(vnManager, 0.1f); + start + ->then(new VisualNovelTextboxEvent(vnManager, "scene.13.1")) + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_13::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_14.hpp b/archive/dawnpokergame/scenes/Scene_14.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_14.hpp rename to archive/dawnpokergame/scenes/Scene_14.hpp index efa467ed..f381f2cb 100644 --- a/src/dawnpokergame/scenes/Scene_14.hpp +++ b/archive/dawnpokergame/scenes/Scene_14.hpp @@ -1,45 +1,45 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/scene/SimpleVNScene.hpp" -#include "scenes/Scene_15.hpp" - -namespace Dawn { - class Scene_14 : public SimpleVNScene { - protected: - void vnStage() override { - - } - - void onSceneEnded() { - auto scene = new Scene_15(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - - public: - Scene_14(DawnGame *game) : SimpleVNScene(game) { - } - - std::vector getRequiredAssets() override { - std::vector assets = SimpleVNScene::getRequiredAssets(); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelPauseEvent(vnManager, 0.1f); - start - ->then(new VisualNovelTextboxEvent(vnManager, "scene.14.1")) - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_14::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/scene/SimpleVNScene.hpp" +#include "scenes/Scene_15.hpp" + +namespace Dawn { + class Scene_14 : public SimpleVNScene { + protected: + void vnStage() override { + + } + + void onSceneEnded() { + auto scene = new Scene_15(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + + public: + Scene_14(DawnGame *game) : SimpleVNScene(game) { + } + + std::vector getRequiredAssets() override { + std::vector assets = SimpleVNScene::getRequiredAssets(); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelPauseEvent(vnManager, 0.1f); + start + ->then(new VisualNovelTextboxEvent(vnManager, "scene.14.1")) + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_14::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_15.hpp b/archive/dawnpokergame/scenes/Scene_15.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_15.hpp rename to archive/dawnpokergame/scenes/Scene_15.hpp index 714912e3..0051021a 100644 --- a/src/dawnpokergame/scenes/Scene_15.hpp +++ b/archive/dawnpokergame/scenes/Scene_15.hpp @@ -1,45 +1,45 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/scene/SimpleVNScene.hpp" -#include "scenes/Scene_16.hpp" - -namespace Dawn { - class Scene_15 : public SimpleVNScene { - protected: - void vnStage() override { - - } - - void onSceneEnded() { - auto scene = new Scene_16(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - - public: - Scene_15(DawnGame *game) : SimpleVNScene(game) { - } - - std::vector getRequiredAssets() override { - std::vector assets = SimpleVNScene::getRequiredAssets(); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelPauseEvent(vnManager, 0.1f); - start - ->then(new VisualNovelTextboxEvent(vnManager, "scene.15.1")) - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_15::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/scene/SimpleVNScene.hpp" +#include "scenes/Scene_16.hpp" + +namespace Dawn { + class Scene_15 : public SimpleVNScene { + protected: + void vnStage() override { + + } + + void onSceneEnded() { + auto scene = new Scene_16(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + + public: + Scene_15(DawnGame *game) : SimpleVNScene(game) { + } + + std::vector getRequiredAssets() override { + std::vector assets = SimpleVNScene::getRequiredAssets(); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelPauseEvent(vnManager, 0.1f); + start + ->then(new VisualNovelTextboxEvent(vnManager, "scene.15.1")) + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_15::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_16.hpp b/archive/dawnpokergame/scenes/Scene_16.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_16.hpp rename to archive/dawnpokergame/scenes/Scene_16.hpp index befaaa73..3e535062 100644 --- a/src/dawnpokergame/scenes/Scene_16.hpp +++ b/archive/dawnpokergame/scenes/Scene_16.hpp @@ -1,45 +1,45 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/scene/SimpleVNScene.hpp" -#include "scenes/Scene_17.hpp" - -namespace Dawn { - class Scene_16 : public SimpleVNScene { - protected: - void vnStage() override { - - } - - void onSceneEnded() { - auto scene = new Scene_17(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - public: - Scene_16(DawnGame *game) : SimpleVNScene(game) { - } - - std::vector getRequiredAssets() override { - std::vector assets = SimpleVNScene::getRequiredAssets(); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelPauseEvent(vnManager, 0.1f); - start - ->then(new VisualNovelTextboxEvent(vnManager, "scene.16.1")) - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_16::onSceneEnded)) - ; - return start; - } - - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/scene/SimpleVNScene.hpp" +#include "scenes/Scene_17.hpp" + +namespace Dawn { + class Scene_16 : public SimpleVNScene { + protected: + void vnStage() override { + + } + + void onSceneEnded() { + auto scene = new Scene_17(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + public: + Scene_16(DawnGame *game) : SimpleVNScene(game) { + } + + std::vector getRequiredAssets() override { + std::vector assets = SimpleVNScene::getRequiredAssets(); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelPauseEvent(vnManager, 0.1f); + start + ->then(new VisualNovelTextboxEvent(vnManager, "scene.16.1")) + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_16::onSceneEnded)) + ; + return start; + } + + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_17.hpp b/archive/dawnpokergame/scenes/Scene_17.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_17.hpp rename to archive/dawnpokergame/scenes/Scene_17.hpp index e0e755ae..da120809 100644 --- a/src/dawnpokergame/scenes/Scene_17.hpp +++ b/archive/dawnpokergame/scenes/Scene_17.hpp @@ -1,66 +1,66 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "PokerVNScene.hpp" -#include "prefabs/characters/PennyPrefab.hpp" -#include "scenes/Scene_18.hpp" - -namespace Dawn { - class Scene_17 : public PokerVNScene { - protected: - PennyPrefab *penny; - PennyPrefab *julie; - PennyPrefab *sammy; - PennyPrefab *lucy; - - void vnStage() override { - penny = PennyPrefab::create(this); - julie = PennyPrefab::create(this); - sammy = PennyPrefab::create(this); - lucy = PennyPrefab::create(this); - - PokerVNScene::vnStage(); - } - - void onSceneEnded() { - auto scene = new Scene_18(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - - std::vector getPokerPlayers() override { - return std::vector{ - this->penny->getComponent(), - this->julie->getComponent(), - this->sammy->getComponent(), - this->lucy->getComponent() - }; - } - - public: - Scene_17(DawnGame *game) : PokerVNScene(game) {} - - std::vector getRequiredAssets() override { - auto assMan = &this->game->assetManager; - std::vector assets; - vectorAppend(&assets, PokerVNScene::getRequiredAssets()); - vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan)); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelTextboxEvent(vnManager, "scene.17.1"); - start - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_17::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "PokerVNScene.hpp" +#include "prefabs/characters/PennyPrefab.hpp" +#include "scenes/Scene_18.hpp" + +namespace Dawn { + class Scene_17 : public PokerVNScene { + protected: + PennyPrefab *penny; + PennyPrefab *julie; + PennyPrefab *sammy; + PennyPrefab *lucy; + + void vnStage() override { + penny = PennyPrefab::create(this); + julie = PennyPrefab::create(this); + sammy = PennyPrefab::create(this); + lucy = PennyPrefab::create(this); + + PokerVNScene::vnStage(); + } + + void onSceneEnded() { + auto scene = new Scene_18(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + + std::vector getPokerPlayers() override { + return std::vector{ + this->penny->getComponent(), + this->julie->getComponent(), + this->sammy->getComponent(), + this->lucy->getComponent() + }; + } + + public: + Scene_17(DawnGame *game) : PokerVNScene(game) {} + + std::vector getRequiredAssets() override { + auto assMan = &this->game->assetManager; + std::vector assets; + vectorAppend(&assets, PokerVNScene::getRequiredAssets()); + vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan)); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelTextboxEvent(vnManager, "scene.17.1"); + start + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_17::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_18.hpp b/archive/dawnpokergame/scenes/Scene_18.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_18.hpp rename to archive/dawnpokergame/scenes/Scene_18.hpp index acd5aabe..27b52403 100644 --- a/src/dawnpokergame/scenes/Scene_18.hpp +++ b/archive/dawnpokergame/scenes/Scene_18.hpp @@ -1,37 +1,37 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/scene/SimpleVNScene.hpp" - -namespace Dawn { - class Scene_18 : public SimpleVNScene { - protected: - void vnStage() override { - - } - - void onSceneEnded() { - } - - public: - Scene_18(DawnGame *game) : SimpleVNScene(game) { - } - - std::vector getRequiredAssets() override { - std::vector assets = SimpleVNScene::getRequiredAssets(); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelPauseEvent(vnManager, 0.1f); - start - ->then(new VisualNovelTextboxEvent(vnManager, "scene.18.1")) - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_18::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/scene/SimpleVNScene.hpp" + +namespace Dawn { + class Scene_18 : public SimpleVNScene { + protected: + void vnStage() override { + + } + + void onSceneEnded() { + } + + public: + Scene_18(DawnGame *game) : SimpleVNScene(game) { + } + + std::vector getRequiredAssets() override { + std::vector assets = SimpleVNScene::getRequiredAssets(); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelPauseEvent(vnManager, 0.1f); + start + ->then(new VisualNovelTextboxEvent(vnManager, "scene.18.1")) + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_18::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_2.hpp b/archive/dawnpokergame/scenes/Scene_2.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_2.hpp rename to archive/dawnpokergame/scenes/Scene_2.hpp index d88554f4..f98bee77 100644 --- a/src/dawnpokergame/scenes/Scene_2.hpp +++ b/archive/dawnpokergame/scenes/Scene_2.hpp @@ -1,46 +1,46 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/scene/SimpleVNScene.hpp" -#include "scenes/Scene_3.hpp" - -namespace Dawn { - class Scene_2 : public SimpleVNScene { - protected: - void vnStage() override { - - } - - void onSceneEnded() { - auto scene = new Scene_3(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - - public: - Scene_2(DawnGame *game) : SimpleVNScene(game) { - - } - - std::vector getRequiredAssets() override { - std::vector assets = SimpleVNScene::getRequiredAssets(); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelPauseEvent(vnManager, 0.1f); - start - ->then(new VisualNovelTextboxEvent(vnManager, "scene.2.1")) - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_2::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/scene/SimpleVNScene.hpp" +#include "scenes/Scene_3.hpp" + +namespace Dawn { + class Scene_2 : public SimpleVNScene { + protected: + void vnStage() override { + + } + + void onSceneEnded() { + auto scene = new Scene_3(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + + public: + Scene_2(DawnGame *game) : SimpleVNScene(game) { + + } + + std::vector getRequiredAssets() override { + std::vector assets = SimpleVNScene::getRequiredAssets(); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelPauseEvent(vnManager, 0.1f); + start + ->then(new VisualNovelTextboxEvent(vnManager, "scene.2.1")) + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_2::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_3.hpp b/archive/dawnpokergame/scenes/Scene_3.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_3.hpp rename to archive/dawnpokergame/scenes/Scene_3.hpp index b9b86270..de1aea1f 100644 --- a/src/dawnpokergame/scenes/Scene_3.hpp +++ b/archive/dawnpokergame/scenes/Scene_3.hpp @@ -1,46 +1,46 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/scene/SimpleVNScene.hpp" -#include "scenes/Scene_4.hpp" - -namespace Dawn { - class Scene_3 : public SimpleVNScene { - protected: - void vnStage() override { - - } - - void onSceneEnded() { - auto scene = new Scene_4(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - - public: - Scene_3(DawnGame *game) : SimpleVNScene(game) { - - } - - std::vector getRequiredAssets() override { - std::vector assets = SimpleVNScene::getRequiredAssets(); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelPauseEvent(vnManager, 0.1f); - start - ->then(new VisualNovelTextboxEvent(vnManager, "scene.3.1")) - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_3::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/scene/SimpleVNScene.hpp" +#include "scenes/Scene_4.hpp" + +namespace Dawn { + class Scene_3 : public SimpleVNScene { + protected: + void vnStage() override { + + } + + void onSceneEnded() { + auto scene = new Scene_4(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + + public: + Scene_3(DawnGame *game) : SimpleVNScene(game) { + + } + + std::vector getRequiredAssets() override { + std::vector assets = SimpleVNScene::getRequiredAssets(); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelPauseEvent(vnManager, 0.1f); + start + ->then(new VisualNovelTextboxEvent(vnManager, "scene.3.1")) + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_3::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_4.hpp b/archive/dawnpokergame/scenes/Scene_4.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_4.hpp rename to archive/dawnpokergame/scenes/Scene_4.hpp index 1e309ad3..bba24c86 100644 --- a/src/dawnpokergame/scenes/Scene_4.hpp +++ b/archive/dawnpokergame/scenes/Scene_4.hpp @@ -1,66 +1,66 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "PokerVNScene.hpp" -#include "prefabs/characters/PennyPrefab.hpp" -#include "scenes/Scene_5.hpp" - -namespace Dawn { - class Scene_4 : public PokerVNScene { - protected: - PennyPrefab *penny; - PennyPrefab *julie; - PennyPrefab *sammy; - PennyPrefab *lucy; - - void vnStage() override { - penny = PennyPrefab::create(this); - julie = PennyPrefab::create(this); - sammy = PennyPrefab::create(this); - lucy = PennyPrefab::create(this); - - PokerVNScene::vnStage(); - } - - void onSceneEnded() { - auto scene = new Scene_5(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - - std::vector getPokerPlayers() override { - return std::vector{ - this->penny->getComponent(), - this->julie->getComponent(), - this->sammy->getComponent(), - this->lucy->getComponent() - }; - } - - public: - Scene_4(DawnGame *game) : PokerVNScene(game) {} - - std::vector getRequiredAssets() override { - auto assMan = &this->game->assetManager; - std::vector assets; - vectorAppend(&assets, PokerVNScene::getRequiredAssets()); - vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan)); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelTextboxEvent(vnManager, "scene.4.1"); - start - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_4::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "PokerVNScene.hpp" +#include "prefabs/characters/PennyPrefab.hpp" +#include "scenes/Scene_5.hpp" + +namespace Dawn { + class Scene_4 : public PokerVNScene { + protected: + PennyPrefab *penny; + PennyPrefab *julie; + PennyPrefab *sammy; + PennyPrefab *lucy; + + void vnStage() override { + penny = PennyPrefab::create(this); + julie = PennyPrefab::create(this); + sammy = PennyPrefab::create(this); + lucy = PennyPrefab::create(this); + + PokerVNScene::vnStage(); + } + + void onSceneEnded() { + auto scene = new Scene_5(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + + std::vector getPokerPlayers() override { + return std::vector{ + this->penny->getComponent(), + this->julie->getComponent(), + this->sammy->getComponent(), + this->lucy->getComponent() + }; + } + + public: + Scene_4(DawnGame *game) : PokerVNScene(game) {} + + std::vector getRequiredAssets() override { + auto assMan = &this->game->assetManager; + std::vector assets; + vectorAppend(&assets, PokerVNScene::getRequiredAssets()); + vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan)); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelTextboxEvent(vnManager, "scene.4.1"); + start + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_4::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_5.hpp b/archive/dawnpokergame/scenes/Scene_5.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_5.hpp rename to archive/dawnpokergame/scenes/Scene_5.hpp index 68cbe7b0..8f4b88f5 100644 --- a/src/dawnpokergame/scenes/Scene_5.hpp +++ b/archive/dawnpokergame/scenes/Scene_5.hpp @@ -1,46 +1,46 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/scene/SimpleVNScene.hpp" -#include "scenes/Scene_6.hpp" - -namespace Dawn { - class Scene_5 : public SimpleVNScene { - protected: - void vnStage() override { - - } - - void onSceneEnded() { - auto scene = new Scene_6(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - - public: - Scene_5(DawnGame *game) : SimpleVNScene(game) { - - } - - std::vector getRequiredAssets() override { - std::vector assets = SimpleVNScene::getRequiredAssets(); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelPauseEvent(vnManager, 0.1f); - start - ->then(new VisualNovelTextboxEvent(vnManager, "scene.5.1")) - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_5::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/scene/SimpleVNScene.hpp" +#include "scenes/Scene_6.hpp" + +namespace Dawn { + class Scene_5 : public SimpleVNScene { + protected: + void vnStage() override { + + } + + void onSceneEnded() { + auto scene = new Scene_6(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + + public: + Scene_5(DawnGame *game) : SimpleVNScene(game) { + + } + + std::vector getRequiredAssets() override { + std::vector assets = SimpleVNScene::getRequiredAssets(); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelPauseEvent(vnManager, 0.1f); + start + ->then(new VisualNovelTextboxEvent(vnManager, "scene.5.1")) + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_5::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_6.hpp b/archive/dawnpokergame/scenes/Scene_6.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_6.hpp rename to archive/dawnpokergame/scenes/Scene_6.hpp index e56db675..1aac3a5e 100644 --- a/src/dawnpokergame/scenes/Scene_6.hpp +++ b/archive/dawnpokergame/scenes/Scene_6.hpp @@ -1,46 +1,46 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/scene/SimpleVNScene.hpp" -#include "scenes/Scene_7.hpp" - -namespace Dawn { - class Scene_6 : public SimpleVNScene { - protected: - void vnStage() override { - - } - - void onSceneEnded() { - auto scene = new Scene_7(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - - public: - Scene_6(DawnGame *game) : SimpleVNScene(game) { - - } - - std::vector getRequiredAssets() override { - std::vector assets = SimpleVNScene::getRequiredAssets(); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelPauseEvent(vnManager, 0.1f); - start - ->then(new VisualNovelTextboxEvent(vnManager, "scene.6.1")) - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_6::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/scene/SimpleVNScene.hpp" +#include "scenes/Scene_7.hpp" + +namespace Dawn { + class Scene_6 : public SimpleVNScene { + protected: + void vnStage() override { + + } + + void onSceneEnded() { + auto scene = new Scene_7(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + + public: + Scene_6(DawnGame *game) : SimpleVNScene(game) { + + } + + std::vector getRequiredAssets() override { + std::vector assets = SimpleVNScene::getRequiredAssets(); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelPauseEvent(vnManager, 0.1f); + start + ->then(new VisualNovelTextboxEvent(vnManager, "scene.6.1")) + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_6::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_7.hpp b/archive/dawnpokergame/scenes/Scene_7.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_7.hpp rename to archive/dawnpokergame/scenes/Scene_7.hpp index ee9889ae..7bddaea4 100644 --- a/src/dawnpokergame/scenes/Scene_7.hpp +++ b/archive/dawnpokergame/scenes/Scene_7.hpp @@ -1,45 +1,45 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/scene/SimpleVNScene.hpp" -#include "scenes/Scene_8.hpp" - -namespace Dawn { - class Scene_7 : public SimpleVNScene { - protected: - void vnStage() override { - - } - - void onSceneEnded() { - auto scene = new Scene_8(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - - public: - Scene_7(DawnGame *game) : SimpleVNScene(game) { - } - - std::vector getRequiredAssets() override { - std::vector assets = SimpleVNScene::getRequiredAssets(); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelPauseEvent(vnManager, 0.1f); - start - ->then(new VisualNovelTextboxEvent(vnManager, "scene.7.1")) - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_7::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/scene/SimpleVNScene.hpp" +#include "scenes/Scene_8.hpp" + +namespace Dawn { + class Scene_7 : public SimpleVNScene { + protected: + void vnStage() override { + + } + + void onSceneEnded() { + auto scene = new Scene_8(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + + public: + Scene_7(DawnGame *game) : SimpleVNScene(game) { + } + + std::vector getRequiredAssets() override { + std::vector assets = SimpleVNScene::getRequiredAssets(); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelPauseEvent(vnManager, 0.1f); + start + ->then(new VisualNovelTextboxEvent(vnManager, "scene.7.1")) + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_7::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_8.hpp b/archive/dawnpokergame/scenes/Scene_8.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_8.hpp rename to archive/dawnpokergame/scenes/Scene_8.hpp index 45a47ed5..fada6e45 100644 --- a/src/dawnpokergame/scenes/Scene_8.hpp +++ b/archive/dawnpokergame/scenes/Scene_8.hpp @@ -1,66 +1,66 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "PokerVNScene.hpp" -#include "prefabs/characters/PennyPrefab.hpp" -#include "scenes/Scene_9.hpp" - -namespace Dawn { - class Scene_8 : public PokerVNScene { - protected: - PennyPrefab *penny; - PennyPrefab *julie; - PennyPrefab *sammy; - PennyPrefab *lucy; - - void vnStage() override { - penny = PennyPrefab::create(this); - julie = PennyPrefab::create(this); - sammy = PennyPrefab::create(this); - lucy = PennyPrefab::create(this); - - PokerVNScene::vnStage(); - } - - void onSceneEnded() { - auto scene = new Scene_9(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - - std::vector getPokerPlayers() override { - return std::vector{ - this->penny->getComponent(), - this->julie->getComponent(), - this->sammy->getComponent(), - this->lucy->getComponent() - }; - } - - public: - Scene_8(DawnGame *game) : PokerVNScene(game) {} - - std::vector getRequiredAssets() override { - auto assMan = &this->game->assetManager; - std::vector assets; - vectorAppend(&assets, PokerVNScene::getRequiredAssets()); - vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan)); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelTextboxEvent(vnManager, "scene.8.1"); - start - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_8::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "PokerVNScene.hpp" +#include "prefabs/characters/PennyPrefab.hpp" +#include "scenes/Scene_9.hpp" + +namespace Dawn { + class Scene_8 : public PokerVNScene { + protected: + PennyPrefab *penny; + PennyPrefab *julie; + PennyPrefab *sammy; + PennyPrefab *lucy; + + void vnStage() override { + penny = PennyPrefab::create(this); + julie = PennyPrefab::create(this); + sammy = PennyPrefab::create(this); + lucy = PennyPrefab::create(this); + + PokerVNScene::vnStage(); + } + + void onSceneEnded() { + auto scene = new Scene_9(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + + std::vector getPokerPlayers() override { + return std::vector{ + this->penny->getComponent(), + this->julie->getComponent(), + this->sammy->getComponent(), + this->lucy->getComponent() + }; + } + + public: + Scene_8(DawnGame *game) : PokerVNScene(game) {} + + std::vector getRequiredAssets() override { + auto assMan = &this->game->assetManager; + std::vector assets; + vectorAppend(&assets, PokerVNScene::getRequiredAssets()); + vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan)); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelTextboxEvent(vnManager, "scene.8.1"); + start + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_8::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/Scene_9.hpp b/archive/dawnpokergame/scenes/Scene_9.hpp similarity index 96% rename from src/dawnpokergame/scenes/Scene_9.hpp rename to archive/dawnpokergame/scenes/Scene_9.hpp index f6908351..ee233cc6 100644 --- a/src/dawnpokergame/scenes/Scene_9.hpp +++ b/archive/dawnpokergame/scenes/Scene_9.hpp @@ -1,45 +1,45 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/scene/SimpleVNScene.hpp" -#include "scenes/Scene_10.hpp" - -namespace Dawn { - class Scene_9 : public SimpleVNScene { - protected: - void vnStage() override { - - } - - void onSceneEnded() { - auto scene = new Scene_10(this->game); - game->assetManager.queueSwap( - scene->getRequiredAssets(), this->getRequiredAssets() - ); - game->assetManager.syncLoad(); - scene->stage(); - this->game->sceneCutover(scene); - } - - public: - Scene_9(DawnGame *game) : SimpleVNScene(game) { - } - - std::vector getRequiredAssets() override { - std::vector assets = SimpleVNScene::getRequiredAssets(); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto start = new VisualNovelPauseEvent(vnManager, 0.1f); - start - ->then(new VisualNovelTextboxEvent(vnManager, "scene.9.1")) - ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_9::onSceneEnded)) - ; - return start; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/scene/SimpleVNScene.hpp" +#include "scenes/Scene_10.hpp" + +namespace Dawn { + class Scene_9 : public SimpleVNScene { + protected: + void vnStage() override { + + } + + void onSceneEnded() { + auto scene = new Scene_10(this->game); + game->assetManager.queueSwap( + scene->getRequiredAssets(), this->getRequiredAssets() + ); + game->assetManager.syncLoad(); + scene->stage(); + this->game->sceneCutover(scene); + } + + public: + Scene_9(DawnGame *game) : SimpleVNScene(game) { + } + + std::vector getRequiredAssets() override { + std::vector assets = SimpleVNScene::getRequiredAssets(); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto start = new VisualNovelPauseEvent(vnManager, 0.1f); + start + ->then(new VisualNovelTextboxEvent(vnManager, "scene.9.1")) + ->then(new VisualNovelCallbackEvent(vnManager, this, &Scene_9::onSceneEnded)) + ; + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/scenes/TestScene.hpp b/archive/dawnpokergame/scenes/TestScene.hpp similarity index 97% rename from src/dawnpokergame/scenes/TestScene.hpp rename to archive/dawnpokergame/scenes/TestScene.hpp index d32a9f02..a75f51db 100644 --- a/src/dawnpokergame/scenes/TestScene.hpp +++ b/archive/dawnpokergame/scenes/TestScene.hpp @@ -1,57 +1,57 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "PokerVNScene.hpp" -#include "prefabs/characters/PennyPrefab.hpp" - -namespace Dawn { - class TestScene : public PokerVNScene { - protected: - PennyPrefab *penny; - PennyPrefab *julie; - PennyPrefab *sammy; - PennyPrefab *lucy; - - void vnStage() override { - penny = PennyPrefab::create(this); - julie = PennyPrefab::create(this); - sammy = PennyPrefab::create(this); - lucy = PennyPrefab::create(this); - - PokerVNScene::vnStage(); - } - - std::vector getPokerPlayers() override { - return std::vector{ - this->penny->getComponent(), - this->julie->getComponent(), - this->sammy->getComponent(), - this->lucy->getComponent() - }; - } - - public: - TestScene(DawnGame *game) : PokerVNScene(game) {} - - std::vector getRequiredAssets() override { - auto assMan = &this->game->assetManager; - std::vector assets; - vectorAppend(&assets, PokerVNScene::getRequiredAssets()); - vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan)); - assets.push_back(assMan->get("texture_tavern_night")); - return assets; - } - - IVisualNovelEvent * getVNEvent() override { - auto texture = this->game->assetManager.get("texture_tavern_night"); - auto start = new VisualNovelChangeSimpleBackgroundEvent( - vnManager, &texture->texture - ); - start->then(new VisualNovelTextboxEvent(vnManager, penny->getComponent(), "1234")); - return start; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "PokerVNScene.hpp" +#include "prefabs/characters/PennyPrefab.hpp" + +namespace Dawn { + class TestScene : public PokerVNScene { + protected: + PennyPrefab *penny; + PennyPrefab *julie; + PennyPrefab *sammy; + PennyPrefab *lucy; + + void vnStage() override { + penny = PennyPrefab::create(this); + julie = PennyPrefab::create(this); + sammy = PennyPrefab::create(this); + lucy = PennyPrefab::create(this); + + PokerVNScene::vnStage(); + } + + std::vector getPokerPlayers() override { + return std::vector{ + this->penny->getComponent(), + this->julie->getComponent(), + this->sammy->getComponent(), + this->lucy->getComponent() + }; + } + + public: + TestScene(DawnGame *game) : PokerVNScene(game) {} + + std::vector getRequiredAssets() override { + auto assMan = &this->game->assetManager; + std::vector assets; + vectorAppend(&assets, PokerVNScene::getRequiredAssets()); + vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan)); + assets.push_back(assMan->get("texture_tavern_night")); + return assets; + } + + IVisualNovelEvent * getVNEvent() override { + auto texture = this->game->assetManager.get("texture_tavern_night"); + auto start = new VisualNovelChangeSimpleBackgroundEvent( + vnManager, &texture->texture + ); + start->then(new VisualNovelTextboxEvent(vnManager, penny->getComponent(), "1234")); + return start; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/ui/CMakeLists.txt b/archive/dawnpokergame/ui/CMakeLists.txt similarity index 100% rename from src/dawnpokergame/ui/CMakeLists.txt rename to archive/dawnpokergame/ui/CMakeLists.txt diff --git a/src/dawnpokergame/ui/PokerGameBorder.hpp b/archive/dawnpokergame/ui/PokerGameBorder.hpp similarity index 96% rename from src/dawnpokergame/ui/PokerGameBorder.hpp rename to archive/dawnpokergame/ui/PokerGameBorder.hpp index b7d3a46b..1398b35b 100644 --- a/src/dawnpokergame/ui/PokerGameBorder.hpp +++ b/archive/dawnpokergame/ui/PokerGameBorder.hpp @@ -1,32 +1,32 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "ui/UIBorder.hpp" -#include "asset/assets/TextureAsset.hpp" -#include "game/DawnGame.hpp" - -namespace Dawn { - class PokerGameBorder { - public: - static std::vector getAssets(AssetManager *man) { - return std::vector{ - man->get("texture_test") - }; - } - - static void apply(UIBorder *border) { - auto text = border->getGame()->assetManager.get("texture_test"); - border->texture = &text->texture; - border->setBorderSize(glm::vec2(16, 16)); - } - - static UIBorder * create(UICanvas *canvas) { - auto border = canvas->addElement(); - PokerGameBorder::apply(border); - return border; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "ui/UIBorder.hpp" +#include "asset/assets/TextureAsset.hpp" +#include "game/DawnGame.hpp" + +namespace Dawn { + class PokerGameBorder { + public: + static std::vector getAssets(AssetManager *man) { + return std::vector{ + man->get("texture_test") + }; + } + + static void apply(UIBorder *border) { + auto text = border->getGame()->assetManager.get("texture_test"); + border->texture = &text->texture; + border->setBorderSize(glm::vec2(16, 16)); + } + + static UIBorder * create(UICanvas *canvas) { + auto border = canvas->addElement(); + PokerGameBorder::apply(border); + return border; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/ui/PokerGameTextbox.hpp b/archive/dawnpokergame/ui/PokerGameTextbox.hpp similarity index 96% rename from src/dawnpokergame/ui/PokerGameTextbox.hpp rename to archive/dawnpokergame/ui/PokerGameTextbox.hpp index 8c7b749e..8a6d86c4 100644 --- a/src/dawnpokergame/ui/PokerGameTextbox.hpp +++ b/archive/dawnpokergame/ui/PokerGameTextbox.hpp @@ -1,46 +1,46 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "ui/PokerGameBorder.hpp" -#include "visualnovel/ui/VisualNovelTextbox.hpp" -#include "asset/assets/TrueTypeAsset.hpp" - -namespace Dawn { - class PokerGameTextbox { - public: - static std::vector getAssets(AssetManager *man) { - assertNotNull(man); - - std::vector assets; - vectorAppend(&assets, &PokerGameBorder::getAssets(man)); - assets.push_back(man->get("truetype_ark")); - return assets; - } - - static void apply(VisualNovelTextbox *textbox) { - assertNotNull(textbox); - - auto assetFont = textbox->getGame()->assetManager.get("truetype_ark"); - PokerGameBorder::apply(&textbox->border); - textbox->setFont(&assetFont->font); - textbox->setFontSize(40); - textbox->setLabelPadding(glm::vec2(10, 8)); - } - - static VisualNovelTextbox * create(UICanvas *canvas) { - assertNotNull(canvas); - - auto textbox = canvas->addElement(); - PokerGameTextbox::apply(textbox); - textbox->setTransform( - UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_END, - glm::vec4(0, 238, 0, 0), - 0.0f - ); - return textbox; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "ui/PokerGameBorder.hpp" +#include "visualnovel/ui/VisualNovelTextbox.hpp" +#include "asset/assets/TrueTypeAsset.hpp" + +namespace Dawn { + class PokerGameTextbox { + public: + static std::vector getAssets(AssetManager *man) { + assertNotNull(man); + + std::vector assets; + vectorAppend(&assets, &PokerGameBorder::getAssets(man)); + assets.push_back(man->get("truetype_ark")); + return assets; + } + + static void apply(VisualNovelTextbox *textbox) { + assertNotNull(textbox); + + auto assetFont = textbox->getGame()->assetManager.get("truetype_ark"); + PokerGameBorder::apply(&textbox->border); + textbox->setFont(&assetFont->font); + textbox->setFontSize(40); + textbox->setLabelPadding(glm::vec2(10, 8)); + } + + static VisualNovelTextbox * create(UICanvas *canvas) { + assertNotNull(canvas); + + auto textbox = canvas->addElement(); + PokerGameTextbox::apply(textbox); + textbox->setTransform( + UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_END, + glm::vec4(0, 238, 0, 0), + 0.0f + ); + return textbox; + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/ui/PokerPlayerDisplay.cpp b/archive/dawnpokergame/ui/PokerPlayerDisplay.cpp similarity index 96% rename from src/dawnpokergame/ui/PokerPlayerDisplay.cpp rename to archive/dawnpokergame/ui/PokerPlayerDisplay.cpp index b6167e24..7d8660b4 100644 --- a/src/dawnpokergame/ui/PokerPlayerDisplay.cpp +++ b/archive/dawnpokergame/ui/PokerPlayerDisplay.cpp @@ -1,101 +1,101 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "PokerPlayerDisplay.hpp" -#include "game/DawnGame.hpp" - -using namespace Dawn; - -PokerPlayerDisplay::PokerPlayerDisplay(UICanvas *canvas) : - UIEmpty(canvas), - labelName(canvas), - labelChips(canvas), - borderInner(canvas), - border(canvas), - animChips(&animChipsValue) -{ - this->font = getGame()->assetManager.get("truetype_ark"); - - // Border - this->addChild(&this->border); - PokerGameBorder::apply(&this->border); - this->border.setTransform( - UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH, - glm::vec4(0, 0, 0, 0), - 0.0f - ); - - // Border Inner - this->addChild(&this->borderInner); - this->borderInner.setTransform( - UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH, - glm::vec4(this->border.getBorderSize(), this->border.getBorderSize()), - 0.0f - ); - - // Player Name - this->borderInner.addChild(&this->labelName); - this->labelName.setText("undefined"); - this->labelName.setFont(&this->font->font); - this->labelName.setFontSize(40); - this->labelName.setTransform( - UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START, - glm::vec4(0, 0, 0, 0), - 0.0f - ); - - // Chips label - this->borderInner.addChild(&this->labelChips); - this->labelChips.setFont(&this->font->font); - this->labelChips.setFontSize(40); - this->labelChips.setTransform( - UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START, - glm::vec4(0, this->labelName.getContentHeight(), 0, 0), - 0.0f - ); - - // Anim - this->animChips.easing = &easeOutQuart; - - // Events - getScene()->eventSceneUnpausedUpdate.addListener(this, &PokerPlayerDisplay::onSceneUpdate); -} - -void PokerPlayerDisplay::setPlayer(PokerPlayer *player) { - assertNull(this->player); - this->player = player; - - player->eventChipsChanged.addListener(this, &PokerPlayerDisplay::onPlayerChipsChanged); - - this->labelName.setText("undefined"); - this->animChips.clear(); - this->animChips.restart(); - this->animChipsValue = player->chips; - - this->updatePositions(); -} - -void PokerPlayerDisplay::onSceneUpdate() { - this->animChips.tick(getGame()->timeManager.delta); - - // std::stringstream stream; - // stream.precision(0); - // stream << "$"; - // stream << this->animChipsValue; - this->labelChips.setText("undefined"); -} - -void PokerPlayerDisplay::onPlayerChipsChanged() { - std::cout << "Chips" << player->chips << std::endl; - - this->animChips.clear(); - this->animChips.addKeyframe(0.0f, this->animChipsValue); - this->animChips.addKeyframe(1.0f, this->player->chips); - this->animChips.restart(); -} - -PokerPlayerDisplay::~PokerPlayerDisplay() { - this->canvas->getScene()->eventSceneUnpausedUpdate.removeListener(this, &PokerPlayerDisplay::onSceneUpdate); +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "PokerPlayerDisplay.hpp" +#include "game/DawnGame.hpp" + +using namespace Dawn; + +PokerPlayerDisplay::PokerPlayerDisplay(UICanvas *canvas) : + UIEmpty(canvas), + labelName(canvas), + labelChips(canvas), + borderInner(canvas), + border(canvas), + animChips(&animChipsValue) +{ + this->font = getGame()->assetManager.get("truetype_ark"); + + // Border + this->addChild(&this->border); + PokerGameBorder::apply(&this->border); + this->border.setTransform( + UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH, + glm::vec4(0, 0, 0, 0), + 0.0f + ); + + // Border Inner + this->addChild(&this->borderInner); + this->borderInner.setTransform( + UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH, + glm::vec4(this->border.getBorderSize(), this->border.getBorderSize()), + 0.0f + ); + + // Player Name + this->borderInner.addChild(&this->labelName); + this->labelName.setText("undefined"); + this->labelName.setFont(&this->font->font); + this->labelName.setFontSize(40); + this->labelName.setTransform( + UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START, + glm::vec4(0, 0, 0, 0), + 0.0f + ); + + // Chips label + this->borderInner.addChild(&this->labelChips); + this->labelChips.setFont(&this->font->font); + this->labelChips.setFontSize(40); + this->labelChips.setTransform( + UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START, + glm::vec4(0, this->labelName.getContentHeight(), 0, 0), + 0.0f + ); + + // Anim + this->animChips.easing = &easeOutQuart; + + // Events + getScene()->eventSceneUnpausedUpdate.addListener(this, &PokerPlayerDisplay::onSceneUpdate); +} + +void PokerPlayerDisplay::setPlayer(PokerPlayer *player) { + assertNull(this->player); + this->player = player; + + player->eventChipsChanged.addListener(this, &PokerPlayerDisplay::onPlayerChipsChanged); + + this->labelName.setText("undefined"); + this->animChips.clear(); + this->animChips.restart(); + this->animChipsValue = player->chips; + + this->updatePositions(); +} + +void PokerPlayerDisplay::onSceneUpdate() { + this->animChips.tick(getGame()->timeManager.delta); + + // std::stringstream stream; + // stream.precision(0); + // stream << "$"; + // stream << this->animChipsValue; + this->labelChips.setText("undefined"); +} + +void PokerPlayerDisplay::onPlayerChipsChanged() { + std::cout << "Chips" << player->chips << std::endl; + + this->animChips.clear(); + this->animChips.addKeyframe(0.0f, this->animChipsValue); + this->animChips.addKeyframe(1.0f, this->player->chips); + this->animChips.restart(); +} + +PokerPlayerDisplay::~PokerPlayerDisplay() { + this->canvas->getScene()->eventSceneUnpausedUpdate.removeListener(this, &PokerPlayerDisplay::onSceneUpdate); } \ No newline at end of file diff --git a/src/dawnpokergame/ui/PokerPlayerDisplay.hpp b/archive/dawnpokergame/ui/PokerPlayerDisplay.hpp similarity index 96% rename from src/dawnpokergame/ui/PokerPlayerDisplay.hpp rename to archive/dawnpokergame/ui/PokerPlayerDisplay.hpp index fbd530c5..91ad8c32 100644 --- a/src/dawnpokergame/ui/PokerPlayerDisplay.hpp +++ b/archive/dawnpokergame/ui/PokerPlayerDisplay.hpp @@ -1,48 +1,48 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "ui/UILabel.hpp" -#include "ui/UIEmpty.hpp" -#include "ui/UIBorder.hpp" -#include "poker/PokerPlayer.hpp" -#include "asset/AssetManager.hpp" -#include "asset/assets/TrueTypeAsset.hpp" -#include "display/animation/SimpleAnimation.hpp" -#include "ui/PokerGameBorder.hpp" - -namespace Dawn { - class PokerPlayerDisplay : public UIEmpty { - private: - SimpleAnimation animChips; - int32_t animChipsValue; - - protected: - PokerPlayer *player = nullptr; - UILabel labelName; - UILabel labelChips; - UIEmpty borderInner; - UIBorder border; - - TrueTypeAsset *font; - - void onPlayerChipsChanged(); - void onSceneUpdate(); - - public: - static std::vector getAssets(AssetManager *assMan) { - std::vector assets; - assets = PokerGameBorder::getAssets(assMan); - assets.push_back(assMan->get("truetype_alice")); - return assets; - } - - PokerPlayerDisplay(UICanvas *canvas); - - void setPlayer(PokerPlayer *player); - - ~PokerPlayerDisplay(); - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "ui/UILabel.hpp" +#include "ui/UIEmpty.hpp" +#include "ui/UIBorder.hpp" +#include "poker/PokerPlayer.hpp" +#include "asset/AssetManager.hpp" +#include "asset/assets/TrueTypeAsset.hpp" +#include "display/animation/SimpleAnimation.hpp" +#include "ui/PokerGameBorder.hpp" + +namespace Dawn { + class PokerPlayerDisplay : public UIEmpty { + private: + SimpleAnimation animChips; + int32_t animChipsValue; + + protected: + PokerPlayer *player = nullptr; + UILabel labelName; + UILabel labelChips; + UIEmpty borderInner; + UIBorder border; + + TrueTypeAsset *font; + + void onPlayerChipsChanged(); + void onSceneUpdate(); + + public: + static std::vector getAssets(AssetManager *assMan) { + std::vector assets; + assets = PokerGameBorder::getAssets(assMan); + assets.push_back(assMan->get("truetype_alice")); + return assets; + } + + PokerPlayerDisplay(UICanvas *canvas); + + void setPlayer(PokerPlayer *player); + + ~PokerPlayerDisplay(); + }; } \ No newline at end of file diff --git a/src/dawnpokergame/visualnovel/CMakeLists.txt b/archive/dawnpokergame/visualnovel/CMakeLists.txt similarity index 95% rename from src/dawnpokergame/visualnovel/CMakeLists.txt rename to archive/dawnpokergame/visualnovel/CMakeLists.txt index cfbbb489..2c2bd686 100644 --- a/src/dawnpokergame/visualnovel/CMakeLists.txt +++ b/archive/dawnpokergame/visualnovel/CMakeLists.txt @@ -1,13 +1,13 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - VNPlayer.cpp -) - -# Subdirs +# Copyright (c) 2022 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + VNPlayer.cpp +) + +# Subdirs add_subdirectory(events) \ No newline at end of file diff --git a/src/dawnpokergame/visualnovel/VNPlayer.cpp b/archive/dawnpokergame/visualnovel/VNPlayer.cpp similarity index 95% rename from src/dawnpokergame/visualnovel/VNPlayer.cpp rename to archive/dawnpokergame/visualnovel/VNPlayer.cpp index c89cfa60..3f19b898 100644 --- a/src/dawnpokergame/visualnovel/VNPlayer.cpp +++ b/archive/dawnpokergame/visualnovel/VNPlayer.cpp @@ -1,12 +1,12 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "VNPlayer.hpp" - -using namespace Dawn; - -VNPlayer::VNPlayer(SceneItem *item) : SceneItemComponent(item) { - +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "VNPlayer.hpp" + +using namespace Dawn; + +VNPlayer::VNPlayer(SceneItem *item) : SceneItemComponent(item) { + } \ No newline at end of file diff --git a/src/dawnpokergame/visualnovel/VNPlayer.hpp b/archive/dawnpokergame/visualnovel/VNPlayer.hpp similarity index 95% rename from src/dawnpokergame/visualnovel/VNPlayer.hpp rename to archive/dawnpokergame/visualnovel/VNPlayer.hpp index 2e1a44e1..3c0481dd 100644 --- a/src/dawnpokergame/visualnovel/VNPlayer.hpp +++ b/archive/dawnpokergame/visualnovel/VNPlayer.hpp @@ -1,18 +1,18 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" -#include "scene/SceneItemComponent.hpp" - -namespace Dawn { - class VNPlayer : public SceneItemComponent { - protected: - - - public: - VNPlayer(SceneItem *item); - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "dawnlibs.hpp" +#include "scene/SceneItemComponent.hpp" + +namespace Dawn { + class VNPlayer : public SceneItemComponent { + protected: + + + public: + VNPlayer(SceneItem *item); + }; } \ No newline at end of file diff --git a/src/dawnpokergame/visualnovel/events/CMakeLists.txt b/archive/dawnpokergame/visualnovel/events/CMakeLists.txt similarity index 95% rename from src/dawnpokergame/visualnovel/events/CMakeLists.txt rename to archive/dawnpokergame/visualnovel/events/CMakeLists.txt index 9b7b0923..29662110 100644 --- a/src/dawnpokergame/visualnovel/events/CMakeLists.txt +++ b/archive/dawnpokergame/visualnovel/events/CMakeLists.txt @@ -1,10 +1,10 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - PokerBetLoopEvent.cpp +# Copyright (c) 2022 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + PokerBetLoopEvent.cpp ) \ No newline at end of file diff --git a/src/dawnpokergame/visualnovel/events/PokerBetLoopEvent.cpp b/archive/dawnpokergame/visualnovel/events/PokerBetLoopEvent.cpp similarity index 97% rename from src/dawnpokergame/visualnovel/events/PokerBetLoopEvent.cpp rename to archive/dawnpokergame/visualnovel/events/PokerBetLoopEvent.cpp index bba714dc..ee2a0dac 100644 --- a/src/dawnpokergame/visualnovel/events/PokerBetLoopEvent.cpp +++ b/archive/dawnpokergame/visualnovel/events/PokerBetLoopEvent.cpp @@ -1,64 +1,64 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "PokerBetLoopEvent.hpp" -#include "PokerInitialEvent.hpp" - -using namespace Dawn; - -void PokerBetLoopEvent::onStart(IVisualNovelEvent *prev) { - PokerGameEvent::onStart(prev); - std::cout << "Bet Loop, bet" << std::endl; - - auto evt2 = new PokerDetermineBetterEvent(this->manager); - - auto betting = this->then(evt2); - betting - // ->whenEveryoneFolded(new VisualNovelTextboxEvent(this->manager, "Everyone Folded")) - ->then(new PokerWinnerEvent(this->manager)) - ->then(new PokerInitialEvent(this->manager)) - ; - betting - // ->whenBettingFinished(new VisualNovelTextboxEvent(this->manager, "Betting Finished")) - ->then(new PokerWinnerEvent(this->manager)) - ->then(new PokerInitialEvent(this->manager)) - ; - betting - ->whenTurn(new PokerTurnEvent(this->manager)) - // ->then(new VisualNovelTextboxEvent(this->manager, "Turn Time")) - ->then(new PokerNewBettingRoundEvent(this->manager)) - ->then(new PokerBetLoopEvent(this->manager)) - ; - betting - // ->whenHumanBet(new VisualNovelTextboxEvent(this->manager, "Human Bet")) - ->then(new PokerBetLoopEvent(this->manager)) - ; - - // AI Betting - auto aiBet = betting - // ->whenAiBet(new VisualNovelTextboxEvent(this->manager, "AI Bet")) - ->then(new PokerAIBetEvent(this->manager)) - ; - aiBet - // ->whenFolded(new VisualNovelTextboxEvent(this->manager, "Folded")) - ->then(new PokerBetLoopEvent(this->manager)) - ; - aiBet - // ->whenAllIn(new VisualNovelTextboxEvent(this->manager, "All In")) - ->then(new PokerBetLoopEvent(this->manager)) - ; - aiBet - // ->whenBetting(new VisualNovelTextboxEvent(this->manager, "Betting")) - ->then(new PokerBetLoopEvent(this->manager)) - ; - aiBet - // ->whenCalling(new VisualNovelTextboxEvent(this->manager, "Calling")) - ->then(new PokerBetLoopEvent(this->manager)) - ; - aiBet - // ->whenChecking(new VisualNovelTextboxEvent(this->manager, "Checking")) - ->then(new PokerBetLoopEvent(this->manager)) - ; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "PokerBetLoopEvent.hpp" +#include "PokerInitialEvent.hpp" + +using namespace Dawn; + +void PokerBetLoopEvent::onStart(IVisualNovelEvent *prev) { + PokerGameEvent::onStart(prev); + std::cout << "Bet Loop, bet" << std::endl; + + auto evt2 = new PokerDetermineBetterEvent(this->manager); + + auto betting = this->then(evt2); + betting + // ->whenEveryoneFolded(new VisualNovelTextboxEvent(this->manager, "Everyone Folded")) + ->then(new PokerWinnerEvent(this->manager)) + ->then(new PokerInitialEvent(this->manager)) + ; + betting + // ->whenBettingFinished(new VisualNovelTextboxEvent(this->manager, "Betting Finished")) + ->then(new PokerWinnerEvent(this->manager)) + ->then(new PokerInitialEvent(this->manager)) + ; + betting + ->whenTurn(new PokerTurnEvent(this->manager)) + // ->then(new VisualNovelTextboxEvent(this->manager, "Turn Time")) + ->then(new PokerNewBettingRoundEvent(this->manager)) + ->then(new PokerBetLoopEvent(this->manager)) + ; + betting + // ->whenHumanBet(new VisualNovelTextboxEvent(this->manager, "Human Bet")) + ->then(new PokerBetLoopEvent(this->manager)) + ; + + // AI Betting + auto aiBet = betting + // ->whenAiBet(new VisualNovelTextboxEvent(this->manager, "AI Bet")) + ->then(new PokerAIBetEvent(this->manager)) + ; + aiBet + // ->whenFolded(new VisualNovelTextboxEvent(this->manager, "Folded")) + ->then(new PokerBetLoopEvent(this->manager)) + ; + aiBet + // ->whenAllIn(new VisualNovelTextboxEvent(this->manager, "All In")) + ->then(new PokerBetLoopEvent(this->manager)) + ; + aiBet + // ->whenBetting(new VisualNovelTextboxEvent(this->manager, "Betting")) + ->then(new PokerBetLoopEvent(this->manager)) + ; + aiBet + // ->whenCalling(new VisualNovelTextboxEvent(this->manager, "Calling")) + ->then(new PokerBetLoopEvent(this->manager)) + ; + aiBet + // ->whenChecking(new VisualNovelTextboxEvent(this->manager, "Checking")) + ->then(new PokerBetLoopEvent(this->manager)) + ; } \ No newline at end of file diff --git a/src/dawnpokergame/visualnovel/events/PokerBetLoopEvent.hpp b/archive/dawnpokergame/visualnovel/events/PokerBetLoopEvent.hpp similarity index 96% rename from src/dawnpokergame/visualnovel/events/PokerBetLoopEvent.hpp rename to archive/dawnpokergame/visualnovel/events/PokerBetLoopEvent.hpp index 4796e5b1..6378bc00 100644 --- a/src/dawnpokergame/visualnovel/events/PokerBetLoopEvent.hpp +++ b/archive/dawnpokergame/visualnovel/events/PokerBetLoopEvent.hpp @@ -1,36 +1,36 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "poker/visualnovel/PokerNewGameEvent.hpp" -#include "poker/visualnovel/PokerNewRoundEvent.hpp" -#include "poker/visualnovel/PokerTakeBlindsEvent.hpp" -#include "poker/visualnovel/PokerDealEvent.hpp" -#include "poker/visualnovel/PokerTurnEvent.hpp" -#include "poker/visualnovel/PokerDetermineBetterEvent.hpp" -#include "poker/visualnovel/PokerAIBetEvent.hpp" -#include "poker/visualnovel/PokerNewBettingRoundEvent.hpp" -#include "poker/visualnovel/PokerWinnerEvent.hpp" - -#define POKER_DEAL_EVENT_CARD_COUNT 2 - -namespace Dawn { - class PokerBetLoopEvent : public PokerGameEvent { - protected: - void onStart(IVisualNovelEvent *previous) override; - - bool_t onUpdate() override { - return false; - } - - void onEnd() override { - std::cout << "Bet lop fin" << std::endl; - } - - public: - PokerBetLoopEvent(VisualNovelManager *manager) : PokerGameEvent(manager) { - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "poker/visualnovel/PokerNewGameEvent.hpp" +#include "poker/visualnovel/PokerNewRoundEvent.hpp" +#include "poker/visualnovel/PokerTakeBlindsEvent.hpp" +#include "poker/visualnovel/PokerDealEvent.hpp" +#include "poker/visualnovel/PokerTurnEvent.hpp" +#include "poker/visualnovel/PokerDetermineBetterEvent.hpp" +#include "poker/visualnovel/PokerAIBetEvent.hpp" +#include "poker/visualnovel/PokerNewBettingRoundEvent.hpp" +#include "poker/visualnovel/PokerWinnerEvent.hpp" + +#define POKER_DEAL_EVENT_CARD_COUNT 2 + +namespace Dawn { + class PokerBetLoopEvent : public PokerGameEvent { + protected: + void onStart(IVisualNovelEvent *previous) override; + + bool_t onUpdate() override { + return false; + } + + void onEnd() override { + std::cout << "Bet lop fin" << std::endl; + } + + public: + PokerBetLoopEvent(VisualNovelManager *manager) : PokerGameEvent(manager) { + } + }; } \ No newline at end of file diff --git a/src/dawnpokergame/visualnovel/events/PokerInitialEvent.hpp b/archive/dawnpokergame/visualnovel/events/PokerInitialEvent.hpp similarity index 96% rename from src/dawnpokergame/visualnovel/events/PokerInitialEvent.hpp rename to archive/dawnpokergame/visualnovel/events/PokerInitialEvent.hpp index 01084574..b150ae8c 100644 --- a/src/dawnpokergame/visualnovel/events/PokerInitialEvent.hpp +++ b/archive/dawnpokergame/visualnovel/events/PokerInitialEvent.hpp @@ -1,43 +1,43 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "poker/visualnovel/PokerNewRoundEvent.hpp" -#include "poker/visualnovel/PokerDealEvent.hpp" -#include "poker/visualnovel/PokerTakeBlindsEvent.hpp" -#include "PokerBetLoopEvent.hpp" -#include "visualnovel/events/VisualNovelTextboxEvent.hpp" - -#define POKER_DEAL_EVENT_CARD_COUNT 2 - -namespace Dawn { - class PokerInitialEvent : public PokerGameEvent { - protected: - void onStart(IVisualNovelEvent *previous) override { - PokerGameEvent::onStart(previous); - - this - ->then(new PokerNewRoundEvent(this->manager)) - // ->then(new VisualNovelTextboxEvent(this->manager, "Round Started")) - ->then(new PokerTakeBlindsEvent(this->manager)) - // ->then(new VisualNovelTextboxEvent(this->manager, "Blinds Taken")) - ->then(new PokerDealEvent(this->manager)) - // ->then(new VisualNovelTextboxEvent(this->manager, "Cards Dealt")) - ->then(new PokerBetLoopEvent(this->manager)) - ; - } - - bool_t onUpdate() override { - return false; - } - - void onEnd() override { - } - - public: - PokerInitialEvent(VisualNovelManager *manager) : PokerGameEvent(manager) { - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "poker/visualnovel/PokerNewRoundEvent.hpp" +#include "poker/visualnovel/PokerDealEvent.hpp" +#include "poker/visualnovel/PokerTakeBlindsEvent.hpp" +#include "PokerBetLoopEvent.hpp" +#include "visualnovel/events/VisualNovelTextboxEvent.hpp" + +#define POKER_DEAL_EVENT_CARD_COUNT 2 + +namespace Dawn { + class PokerInitialEvent : public PokerGameEvent { + protected: + void onStart(IVisualNovelEvent *previous) override { + PokerGameEvent::onStart(previous); + + this + ->then(new PokerNewRoundEvent(this->manager)) + // ->then(new VisualNovelTextboxEvent(this->manager, "Round Started")) + ->then(new PokerTakeBlindsEvent(this->manager)) + // ->then(new VisualNovelTextboxEvent(this->manager, "Blinds Taken")) + ->then(new PokerDealEvent(this->manager)) + // ->then(new VisualNovelTextboxEvent(this->manager, "Cards Dealt")) + ->then(new PokerBetLoopEvent(this->manager)) + ; + } + + bool_t onUpdate() override { + return false; + } + + void onEnd() override { + } + + public: + PokerInitialEvent(VisualNovelManager *manager) : PokerGameEvent(manager) { + } + }; } \ No newline at end of file diff --git a/src/dawntictactoe/CMakeLists.txt b/archive/dawntictactoe/CMakeLists.txt similarity index 100% rename from src/dawntictactoe/CMakeLists.txt rename to archive/dawntictactoe/CMakeLists.txt diff --git a/src/dawntictactoe/components/CMakeLists.txt b/archive/dawntictactoe/components/CMakeLists.txt similarity index 100% rename from src/dawntictactoe/components/CMakeLists.txt rename to archive/dawntictactoe/components/CMakeLists.txt diff --git a/src/dawntictactoe/components/TicTacToeGame.cpp b/archive/dawntictactoe/components/TicTacToeGame.cpp similarity index 100% rename from src/dawntictactoe/components/TicTacToeGame.cpp rename to archive/dawntictactoe/components/TicTacToeGame.cpp diff --git a/src/dawntictactoe/components/TicTacToeGame.hpp b/archive/dawntictactoe/components/TicTacToeGame.hpp similarity index 100% rename from src/dawntictactoe/components/TicTacToeGame.hpp rename to archive/dawntictactoe/components/TicTacToeGame.hpp diff --git a/src/dawntictactoe/components/TicTacToeScoreboard.cpp b/archive/dawntictactoe/components/TicTacToeScoreboard.cpp similarity index 100% rename from src/dawntictactoe/components/TicTacToeScoreboard.cpp rename to archive/dawntictactoe/components/TicTacToeScoreboard.cpp diff --git a/src/dawntictactoe/components/TicTacToeScoreboard.hpp b/archive/dawntictactoe/components/TicTacToeScoreboard.hpp similarity index 100% rename from src/dawntictactoe/components/TicTacToeScoreboard.hpp rename to archive/dawntictactoe/components/TicTacToeScoreboard.hpp diff --git a/src/dawntictactoe/components/TicTacToeTile.cpp b/archive/dawntictactoe/components/TicTacToeTile.cpp similarity index 95% rename from src/dawntictactoe/components/TicTacToeTile.cpp rename to archive/dawntictactoe/components/TicTacToeTile.cpp index d9e0aec7..749e5ce2 100644 --- a/src/dawntictactoe/components/TicTacToeTile.cpp +++ b/archive/dawntictactoe/components/TicTacToeTile.cpp @@ -1,31 +1,31 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "TicTacToeTile.hpp" -#include "scene/SceneItem.hpp" -#include "game/DawnGame.hpp" - -using namespace Dawn; - -TicTacToeTile::TicTacToeTile(SceneItem *item) : - SceneItemComponent(item), - tileState(TIC_TAC_TOE_EMPTY), - hovered(false) -{ -} - -void TicTacToeTile::onStart() { - auto cb = [&]{ - auto sprite = this->item->getComponent(); - if(this->hovered && tileState == TIC_TAC_TOE_EMPTY) { - sprite->setTile(0x03); - } else { - sprite->setTile(tileState); - } - }; - - useEffect(cb, tileState); - useEffect(cb, hovered)(); -} +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "TicTacToeTile.hpp" +#include "scene/SceneItem.hpp" +#include "game/DawnGame.hpp" + +using namespace Dawn; + +TicTacToeTile::TicTacToeTile(SceneItem *item) : + SceneItemComponent(item), + tileState(TIC_TAC_TOE_EMPTY), + hovered(false) +{ +} + +void TicTacToeTile::onStart() { + auto cb = [&]{ + auto sprite = this->item->getComponent(); + if(this->hovered && tileState == TIC_TAC_TOE_EMPTY) { + sprite->setTile(0x03); + } else { + sprite->setTile(tileState); + } + }; + + useEffect(cb, tileState); + useEffect(cb, hovered)(); +} diff --git a/src/dawntictactoe/components/TicTacToeTile.hpp b/archive/dawntictactoe/components/TicTacToeTile.hpp similarity index 96% rename from src/dawntictactoe/components/TicTacToeTile.hpp rename to archive/dawntictactoe/components/TicTacToeTile.hpp index cbdae5d0..3711718d 100644 --- a/src/dawntictactoe/components/TicTacToeTile.hpp +++ b/archive/dawntictactoe/components/TicTacToeTile.hpp @@ -1,21 +1,21 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/SceneItemComponent.hpp" -#include "scene/components/display/TiledSprite.hpp" -#include "games/tictactoe/TicTacToeLogic.hpp" - -namespace Dawn { - class TicTacToeTile : public SceneItemComponent { - public: - StateProperty tileState; - StateProperty hovered; - uint8_t tile; - - TicTacToeTile(SceneItem *item); - void onStart() override; - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "scene/SceneItemComponent.hpp" +#include "scene/components/display/TiledSprite.hpp" +#include "games/tictactoe/TicTacToeLogic.hpp" + +namespace Dawn { + class TicTacToeTile : public SceneItemComponent { + public: + StateProperty tileState; + StateProperty hovered; + uint8_t tile; + + TicTacToeTile(SceneItem *item); + void onStart() override; + }; } \ No newline at end of file diff --git a/src/dawntictactoe/game/CMakeLists.txt b/archive/dawntictactoe/game/CMakeLists.txt similarity index 100% rename from src/dawntictactoe/game/CMakeLists.txt rename to archive/dawntictactoe/game/CMakeLists.txt diff --git a/src/dawntictactoe/game/DawnGame.cpp b/archive/dawntictactoe/game/DawnGame.cpp similarity index 100% rename from src/dawntictactoe/game/DawnGame.cpp rename to archive/dawntictactoe/game/DawnGame.cpp diff --git a/src/dawntictactoe/game/DawnGame.hpp b/archive/dawntictactoe/game/DawnGame.hpp similarity index 96% rename from src/dawntictactoe/game/DawnGame.hpp rename to archive/dawntictactoe/game/DawnGame.hpp index 991f6d3e..3e9cccfc 100644 --- a/src/dawntictactoe/game/DawnGame.hpp +++ b/archive/dawntictactoe/game/DawnGame.hpp @@ -1,29 +1,29 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "game/_DawnGame.hpp" -#include "save/DawnGameSaveManager.hpp" - -namespace Dawn { - class DawnGame : public IDawnGame { - private: - Scene *sceneToCutTo = nullptr; - - public: - DawnHost *host; - RenderManager renderManager; - AssetManager assetManager; - InputManager inputManager; - TimeManager timeManager; - LocaleManager localeManager; - DawnGameSaveManager saveManager; - - DawnGame(DawnHost *host); - int32_t init() override; - int32_t update(float_t delta) override; - void sceneCutover(Scene *scene) override; - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "game/_DawnGame.hpp" +#include "save/DawnGameSaveManager.hpp" + +namespace Dawn { + class DawnGame : public IDawnGame { + private: + Scene *sceneToCutTo = nullptr; + + public: + DawnHost *host; + RenderManager renderManager; + AssetManager assetManager; + InputManager inputManager; + TimeManager timeManager; + LocaleManager localeManager; + DawnGameSaveManager saveManager; + + DawnGame(DawnHost *host); + int32_t init() override; + int32_t update(float_t delta) override; + void sceneCutover(Scene *scene) override; + }; } \ No newline at end of file diff --git a/src/dawntictactoe/input/InputBinds.hpp b/archive/dawntictactoe/input/InputBinds.hpp similarity index 100% rename from src/dawntictactoe/input/InputBinds.hpp rename to archive/dawntictactoe/input/InputBinds.hpp diff --git a/src/dawntictactoe/prefabs/SimpleLabel.hpp b/archive/dawntictactoe/prefabs/SimpleLabel.hpp similarity index 100% rename from src/dawntictactoe/prefabs/SimpleLabel.hpp rename to archive/dawntictactoe/prefabs/SimpleLabel.hpp diff --git a/src/dawntictactoe/prefabs/TicTacToeTilePrefab.hpp b/archive/dawntictactoe/prefabs/TicTacToeTilePrefab.hpp similarity index 97% rename from src/dawntictactoe/prefabs/TicTacToeTilePrefab.hpp rename to archive/dawntictactoe/prefabs/TicTacToeTilePrefab.hpp index 9f7cbfd3..611f79fb 100644 --- a/src/dawntictactoe/prefabs/TicTacToeTilePrefab.hpp +++ b/archive/dawntictactoe/prefabs/TicTacToeTilePrefab.hpp @@ -1,62 +1,62 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "prefab/SceneItemPrefab.hpp" -#include "scene/components/display/TiledSprite.hpp" -#include "scene/components/display/MeshHost.hpp" -#include "scene/components/display/MeshRenderer.hpp" -#include "scene/components/display/material/SimpleTexturedMaterial.hpp" -#include "scene/components/physics/3d/CubeCollider.hpp" -#include "components/TicTacToeTile.hpp" - -namespace Dawn { - class TicTacToeTilePrefab : public SceneItemPrefab { - public: - static std::vector prefabAssets(AssetManager *ass) { - return std::vector{ - ass->get("texture_xo"), - ass->get("tileset_xo") - }; - } - - // - MeshHost *meshHost; - TiledSprite *sprite; - MeshRenderer *meshRenderer; - SimpleTexturedMaterial *material; - TicTacToeTile *ticTacToe; - CubeCollider *collider; - - TicTacToeTilePrefab(Scene *s, sceneitemid_t i) : - SceneItemPrefab(s,i) - { - } - - - void prefabInit(AssetManager *man) override { - auto tileset = man->get("tileset_xo"); - auto texture = man->get("texture_xo"); - - meshHost = this->addComponent(); - - meshRenderer = this->addComponent(); - - material = this->template addComponent(); - material->texture = &texture->texture; - - sprite = this->addComponent(); - sprite->setTileset(&tileset->tileset); - sprite->setSize(glm::vec2(1, 1)); - sprite->setTile(0x01); - - collider = this->addComponent(); - collider->min = glm::vec3(-0.5f, -0.5f, -0.1f); - collider->max = glm::vec3( 0.5f, 0.5f, 0.1f); - - ticTacToe = this->addComponent(); - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "prefab/SceneItemPrefab.hpp" +#include "scene/components/display/TiledSprite.hpp" +#include "scene/components/display/MeshHost.hpp" +#include "scene/components/display/MeshRenderer.hpp" +#include "scene/components/display/material/SimpleTexturedMaterial.hpp" +#include "scene/components/physics/3d/CubeCollider.hpp" +#include "components/TicTacToeTile.hpp" + +namespace Dawn { + class TicTacToeTilePrefab : public SceneItemPrefab { + public: + static std::vector prefabAssets(AssetManager *ass) { + return std::vector{ + ass->get("texture_xo"), + ass->get("tileset_xo") + }; + } + + // + MeshHost *meshHost; + TiledSprite *sprite; + MeshRenderer *meshRenderer; + SimpleTexturedMaterial *material; + TicTacToeTile *ticTacToe; + CubeCollider *collider; + + TicTacToeTilePrefab(Scene *s, sceneitemid_t i) : + SceneItemPrefab(s,i) + { + } + + + void prefabInit(AssetManager *man) override { + auto tileset = man->get("tileset_xo"); + auto texture = man->get("texture_xo"); + + meshHost = this->addComponent(); + + meshRenderer = this->addComponent(); + + material = this->template addComponent(); + material->texture = &texture->texture; + + sprite = this->addComponent(); + sprite->setTileset(&tileset->tileset); + sprite->setSize(glm::vec2(1, 1)); + sprite->setTile(0x01); + + collider = this->addComponent(); + collider->min = glm::vec3(-0.5f, -0.5f, -0.1f); + collider->max = glm::vec3( 0.5f, 0.5f, 0.1f); + + ticTacToe = this->addComponent(); + } + }; } \ No newline at end of file diff --git a/src/dawntictactoe/save/CMakeLists.txt b/archive/dawntictactoe/save/CMakeLists.txt similarity index 100% rename from src/dawntictactoe/save/CMakeLists.txt rename to archive/dawntictactoe/save/CMakeLists.txt diff --git a/src/dawntictactoe/save/DawnGameSaveManager.cpp b/archive/dawntictactoe/save/DawnGameSaveManager.cpp similarity index 100% rename from src/dawntictactoe/save/DawnGameSaveManager.cpp rename to archive/dawntictactoe/save/DawnGameSaveManager.cpp diff --git a/src/dawntictactoe/save/DawnGameSaveManager.hpp b/archive/dawntictactoe/save/DawnGameSaveManager.hpp similarity index 100% rename from src/dawntictactoe/save/DawnGameSaveManager.hpp rename to archive/dawntictactoe/save/DawnGameSaveManager.hpp diff --git a/src/dawntictactoe/scenes/TicTacToeScene.hpp b/archive/dawntictactoe/scenes/TicTacToeScene.hpp similarity index 100% rename from src/dawntictactoe/scenes/TicTacToeScene.hpp rename to archive/dawntictactoe/scenes/TicTacToeScene.hpp diff --git a/src/dawntools/tools/sceneitemcomponentregister/CMakeLists.txt b/archive/sceneitemcomponentregister/CMakeLists.txt similarity index 95% rename from src/dawntools/tools/sceneitemcomponentregister/CMakeLists.txt rename to archive/sceneitemcomponentregister/CMakeLists.txt index a83cf061..6635334d 100644 --- a/src/dawntools/tools/sceneitemcomponentregister/CMakeLists.txt +++ b/archive/sceneitemcomponentregister/CMakeLists.txt @@ -1,36 +1,36 @@ -# Copyright (c) 2023 Dominic Msters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -project(sceneitemcomponentgen VERSION 1.0) -add_executable(sceneitemcomponentgen) - -# Sources -target_sources(sceneitemcomponentgen - PRIVATE - ${DAWN_SHARED_SOURCES} - ${DAWN_TOOL_SOURCES} - SceneItemComponentRegister.cpp -) - -# Includes -target_include_directories(sceneitemcomponentgen - PUBLIC - ${DAWN_SHARED_INCLUDES} - ${DAWN_TOOL_INCLUDES} - ${CMAKE_CURRENT_LIST_DIR} -) - -# Definitions -target_compile_definitions(sceneitemcomponentgen - PUBLIC - DAWN_TOOL_INSTANCE=SceneItemComponentRegister - DAWN_TOOL_HEADER="SceneItemComponentRegister.hpp" -) - -# Libraries -target_link_libraries(sceneitemcomponentgen - PUBLIC - ${DAWN_BUILD_HOST_LIBS} +# Copyright (c) 2023 Dominic Msters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +project(sceneitemcomponentgen VERSION 1.0) +add_executable(sceneitemcomponentgen) + +# Sources +target_sources(sceneitemcomponentgen + PRIVATE + ${DAWN_SHARED_SOURCES} + ${DAWN_TOOL_SOURCES} + SceneItemComponentRegister.cpp +) + +# Includes +target_include_directories(sceneitemcomponentgen + PUBLIC + ${DAWN_SHARED_INCLUDES} + ${DAWN_TOOL_INCLUDES} + ${CMAKE_CURRENT_LIST_DIR} +) + +# Definitions +target_compile_definitions(sceneitemcomponentgen + PUBLIC + DAWN_TOOL_INSTANCE=SceneItemComponentRegister + DAWN_TOOL_HEADER="SceneItemComponentRegister.hpp" +) + +# Libraries +target_link_libraries(sceneitemcomponentgen + PUBLIC + ${DAWN_BUILD_HOST_LIBS} ) \ No newline at end of file diff --git a/src/dawntools/tools/sceneitemcomponentregister/SceneItemComponentRegister.cpp b/archive/sceneitemcomponentregister/SceneItemComponentRegister.cpp similarity index 95% rename from src/dawntools/tools/sceneitemcomponentregister/SceneItemComponentRegister.cpp rename to archive/sceneitemcomponentregister/SceneItemComponentRegister.cpp index 13421a8e..090ab3a1 100644 --- a/src/dawntools/tools/sceneitemcomponentregister/SceneItemComponentRegister.cpp +++ b/archive/sceneitemcomponentregister/SceneItemComponentRegister.cpp @@ -1,119 +1,119 @@ -/** - * Copyright (c) 2023 Dominic Masters - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ - -#include "SceneItemComponentRegister.hpp" - -using namespace Dawn; - -void SceneItemComponentRootGen::generate( - std::vector *out, - std::vector *info, - std::string tabs = "" -) { - line(out, "#include \"scene/SceneItemComponentList.hpp\"", tabs); - line(out, "", tabs); - - auto it = info->begin(); - while(it != info->end()) { - auto c = *it; - line(out, "#include \"" + c.header + "\"", tabs); - ++it; - } - line(out, "", tabs); - line(out, "using namespace Dawn;", tabs); - line(out, "", tabs); - - line(out, "SceneItemComponentList::SceneItemComponentList() {", tabs); - it = info->begin(); - while(it != info->end()) { - auto c = *it; - line(out, "this->append<" + c.clazz + ">();", tabs + " "); - ++it; - } - line(out, "}", tabs); -} - -std::vector SceneItemComponentRegister::getRequiredFlags() { - return std::vector{ "input", "output" }; -} - -int32_t SceneItemComponentRegister::start() { - File fileIn(flags["input"]); - if(!fileIn.exists()) { - std::cout << "Input scene item component file does not exist." << std::endl; - return 1; - } - - std::string buffer; - if(!fileIn.readString(&buffer)) { - std::cout << "Failed to read input scene item component file" << std::endl; - return 1; - } - - std::vector components; - struct SceneItemComponent sci; - size_t i = 0; - std::string t; - uint8_t state = 0x00; - while(i < buffer.size()) { - char c = buffer[i++]; - if(c != ';') { - t.push_back(c); - continue; - } - - switch(state) { - case 0x00: - sci.clazz = t; - t.clear(); - state = 0x01; - break; - - case 0x01: - sci.header = t; - t.clear(); - state = 0x00; - components.push_back(sci); - break; - - default: - assertUnreachable(); - } - } - - if(state == 0x01) { - sci.header = t; - components.push_back(sci); - } else { - assertUnreachable(); - } - - - std::vector lines; - SceneItemComponentRootGen::generate(&lines, &components, ""); - - // Generate buffer - std::string bufferOut; - auto itLine = lines.begin(); - while(itLine != lines.end()) { - bufferOut += *itLine + "\n"; - ++itLine; - } - - File fileOut(flags["output"]); - if(!fileOut.mkdirp()) { - std::cout << "Failed to create Scene Item Component List Dir" << std::endl; - return 1; - } - - if(!fileOut.writeString(bufferOut)) { - std::cout << "Failed to write SceneItemComponentList file" << std::endl; - return 1; - } - - return 0; +/** + * Copyright (c) 2023 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "SceneItemComponentRegister.hpp" + +using namespace Dawn; + +void SceneItemComponentRootGen::generate( + std::vector *out, + std::vector *info, + std::string tabs = "" +) { + line(out, "#include \"scene/SceneItemComponentList.hpp\"", tabs); + line(out, "", tabs); + + auto it = info->begin(); + while(it != info->end()) { + auto c = *it; + line(out, "#include \"" + c.header + "\"", tabs); + ++it; + } + line(out, "", tabs); + line(out, "using namespace Dawn;", tabs); + line(out, "", tabs); + + line(out, "SceneItemComponentList::SceneItemComponentList() {", tabs); + it = info->begin(); + while(it != info->end()) { + auto c = *it; + line(out, "this->append<" + c.clazz + ">();", tabs + " "); + ++it; + } + line(out, "}", tabs); +} + +std::vector SceneItemComponentRegister::getRequiredFlags() { + return std::vector{ "input", "output" }; +} + +int32_t SceneItemComponentRegister::start() { + File fileIn(flags["input"]); + if(!fileIn.exists()) { + std::cout << "Input scene item component file does not exist." << std::endl; + return 1; + } + + std::string buffer; + if(!fileIn.readString(&buffer)) { + std::cout << "Failed to read input scene item component file" << std::endl; + return 1; + } + + std::vector components; + struct SceneItemComponent sci; + size_t i = 0; + std::string t; + uint8_t state = 0x00; + while(i < buffer.size()) { + char c = buffer[i++]; + if(c != ';') { + t.push_back(c); + continue; + } + + switch(state) { + case 0x00: + sci.clazz = t; + t.clear(); + state = 0x01; + break; + + case 0x01: + sci.header = t; + t.clear(); + state = 0x00; + components.push_back(sci); + break; + + default: + assertUnreachable(); + } + } + + if(state == 0x01) { + sci.header = t; + components.push_back(sci); + } else { + assertUnreachable(); + } + + + std::vector lines; + SceneItemComponentRootGen::generate(&lines, &components, ""); + + // Generate buffer + std::string bufferOut; + auto itLine = lines.begin(); + while(itLine != lines.end()) { + bufferOut += *itLine + "\n"; + ++itLine; + } + + File fileOut(flags["output"]); + if(!fileOut.mkdirp()) { + std::cout << "Failed to create Scene Item Component List Dir" << std::endl; + return 1; + } + + if(!fileOut.writeString(bufferOut)) { + std::cout << "Failed to write SceneItemComponentList file" << std::endl; + return 1; + } + + return 0; } \ No newline at end of file diff --git a/src/dawntools/tools/sceneitemcomponentregister/SceneItemComponentRegister.hpp b/archive/sceneitemcomponentregister/SceneItemComponentRegister.hpp similarity index 95% rename from src/dawntools/tools/sceneitemcomponentregister/SceneItemComponentRegister.hpp rename to archive/sceneitemcomponentregister/SceneItemComponentRegister.hpp index 99084083..3f177aae 100644 --- a/src/dawntools/tools/sceneitemcomponentregister/SceneItemComponentRegister.hpp +++ b/archive/sceneitemcomponentregister/SceneItemComponentRegister.hpp @@ -1,33 +1,33 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "util/DawnTool.hpp" -#include "util/File.hpp" -#include "util/CodeGen.hpp" - -namespace Dawn { - struct SceneItemComponent { - std::string clazz; - std::string header; - }; - - class SceneItemComponentRootGen : public CodeGen { - public: - static void generate( - std::vector *out, - std::vector *info, - std::string tabs - ); - }; - - class SceneItemComponentRegister : public DawnTool { - protected: - std::vector getRequiredFlags() override; - - public: - int32_t start() override; - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "util/DawnTool.hpp" +#include "util/File.hpp" +#include "util/CodeGen.hpp" + +namespace Dawn { + struct SceneItemComponent { + std::string clazz; + std::string header; + }; + + class SceneItemComponentRootGen : public CodeGen { + public: + static void generate( + std::vector *out, + std::vector *info, + std::string tabs + ); + }; + + class SceneItemComponentRegister : public DawnTool { + protected: + std::vector getRequiredFlags() override; + + public: + int32_t start() override; + }; } \ No newline at end of file diff --git a/cmake/targets/target-platformergame-win32-glfw/CMakeLists.txt b/archive/target-platformergame-win32-glfw/CMakeLists.txt similarity index 100% rename from cmake/targets/target-platformergame-win32-glfw/CMakeLists.txt rename to archive/target-platformergame-win32-glfw/CMakeLists.txt diff --git a/cmake/targets/target-pokergame-linux64-glfw/CMakeLists.txt b/archive/target-pokergame-linux64-glfw/CMakeLists.txt similarity index 100% rename from cmake/targets/target-pokergame-linux64-glfw/CMakeLists.txt rename to archive/target-pokergame-linux64-glfw/CMakeLists.txt diff --git a/cmake/targets/target-pokergame-win32-glfw/CMakeLists.txt b/archive/target-pokergame-win32-glfw/CMakeLists.txt similarity index 100% rename from cmake/targets/target-pokergame-win32-glfw/CMakeLists.txt rename to archive/target-pokergame-win32-glfw/CMakeLists.txt diff --git a/cmake/targets/target-pokergame-win32-sdl2/CMakeLists.txt b/archive/target-pokergame-win32-sdl2/CMakeLists.txt similarity index 100% rename from cmake/targets/target-pokergame-win32-sdl2/CMakeLists.txt rename to archive/target-pokergame-win32-sdl2/CMakeLists.txt diff --git a/cmake/targets/target-tictactoe-linux64-glfw/CMakeLists.txt b/archive/target-tictactoe-linux64-glfw/CMakeLists.txt similarity index 100% rename from cmake/targets/target-tictactoe-linux64-glfw/CMakeLists.txt rename to archive/target-tictactoe-linux64-glfw/CMakeLists.txt diff --git a/src/dawntools/tools/uigen/CMakeLists.txt b/archive/uigen/CMakeLists.txt similarity index 100% rename from src/dawntools/tools/uigen/CMakeLists.txt rename to archive/uigen/CMakeLists.txt diff --git a/src/dawntools/tools/uigen/UIGen.cpp b/archive/uigen/UIGen.cpp similarity index 100% rename from src/dawntools/tools/uigen/UIGen.cpp rename to archive/uigen/UIGen.cpp diff --git a/src/dawntools/tools/uigen/UIGen.hpp b/archive/uigen/UIGen.hpp similarity index 100% rename from src/dawntools/tools/uigen/UIGen.hpp rename to archive/uigen/UIGen.hpp diff --git a/src/dawntools/tools/uigen/parse/elements/children.hpp b/archive/uigen/parse/elements/children.hpp similarity index 100% rename from src/dawntools/tools/uigen/parse/elements/children.hpp rename to archive/uigen/parse/elements/children.hpp diff --git a/src/dawntools/tools/uigen/parse/elements/common.hpp b/archive/uigen/parse/elements/common.hpp similarity index 100% rename from src/dawntools/tools/uigen/parse/elements/common.hpp rename to archive/uigen/parse/elements/common.hpp diff --git a/src/dawntools/tools/uigen/parse/elements/label.hpp b/archive/uigen/parse/elements/label.hpp similarity index 100% rename from src/dawntools/tools/uigen/parse/elements/label.hpp rename to archive/uigen/parse/elements/label.hpp diff --git a/src/dawntools/tools/uigen/parse/root.hpp b/archive/uigen/parse/root.hpp similarity index 100% rename from src/dawntools/tools/uigen/parse/root.hpp rename to archive/uigen/parse/root.hpp diff --git a/src/dawntools/tools/vnscenegen/CMakeLists.txt b/archive/vnscenegen/CMakeLists.txt similarity index 100% rename from src/dawntools/tools/vnscenegen/CMakeLists.txt rename to archive/vnscenegen/CMakeLists.txt diff --git a/src/dawntools/tools/vnscenegen/VnSceneGen.cpp b/archive/vnscenegen/VnSceneGen.cpp similarity index 100% rename from src/dawntools/tools/vnscenegen/VnSceneGen.cpp rename to archive/vnscenegen/VnSceneGen.cpp diff --git a/src/dawntools/tools/vnscenegen/VnSceneGen.hpp b/archive/vnscenegen/VnSceneGen.hpp similarity index 95% rename from src/dawntools/tools/vnscenegen/VnSceneGen.hpp rename to archive/vnscenegen/VnSceneGen.hpp index 15a23ea2..5a46ffa8 100644 --- a/src/dawntools/tools/vnscenegen/VnSceneGen.hpp +++ b/archive/vnscenegen/VnSceneGen.hpp @@ -1,20 +1,20 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "util/DawnTool.hpp" -#include "util/File.hpp" -#include "parse/root.hpp" -#include "util/Language.cpp" - -namespace Dawn { - class VnSceneGen : public DawnTool { - protected: - std::vector getRequiredFlags() override; - - public: - int32_t start(); - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "util/DawnTool.hpp" +#include "util/File.hpp" +#include "parse/root.hpp" +#include "util/Language.cpp" + +namespace Dawn { + class VnSceneGen : public DawnTool { + protected: + std::vector getRequiredFlags() override; + + public: + int32_t start(); + }; } \ No newline at end of file diff --git a/src/dawntools/tools/vnscenegen/parse/asset.hpp b/archive/vnscenegen/parse/asset.hpp similarity index 95% rename from src/dawntools/tools/vnscenegen/parse/asset.hpp rename to archive/vnscenegen/parse/asset.hpp index 4951f0b1..65b910d8 100644 --- a/src/dawntools/tools/vnscenegen/parse/asset.hpp +++ b/archive/vnscenegen/parse/asset.hpp @@ -1,56 +1,56 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "util/XmlParser.hpp" -#include "util/CodeGen.hpp" - -namespace Dawn { - struct AssetInformation { - std::string type; - std::string name; - }; - - class AssetParser : public XmlParser { - protected: - std::vector getRequiredAttributes() { - return std::vector{ - "name", - "type" - }; - } - - std::map getOptionalAttributes() { - return std::map(); - } - - int32_t onParse( - Xml *node, - std::map values, - struct AssetInformation *out, - std::string *error - ) { - out->name = values["name"]; - out->type = values["type"]; - return 0; - } - - std::string convert(struct AssetInformation info) { - std::string out; - return out; - } - }; - - class AssetGen : public CodeGen { - public: - static void generate( - std::vector *out, - struct AssetInformation *info, - std::string tabs - ) { - return line(out, "// Asset will be generated here", tabs); - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "util/XmlParser.hpp" +#include "util/CodeGen.hpp" + +namespace Dawn { + struct AssetInformation { + std::string type; + std::string name; + }; + + class AssetParser : public XmlParser { + protected: + std::vector getRequiredAttributes() { + return std::vector{ + "name", + "type" + }; + } + + std::map getOptionalAttributes() { + return std::map(); + } + + int32_t onParse( + Xml *node, + std::map values, + struct AssetInformation *out, + std::string *error + ) { + out->name = values["name"]; + out->type = values["type"]; + return 0; + } + + std::string convert(struct AssetInformation info) { + std::string out; + return out; + } + }; + + class AssetGen : public CodeGen { + public: + static void generate( + std::vector *out, + struct AssetInformation *info, + std::string tabs + ) { + return line(out, "// Asset will be generated here", tabs); + } + }; } \ No newline at end of file diff --git a/src/dawntools/tools/vnscenegen/parse/character.hpp b/archive/vnscenegen/parse/character.hpp similarity index 96% rename from src/dawntools/tools/vnscenegen/parse/character.hpp rename to archive/vnscenegen/parse/character.hpp index ea2d81c6..7c474778 100644 --- a/src/dawntools/tools/vnscenegen/parse/character.hpp +++ b/archive/vnscenegen/parse/character.hpp @@ -1,77 +1,77 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "util/XmlParser.hpp" -#include "util/CodeGen.hpp" - -namespace Dawn { - struct CharacterInformation { - std::string clazz; - std::string name; - }; - - class CharacterParser : public XmlParser { - protected: - std::vector getRequiredAttributes() { - return std::vector{ - "class", - "name" - }; - } - - std::map getOptionalAttributes() { - return std::map(); - } - - int32_t onParse( - Xml *node, - std::map values, - struct CharacterInformation *out, - std::string *error - ) { - out->clazz = values["class"]; - out->name = values["name"]; - - if(out->clazz.size() == 0) { - *error = "Character class cannot be empty."; - return 1; - } - if(out->name.size() == 0) { - *error = "Character name cannot be empty."; - return 1; - } - - return 0; - } - }; - - class CharacterGen : public CodeGen { - public: - static void generateProperty( - std::vector *out, - struct CharacterInformation info, - std::string tabs - ) { - line(out, info.clazz + " *" + info.name + ";", tabs); - } - - static void generateInitializer( - std::vector *out, - struct CharacterInformation info, - std::string tabs - ) { - line(out, "this->" + info.name + " = " + info.clazz + "::create(this);", tabs); - } - - static void generateAssets( - std::vector *out, - struct CharacterInformation info, - std::string tabs - ) { - line(out, "vectorAppend(&assets, " + info.clazz + "::getRequiredAssets(man));", ""); - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "util/XmlParser.hpp" +#include "util/CodeGen.hpp" + +namespace Dawn { + struct CharacterInformation { + std::string clazz; + std::string name; + }; + + class CharacterParser : public XmlParser { + protected: + std::vector getRequiredAttributes() { + return std::vector{ + "class", + "name" + }; + } + + std::map getOptionalAttributes() { + return std::map(); + } + + int32_t onParse( + Xml *node, + std::map values, + struct CharacterInformation *out, + std::string *error + ) { + out->clazz = values["class"]; + out->name = values["name"]; + + if(out->clazz.size() == 0) { + *error = "Character class cannot be empty."; + return 1; + } + if(out->name.size() == 0) { + *error = "Character name cannot be empty."; + return 1; + } + + return 0; + } + }; + + class CharacterGen : public CodeGen { + public: + static void generateProperty( + std::vector *out, + struct CharacterInformation info, + std::string tabs + ) { + line(out, info.clazz + " *" + info.name + ";", tabs); + } + + static void generateInitializer( + std::vector *out, + struct CharacterInformation info, + std::string tabs + ) { + line(out, "this->" + info.name + " = " + info.clazz + "::create(this);", tabs); + } + + static void generateAssets( + std::vector *out, + struct CharacterInformation info, + std::string tabs + ) { + line(out, "vectorAppend(&assets, " + info.clazz + "::getRequiredAssets(man));", ""); + } + }; } \ No newline at end of file diff --git a/src/dawntools/tools/vnscenegen/parse/event/characterfadeevent.hpp b/archive/vnscenegen/parse/event/characterfadeevent.hpp similarity index 96% rename from src/dawntools/tools/vnscenegen/parse/event/characterfadeevent.hpp rename to archive/vnscenegen/parse/event/characterfadeevent.hpp index 48becb8d..7b7d5717 100644 --- a/src/dawntools/tools/vnscenegen/parse/event/characterfadeevent.hpp +++ b/archive/vnscenegen/parse/event/characterfadeevent.hpp @@ -1,77 +1,77 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "util/XmlParser.hpp" -#include "util/CodeGen.hpp" - -namespace Dawn { - struct CharacterFadeEventInfo { - std::string character; - std::string duration; - std::string ease; - std::string fade; - std::string include; - }; - - class CharacterFadeParser : public XmlParser { - protected: - std::vector getRequiredAttributes() { - return std::vector{ - "character" - }; - } - - std::map getOptionalAttributes() { - return std::map{ - { "fade", "in" }, - { "ease", "linear" }, - { "duration", "1" } - }; - } - - int32_t onParse( - Xml *node, - std::map values, - struct CharacterFadeEventInfo *out, - std::string *error - ) { - out->character = values["character"]; - out->duration = parseDuration(values["duration"]); - out->ease = parseEase(values["ease"]); - out->fade = values["fade"] == "in" ? "true" : "false"; - out->include = "visualnovel/events/characters/VisualNovelFadeCharacterEvent.hpp"; - - if(out->ease.size() == 0) { - *error = "Invalid ease"; - return 1; - } - - return 0; - } - }; - - - class CharacterFadeGen : public CodeGen { - public: - static void generate( - std::vector *out, - struct CharacterFadeEventInfo *info, - std::string tabs = "" - ) { - line(out, "new VisualNovelFadeCharacterEvent(vnManager,", tabs + " "); - line(out, "this->" + info->character + "->vnCharacter,", tabs + " "); - line(out, info->fade + ",", tabs + " "); - line(out, info->ease + ",", tabs + " "); - line(out, info->duration, tabs + " "); - line(out, ")", tabs); - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "util/XmlParser.hpp" +#include "util/CodeGen.hpp" + +namespace Dawn { + struct CharacterFadeEventInfo { + std::string character; + std::string duration; + std::string ease; + std::string fade; + std::string include; + }; + + class CharacterFadeParser : public XmlParser { + protected: + std::vector getRequiredAttributes() { + return std::vector{ + "character" + }; + } + + std::map getOptionalAttributes() { + return std::map{ + { "fade", "in" }, + { "ease", "linear" }, + { "duration", "1" } + }; + } + + int32_t onParse( + Xml *node, + std::map values, + struct CharacterFadeEventInfo *out, + std::string *error + ) { + out->character = values["character"]; + out->duration = parseDuration(values["duration"]); + out->ease = parseEase(values["ease"]); + out->fade = values["fade"] == "in" ? "true" : "false"; + out->include = "visualnovel/events/characters/VisualNovelFadeCharacterEvent.hpp"; + + if(out->ease.size() == 0) { + *error = "Invalid ease"; + return 1; + } + + return 0; + } + }; + + + class CharacterFadeGen : public CodeGen { + public: + static void generate( + std::vector *out, + struct CharacterFadeEventInfo *info, + std::string tabs = "" + ) { + line(out, "new VisualNovelFadeCharacterEvent(vnManager,", tabs + " "); + line(out, "this->" + info->character + "->vnCharacter,", tabs + " "); + line(out, info->fade + ",", tabs + " "); + line(out, info->ease + ",", tabs + " "); + line(out, info->duration, tabs + " "); + line(out, ")", tabs); + } + }; } \ No newline at end of file diff --git a/src/dawntools/tools/vnscenegen/parse/event/pauseevent.hpp b/archive/vnscenegen/parse/event/pauseevent.hpp similarity index 96% rename from src/dawntools/tools/vnscenegen/parse/event/pauseevent.hpp rename to archive/vnscenegen/parse/event/pauseevent.hpp index 6eb4b1dc..d68f47aa 100644 --- a/src/dawntools/tools/vnscenegen/parse/event/pauseevent.hpp +++ b/archive/vnscenegen/parse/event/pauseevent.hpp @@ -1,48 +1,48 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "util/XmlParser.hpp" -#include "util/CodeGen.hpp" - -namespace Dawn { - struct PauseEventInfo { - std::string duration; - std::string include; - }; - - class PauseEventParser : public XmlParser { - protected: - std::vector getRequiredAttributes() { - return std::vector{ "duration" }; - } - - std::map getOptionalAttributes() { - return std::map(); - } - - int32_t onParse( - Xml *node, - std::map values, - struct PauseEventInfo *out, - std::string *error - ) { - out->duration = parseDuration(values["duration"]); - out->include = "visualnovel/events/timing/VisualNovelPauseEvent.hpp"; - return 0; - } - }; - - class PauseEventGen : public CodeGen { - public: - static void generate( - std::vector *out, - struct PauseEventInfo *info, - std::string tabs = "" - ) { - line(out, "new VisualNovelPauseEvent(vnManager, " + info->duration + ")", tabs); - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "util/XmlParser.hpp" +#include "util/CodeGen.hpp" + +namespace Dawn { + struct PauseEventInfo { + std::string duration; + std::string include; + }; + + class PauseEventParser : public XmlParser { + protected: + std::vector getRequiredAttributes() { + return std::vector{ "duration" }; + } + + std::map getOptionalAttributes() { + return std::map(); + } + + int32_t onParse( + Xml *node, + std::map values, + struct PauseEventInfo *out, + std::string *error + ) { + out->duration = parseDuration(values["duration"]); + out->include = "visualnovel/events/timing/VisualNovelPauseEvent.hpp"; + return 0; + } + }; + + class PauseEventGen : public CodeGen { + public: + static void generate( + std::vector *out, + struct PauseEventInfo *info, + std::string tabs = "" + ) { + line(out, "new VisualNovelPauseEvent(vnManager, " + info->duration + ")", tabs); + } + }; } \ No newline at end of file diff --git a/src/dawntools/tools/vnscenegen/parse/event/textevent.hpp b/archive/vnscenegen/parse/event/textevent.hpp similarity index 96% rename from src/dawntools/tools/vnscenegen/parse/event/textevent.hpp rename to archive/vnscenegen/parse/event/textevent.hpp index e8247847..a4378870 100644 --- a/src/dawntools/tools/vnscenegen/parse/event/textevent.hpp +++ b/archive/vnscenegen/parse/event/textevent.hpp @@ -1,101 +1,101 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "util/XmlParser.hpp" -#include "util/CodeGen.hpp" -#include "util/Language.hpp" - -namespace Dawn { - struct TextEventInfo { - std::string character; - std::string emotion; - std::vector strings; - std::string key; - }; - - class TextStringParser : public XmlParser { - protected: - std::vector getRequiredAttributes() { - return std::vector{ "lang" }; - } - - std::map getOptionalAttributes() { - return std::map(); - } - - int32_t onParse( - Xml *node, - std::map values, - struct LanguageString *out, - std::string *error - ) { - out->lang = values["lang"]; - out->text = node->value; - return 0; - } - }; - - class TextEventParser : public XmlParser { - protected: - std::vector getRequiredAttributes() { - return std::vector{ - "character", - "emotion" - }; - } - - std::map getOptionalAttributes() { - return std::map(); - } - - int32_t onParse( - Xml *node, - std::map values, - struct TextEventInfo *out, - std::string *error - ) { - int32_t ret = 0; - out->character = values["character"]; - out->emotion = values["emotion"]; - - if(out->key.size() <= 0) { - *error = "Text Event requries a language key to be defined."; - return 1; - } - - auto itChildren = node->children.begin(); - while(itChildren != node->children.end()) { - auto c = *itChildren; - if(c->node == "string") { - struct LanguageString str; - ret = (TextStringParser()).parse(c, &str, error); - str.key = out->key; - out->strings.push_back(str); - } - ++itChildren; - } - return ret; - } - }; - - class TextEventGen : public CodeGen { - public: - static void generate( - std::vector *out, - struct TextEventInfo *info, - std::string tabs = "" - ) { - std::string emo = info->emotion; - emo[0] = toupper(emo[0]); - - line(out, "new VisualNovelTextboxEvent(vnManager,", tabs); - line(out, "this->" + info->character + "->vnCharacter, ", tabs + " "); - line(out, "this->" + info->character + "->emotion" + emo + ", ", tabs + " "); - line(out, "\"" + info->key + "\"", tabs + " "); - line(out, ")", tabs); - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "util/XmlParser.hpp" +#include "util/CodeGen.hpp" +#include "util/Language.hpp" + +namespace Dawn { + struct TextEventInfo { + std::string character; + std::string emotion; + std::vector strings; + std::string key; + }; + + class TextStringParser : public XmlParser { + protected: + std::vector getRequiredAttributes() { + return std::vector{ "lang" }; + } + + std::map getOptionalAttributes() { + return std::map(); + } + + int32_t onParse( + Xml *node, + std::map values, + struct LanguageString *out, + std::string *error + ) { + out->lang = values["lang"]; + out->text = node->value; + return 0; + } + }; + + class TextEventParser : public XmlParser { + protected: + std::vector getRequiredAttributes() { + return std::vector{ + "character", + "emotion" + }; + } + + std::map getOptionalAttributes() { + return std::map(); + } + + int32_t onParse( + Xml *node, + std::map values, + struct TextEventInfo *out, + std::string *error + ) { + int32_t ret = 0; + out->character = values["character"]; + out->emotion = values["emotion"]; + + if(out->key.size() <= 0) { + *error = "Text Event requries a language key to be defined."; + return 1; + } + + auto itChildren = node->children.begin(); + while(itChildren != node->children.end()) { + auto c = *itChildren; + if(c->node == "string") { + struct LanguageString str; + ret = (TextStringParser()).parse(c, &str, error); + str.key = out->key; + out->strings.push_back(str); + } + ++itChildren; + } + return ret; + } + }; + + class TextEventGen : public CodeGen { + public: + static void generate( + std::vector *out, + struct TextEventInfo *info, + std::string tabs = "" + ) { + std::string emo = info->emotion; + emo[0] = toupper(emo[0]); + + line(out, "new VisualNovelTextboxEvent(vnManager,", tabs); + line(out, "this->" + info->character + "->vnCharacter, ", tabs + " "); + line(out, "this->" + info->character + "->emotion" + emo + ", ", tabs + " "); + line(out, "\"" + info->key + "\"", tabs + " "); + line(out, ")", tabs); + } + }; } \ No newline at end of file diff --git a/src/dawntools/tools/vnscenegen/parse/events.hpp b/archive/vnscenegen/parse/events.hpp similarity index 96% rename from src/dawntools/tools/vnscenegen/parse/events.hpp rename to archive/vnscenegen/parse/events.hpp index 76e0afbc..f0438e3c 100644 --- a/src/dawntools/tools/vnscenegen/parse/events.hpp +++ b/archive/vnscenegen/parse/events.hpp @@ -1,121 +1,121 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "util/XmlParser.hpp" -#include "parse/event/textevent.hpp" -#include "parse/event/characterfadeevent.hpp" -#include "parse/event/pauseevent.hpp" - -namespace Dawn { - enum EventType { - EVENT_TYPE_TEXT, - EVENT_TYPE_CHARACTER_FADE, - EVENT_TYPE_PAUSE - }; - - struct EventsInformation { - std::map eventTypes; - std::map textEvents; - std::map characterFadeEvents; - std::map pauseEvents; - std::vector includes; - - std::vector strings; - std::string key; - }; - - class EventsParser : public XmlParser { - protected: - std::vector getRequiredAttributes() { - return std::vector{ - }; - } - - std::map getOptionalAttributes() { - return std::map(); - } - - int32_t onParse( - Xml *node, - std::map values, - struct EventsInformation *out, - std::string *error - ) { - int32_t ret = 0; - int32_t i = 0; - int32_t languageKeyNumber = 1; - - if(out->key.size() <= 0) { - *error = "Events requries a language key to be defined."; - return 1; - } - - auto itChildren = node->children.begin(); - while(itChildren != node->children.end()) { - auto c = *itChildren; - - if(c->node == "text") { - struct TextEventInfo textEvent; - textEvent.key = out->key + "." + std::to_string(languageKeyNumber++); - ret = (TextEventParser()).parse(c, &textEvent, error); - out->eventTypes[i] = EVENT_TYPE_TEXT; - out->textEvents[i++] = textEvent; - vectorAppend(&out->strings, textEvent.strings); - - } else if(c->node == "character-fade") { - struct CharacterFadeEventInfo charFadeEvent; - ret = (CharacterFadeParser()).parse(c, &charFadeEvent, error); - out->eventTypes[i] = EVENT_TYPE_CHARACTER_FADE; - out->characterFadeEvents[i++] = charFadeEvent; - out->includes.push_back(charFadeEvent.include); - - } else if(c->node == "pause") { - struct PauseEventInfo pauseEvent; - ret = (PauseEventParser()).parse(c, &pauseEvent, error); - out->eventTypes[i] = EVENT_TYPE_PAUSE; - out->pauseEvents[i++] = pauseEvent; - out->includes.push_back(pauseEvent.include); - - } - - ++itChildren; - } - - return ret; - } - }; - - class EventsGen : public CodeGen { - public: - static void generate( - std::vector *out, - struct EventsInformation *info, - std::string tabs - ) { - auto itEvents = info->eventTypes.begin(); - while(itEvents != info->eventTypes.end()) { - auto e = *itEvents; - line(out, "->then(", tabs); - switch(e.second) { - case EVENT_TYPE_TEXT: - TextEventGen::generate(out, &info->textEvents[e.first], tabs + " "); - break; - - case EVENT_TYPE_CHARACTER_FADE: - CharacterFadeGen::generate(out, &info->characterFadeEvents[e.first], tabs + " "); - break; - - case EVENT_TYPE_PAUSE: - PauseEventGen::generate(out, &info->pauseEvents[e.first], tabs + " "); - break; - - } - line(out, ")", tabs); - ++itEvents; - } - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "util/XmlParser.hpp" +#include "parse/event/textevent.hpp" +#include "parse/event/characterfadeevent.hpp" +#include "parse/event/pauseevent.hpp" + +namespace Dawn { + enum EventType { + EVENT_TYPE_TEXT, + EVENT_TYPE_CHARACTER_FADE, + EVENT_TYPE_PAUSE + }; + + struct EventsInformation { + std::map eventTypes; + std::map textEvents; + std::map characterFadeEvents; + std::map pauseEvents; + std::vector includes; + + std::vector strings; + std::string key; + }; + + class EventsParser : public XmlParser { + protected: + std::vector getRequiredAttributes() { + return std::vector{ + }; + } + + std::map getOptionalAttributes() { + return std::map(); + } + + int32_t onParse( + Xml *node, + std::map values, + struct EventsInformation *out, + std::string *error + ) { + int32_t ret = 0; + int32_t i = 0; + int32_t languageKeyNumber = 1; + + if(out->key.size() <= 0) { + *error = "Events requries a language key to be defined."; + return 1; + } + + auto itChildren = node->children.begin(); + while(itChildren != node->children.end()) { + auto c = *itChildren; + + if(c->node == "text") { + struct TextEventInfo textEvent; + textEvent.key = out->key + "." + std::to_string(languageKeyNumber++); + ret = (TextEventParser()).parse(c, &textEvent, error); + out->eventTypes[i] = EVENT_TYPE_TEXT; + out->textEvents[i++] = textEvent; + vectorAppend(&out->strings, textEvent.strings); + + } else if(c->node == "character-fade") { + struct CharacterFadeEventInfo charFadeEvent; + ret = (CharacterFadeParser()).parse(c, &charFadeEvent, error); + out->eventTypes[i] = EVENT_TYPE_CHARACTER_FADE; + out->characterFadeEvents[i++] = charFadeEvent; + out->includes.push_back(charFadeEvent.include); + + } else if(c->node == "pause") { + struct PauseEventInfo pauseEvent; + ret = (PauseEventParser()).parse(c, &pauseEvent, error); + out->eventTypes[i] = EVENT_TYPE_PAUSE; + out->pauseEvents[i++] = pauseEvent; + out->includes.push_back(pauseEvent.include); + + } + + ++itChildren; + } + + return ret; + } + }; + + class EventsGen : public CodeGen { + public: + static void generate( + std::vector *out, + struct EventsInformation *info, + std::string tabs + ) { + auto itEvents = info->eventTypes.begin(); + while(itEvents != info->eventTypes.end()) { + auto e = *itEvents; + line(out, "->then(", tabs); + switch(e.second) { + case EVENT_TYPE_TEXT: + TextEventGen::generate(out, &info->textEvents[e.first], tabs + " "); + break; + + case EVENT_TYPE_CHARACTER_FADE: + CharacterFadeGen::generate(out, &info->characterFadeEvents[e.first], tabs + " "); + break; + + case EVENT_TYPE_PAUSE: + PauseEventGen::generate(out, &info->pauseEvents[e.first], tabs + " "); + break; + + } + line(out, ")", tabs); + ++itEvents; + } + } + }; } \ No newline at end of file diff --git a/src/dawntools/tools/vnscenegen/parse/header.hpp b/archive/vnscenegen/parse/header.hpp similarity index 96% rename from src/dawntools/tools/vnscenegen/parse/header.hpp rename to archive/vnscenegen/parse/header.hpp index 097fe744..93345b98 100644 --- a/src/dawntools/tools/vnscenegen/parse/header.hpp +++ b/archive/vnscenegen/parse/header.hpp @@ -1,67 +1,67 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "parse/include.hpp" -#include "parse/character.hpp" -#include "parse/scene.hpp" -#include "parse/asset.hpp" - -namespace Dawn { - struct HeaderInformation { - std::vector includes; - std::vector characters; - std::vector assets; - std::map> languages; - struct SceneInformation scene; - }; - - class HeaderParser : public XmlParser { - protected: - std::vector getRequiredAttributes() { - return std::vector(); - } - - std::map getOptionalAttributes() { - return std::map(); - } - - int32_t onParse( - Xml *node, - std::map values, - struct HeaderInformation *out, - std::string *error - ) { - int32_t ret = 0; - auto itChildren = node->children.begin(); - while(itChildren != node->children.end()) { - auto c = *itChildren; - - if(c->node == "include") { - ret = (IncludeParser()).parse(c, &out->includes, error); - - } else if (c->node == "character") { - struct CharacterInformation character; - ret = (CharacterParser()).parse(c, &character, error); - if(ret != 0) return ret; - out->characters.push_back(character); - - } else if(c->node == "asset") { - struct AssetInformation asset; - ret = (AssetParser()).parse(c, &asset, error); - if(ret != 0) return ret; - out->assets.push_back(asset); - - } else if(c->node == "scene") { - ret = (SceneParser()).parse(c, &out->scene, error); - } - - if(ret != 0) return ret; - ++itChildren; - } - return ret; - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "parse/include.hpp" +#include "parse/character.hpp" +#include "parse/scene.hpp" +#include "parse/asset.hpp" + +namespace Dawn { + struct HeaderInformation { + std::vector includes; + std::vector characters; + std::vector assets; + std::map> languages; + struct SceneInformation scene; + }; + + class HeaderParser : public XmlParser { + protected: + std::vector getRequiredAttributes() { + return std::vector(); + } + + std::map getOptionalAttributes() { + return std::map(); + } + + int32_t onParse( + Xml *node, + std::map values, + struct HeaderInformation *out, + std::string *error + ) { + int32_t ret = 0; + auto itChildren = node->children.begin(); + while(itChildren != node->children.end()) { + auto c = *itChildren; + + if(c->node == "include") { + ret = (IncludeParser()).parse(c, &out->includes, error); + + } else if (c->node == "character") { + struct CharacterInformation character; + ret = (CharacterParser()).parse(c, &character, error); + if(ret != 0) return ret; + out->characters.push_back(character); + + } else if(c->node == "asset") { + struct AssetInformation asset; + ret = (AssetParser()).parse(c, &asset, error); + if(ret != 0) return ret; + out->assets.push_back(asset); + + } else if(c->node == "scene") { + ret = (SceneParser()).parse(c, &out->scene, error); + } + + if(ret != 0) return ret; + ++itChildren; + } + return ret; + } + }; } \ No newline at end of file diff --git a/src/dawntools/tools/vnscenegen/parse/include.hpp b/archive/vnscenegen/parse/include.hpp similarity index 96% rename from src/dawntools/tools/vnscenegen/parse/include.hpp rename to archive/vnscenegen/parse/include.hpp index 3a6960a4..5e5253b2 100644 --- a/src/dawntools/tools/vnscenegen/parse/include.hpp +++ b/archive/vnscenegen/parse/include.hpp @@ -1,59 +1,59 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "util/XmlParser.hpp" -#include "util/CodeGen.hpp" - -namespace Dawn { - typedef std::vector include_t; - - class IncludeParser : public XmlParser { - protected: - std::vector getRequiredAttributes() { - return std::vector{ - "path" - }; - } - - std::map getOptionalAttributes() { - return std::map(); - } - - int32_t onParse( - Xml *node, - std::map values, - include_t *out, - std::string *error - ) { - if(values["path"].size() == 0) { - *error = ""; - return 1; - } - - out->push_back(values["path"]); - return 0; - } - }; - - class IncludeGen : public CodeGen { - public: - static void generate( - std::vector *out, - include_t includes, - std::string tabs - ) { - std::vector generated; - auto it = includes.begin(); - while(it != includes.end()) { - if(std::find(generated.begin(), generated.end(), *it) == generated.end()) { - line(out, "#include \"" + *it + "\"", tabs); - generated.push_back(*it); - } - ++it; - } - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "util/XmlParser.hpp" +#include "util/CodeGen.hpp" + +namespace Dawn { + typedef std::vector include_t; + + class IncludeParser : public XmlParser { + protected: + std::vector getRequiredAttributes() { + return std::vector{ + "path" + }; + } + + std::map getOptionalAttributes() { + return std::map(); + } + + int32_t onParse( + Xml *node, + std::map values, + include_t *out, + std::string *error + ) { + if(values["path"].size() == 0) { + *error = ""; + return 1; + } + + out->push_back(values["path"]); + return 0; + } + }; + + class IncludeGen : public CodeGen { + public: + static void generate( + std::vector *out, + include_t includes, + std::string tabs + ) { + std::vector generated; + auto it = includes.begin(); + while(it != includes.end()) { + if(std::find(generated.begin(), generated.end(), *it) == generated.end()) { + line(out, "#include \"" + *it + "\"", tabs); + generated.push_back(*it); + } + ++it; + } + } + }; } \ No newline at end of file diff --git a/src/dawntools/tools/vnscenegen/parse/root.hpp b/archive/vnscenegen/parse/root.hpp similarity index 97% rename from src/dawntools/tools/vnscenegen/parse/root.hpp rename to archive/vnscenegen/parse/root.hpp index c94e27b4..cd224146 100644 --- a/src/dawntools/tools/vnscenegen/parse/root.hpp +++ b/archive/vnscenegen/parse/root.hpp @@ -1,120 +1,120 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "parse/header.hpp" -#include "parse/events.hpp" - -namespace Dawn { - struct RootInformation { - struct HeaderInformation header; - struct EventsInformation events; - - std::vector strings; - }; - - class RootParser : public XmlParser { - protected: - std::vector getRequiredAttributes() { - return std::vector(); - } - - std::map getOptionalAttributes() { - return std::map(); - } - - int32_t onParse( - Xml *node, - std::map values, - struct RootInformation *out, - std::string *error - ) { - int32_t ret = 0; - auto itChildren = node->children.begin(); - - while(itChildren != node->children.end()) { - auto c = *itChildren; - - if(c->node == "head") { - ret = (HeaderParser()).parse(c, &out->header, error); - } else if(c->node == "events") { - out->events.key = out->header.scene.name; - ret = (EventsParser()).parse(c, &out->events, error); - vectorAppend(&out->strings, out->events.strings); - } - - if(ret != 0) return ret; - ++itChildren; - } - - out->header.includes.push_back("visualnovel/events/VisualNovelEmptyEvent.hpp"); - - return ret; - } - }; - - class RootGen : public CodeGen { - public: - static void generate( - std::vector *out, - struct RootInformation *info, - std::string tabs = "" - ) { - struct ClassGenInfo c; - c.clazz = info->header.scene.name; - c.extend = info->header.scene.type; - c.constructorArgs = "DawnGame *game"; - c.extendArgs = "game"; - - struct MethodGenInfo vnStage; - vnStage.name = "vnStage"; - vnStage.type = "void"; - vnStage.isOverride = true; - line(&vnStage.body, info->header.scene.type+ "::vnStage();", ""); - - struct MethodGenInfo getAssets; - getAssets.name = "getRequiredAssets"; - getAssets.type = "std::vector"; - getAssets.isOverride = true; - line(&getAssets.body, "auto man = &this->game->assetManager;", ""); - line(&getAssets.body, "auto assets = " + info->header.scene.type + "::getRequiredAssets();", ""); - - struct MethodGenInfo getVNEvent; - getVNEvent.name = "getVNEvent"; - getVNEvent.type = "IVisualNovelEvent *"; - getVNEvent.isOverride = true; - line(&getVNEvent.body, "auto start = new VisualNovelEmptyEvent(vnManager);", ""); - - IncludeGen::generate(&c.includes, info->header.includes, ""); - IncludeGen::generate(&c.includes, info->events.includes, ""); - - // Characters - auto itChar = info->header.characters.begin(); - while(itChar != info->header.characters.end()) { - CharacterGen::generateProperty(&c.publicProperties, *itChar, ""); - CharacterGen::generateInitializer(&vnStage.body, *itChar, ""); - CharacterGen::generateAssets(&getAssets.body, *itChar, ""); - ++itChar; - } - - // Events - if(info->events.eventTypes.size() > 0) { - line(&getVNEvent.body, "start", ""); - EventsGen::generate(&getVNEvent.body, &info->events, " "); - line(&getVNEvent.body, ";", ""); - } - - // Wrap up methods - line(&getAssets.body, "return assets;", ""); - line(&getVNEvent.body, "return start;", ""); - - methodGen(&c.publicCode, vnStage); - line(&c.publicCode, "", ""); - methodGen(&c.publicCode, getAssets); - methodGen(&c.publicCode, getVNEvent); - classGen(out, c); - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "parse/header.hpp" +#include "parse/events.hpp" + +namespace Dawn { + struct RootInformation { + struct HeaderInformation header; + struct EventsInformation events; + + std::vector strings; + }; + + class RootParser : public XmlParser { + protected: + std::vector getRequiredAttributes() { + return std::vector(); + } + + std::map getOptionalAttributes() { + return std::map(); + } + + int32_t onParse( + Xml *node, + std::map values, + struct RootInformation *out, + std::string *error + ) { + int32_t ret = 0; + auto itChildren = node->children.begin(); + + while(itChildren != node->children.end()) { + auto c = *itChildren; + + if(c->node == "head") { + ret = (HeaderParser()).parse(c, &out->header, error); + } else if(c->node == "events") { + out->events.key = out->header.scene.name; + ret = (EventsParser()).parse(c, &out->events, error); + vectorAppend(&out->strings, out->events.strings); + } + + if(ret != 0) return ret; + ++itChildren; + } + + out->header.includes.push_back("visualnovel/events/VisualNovelEmptyEvent.hpp"); + + return ret; + } + }; + + class RootGen : public CodeGen { + public: + static void generate( + std::vector *out, + struct RootInformation *info, + std::string tabs = "" + ) { + struct ClassGenInfo c; + c.clazz = info->header.scene.name; + c.extend = info->header.scene.type; + c.constructorArgs = "DawnGame *game"; + c.extendArgs = "game"; + + struct MethodGenInfo vnStage; + vnStage.name = "vnStage"; + vnStage.type = "void"; + vnStage.isOverride = true; + line(&vnStage.body, info->header.scene.type+ "::vnStage();", ""); + + struct MethodGenInfo getAssets; + getAssets.name = "getRequiredAssets"; + getAssets.type = "std::vector"; + getAssets.isOverride = true; + line(&getAssets.body, "auto man = &this->game->assetManager;", ""); + line(&getAssets.body, "auto assets = " + info->header.scene.type + "::getRequiredAssets();", ""); + + struct MethodGenInfo getVNEvent; + getVNEvent.name = "getVNEvent"; + getVNEvent.type = "IVisualNovelEvent *"; + getVNEvent.isOverride = true; + line(&getVNEvent.body, "auto start = new VisualNovelEmptyEvent(vnManager);", ""); + + IncludeGen::generate(&c.includes, info->header.includes, ""); + IncludeGen::generate(&c.includes, info->events.includes, ""); + + // Characters + auto itChar = info->header.characters.begin(); + while(itChar != info->header.characters.end()) { + CharacterGen::generateProperty(&c.publicProperties, *itChar, ""); + CharacterGen::generateInitializer(&vnStage.body, *itChar, ""); + CharacterGen::generateAssets(&getAssets.body, *itChar, ""); + ++itChar; + } + + // Events + if(info->events.eventTypes.size() > 0) { + line(&getVNEvent.body, "start", ""); + EventsGen::generate(&getVNEvent.body, &info->events, " "); + line(&getVNEvent.body, ";", ""); + } + + // Wrap up methods + line(&getAssets.body, "return assets;", ""); + line(&getVNEvent.body, "return start;", ""); + + methodGen(&c.publicCode, vnStage); + line(&c.publicCode, "", ""); + methodGen(&c.publicCode, getAssets); + methodGen(&c.publicCode, getVNEvent); + classGen(out, c); + } + }; } \ No newline at end of file diff --git a/src/dawntools/tools/vnscenegen/parse/scene.hpp b/archive/vnscenegen/parse/scene.hpp similarity index 96% rename from src/dawntools/tools/vnscenegen/parse/scene.hpp rename to archive/vnscenegen/parse/scene.hpp index 47fc7603..979c932b 100644 --- a/src/dawntools/tools/vnscenegen/parse/scene.hpp +++ b/archive/vnscenegen/parse/scene.hpp @@ -1,40 +1,40 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "util/XmlParser.hpp" - -namespace Dawn { - struct SceneInformation { - std::string type; - std::string name; - }; - - class SceneParser : public XmlParser { - protected: - std::vector getRequiredAttributes() { - return std::vector{ - "name", - }; - } - - std::map getOptionalAttributes() { - return std::map{ - { "type", "SimpleVNScene" } - }; - } - - int32_t onParse( - Xml *node, - std::map values, - struct SceneInformation *out, - std::string *error - ) { - out->name = values["name"]; - out->type = values["type"]; - return 0; - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "util/XmlParser.hpp" + +namespace Dawn { + struct SceneInformation { + std::string type; + std::string name; + }; + + class SceneParser : public XmlParser { + protected: + std::vector getRequiredAttributes() { + return std::vector{ + "name", + }; + } + + std::map getOptionalAttributes() { + return std::map{ + { "type", "SimpleVNScene" } + }; + } + + int32_t onParse( + Xml *node, + std::map values, + struct SceneInformation *out, + std::string *error + ) { + out->name = values["name"]; + out->type = values["type"]; + return 0; + } + }; } \ No newline at end of file diff --git a/lint.js b/lint.js deleted file mode 100644 index 5fe3b10a..00000000 --- a/lint.js +++ /dev/null @@ -1,95 +0,0 @@ -const fs = require('fs'); -const path = require('path'); - -const DIR_SOURCES = path.resolve('src'); - -const fileGetContents = filePath => fs.readFileSync(filePath, 'utf-8'); - -const ensureCopyright = (file, contents) => { - if( - contents.includes('Copyright (c)') && - contents.includes('MIT') - ) return; - throw new Error(`${file} is missing its copyright!`); -} - -const ensurePragma = (file, contents) => { - if(contents.includes('#pragma once')) return; - throw new Error(`${file} is missing a #pragma once`); -} - - -const fileHandleCpp = filePath => { - // Load contents - const contents = fileGetContents(filePath); - ensureCopyright(filePath, contents); -} - -const fileHandleC = filePath => { - // Load contents - const contents = fileGetContents(filePath); - ensureCopyright(filePath, contents); -} - -const fileHandleHpp = filePath => { - // Load contents - const contents = fileGetContents(filePath); - - ensureCopyright(filePath, contents); - ensurePragma(filePath, contents); -} - -const fileHandleH = filePath => { - // Load contents - const contents = fileGetContents(filePath); - - ensureCopyright(filePath, contents); - ensurePragma(filePath, contents); -} - -const fileHandleCmake = filePath => { - // Load contents - const contents = fileGetContents(filePath); - - // Check for the copyright - ensureCopyright(filePath, contents); -} - - - -const fileScan = filePath => { - const ext = path.extname(filePath).replace(/\./g, ''); - const base = path.basename(filePath); - - if(ext === 'cpp') { - fileHandleCpp(filePath); - } else if(ext === 'hpp') { - fileHandleHpp(filePath); - } else if(ext === 'c') { - fileHandleC(filePath); - } else if(ext === 'h') { - fileHandleH(filePath); - }else if(base === 'CMakeLists.txt') { - fileHandleCmake(filePath); - } else { - throw new Error(`Unknown file type ${filePath}`); - } -}; - -const dirScan = directory => { - const contents = fs.readdirSync(directory); - contents.forEach(filePath => { - const abs = path.join(directory, filePath); - const stat = fs.statSync(abs); - if(stat.isDirectory()) { - dirScan(abs); - } else { - fileScan(abs); - } - }); -} - -(() => { - dirScan(DIR_SOURCES); - console.log('Lint done'); -})(); \ No newline at end of file diff --git a/src/dawn/CMakeLists.txt b/src/dawn/CMakeLists.txt index 87fc9815..5e93d2e7 100644 --- a/src/dawn/CMakeLists.txt +++ b/src/dawn/CMakeLists.txt @@ -36,10 +36,6 @@ add_subdirectory(scene) add_subdirectory(state) add_subdirectory(time) -if(DAWN_VISUAL_NOVEL) - add_subdirectory(visualnovel) -endif() - # Definitions target_compile_definitions(${DAWN_TARGET_NAME} PUBLIC diff --git a/src/dawn/games/CMakeLists.txt b/src/dawn/games/CMakeLists.txt index f1812e63..d3f4878f 100644 --- a/src/dawn/games/CMakeLists.txt +++ b/src/dawn/games/CMakeLists.txt @@ -5,4 +5,8 @@ # Subdirs add_subdirectory(poker) -add_subdirectory(tictactoe) \ No newline at end of file +add_subdirectory(tictactoe) + +if(DAWN_VISUAL_NOVEL) + add_subdirectory(visualnovel) +endif() \ No newline at end of file diff --git a/src/dawn/visualnovel/CMakeLists.txt b/src/dawn/games/visualnovel/CMakeLists.txt similarity index 100% rename from src/dawn/visualnovel/CMakeLists.txt rename to src/dawn/games/visualnovel/CMakeLists.txt diff --git a/src/dawn/visualnovel/VisualNovelManager.cpp b/src/dawn/games/visualnovel/VisualNovelManager.cpp similarity index 96% rename from src/dawn/visualnovel/VisualNovelManager.cpp rename to src/dawn/games/visualnovel/VisualNovelManager.cpp index bdd981a4..b520298c 100644 --- a/src/dawn/visualnovel/VisualNovelManager.cpp +++ b/src/dawn/games/visualnovel/VisualNovelManager.cpp @@ -1,85 +1,85 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "VisualNovelManager.hpp" -#include "visualnovel/scene/SimpleVNScene.hpp" - -using namespace Dawn; - -VisualNovelManager::VisualNovelManager(SceneItem *item) : - SceneItemComponent(item) -{ -} - -void VisualNovelManager::onStart() { - SceneItemComponent::onStart(); - - this->uiCanvas = getScene()->findComponent(); - assertNotNull(this->uiCanvas); - - this->textBox = this->uiCanvas->findElement(); - this->fader = this->uiCanvas->findElement(); - - assertNotNull(this->textBox); - - this->getScene()->eventSceneUnpausedUpdate.addListener(this, &VisualNovelManager::onUnpausedUpdate); - - // Handle queuing simple VN Manager - auto scene = this->getScene(); - auto sceneAsSimple = dynamic_cast(scene); - if(sceneAsSimple != nullptr) { - this->setEvent(sceneAsSimple->getVNEvent()); - } - - if(this->currentEvent != nullptr) this->currentEvent->start(nullptr); -} - -void VisualNovelManager::onUnpausedUpdate() { - if(this->currentEvent == nullptr) return; - - if(!this->currentEvent->hasStarted) this->currentEvent->start(nullptr); - if(this->currentEvent->update()) return; - this->setEvent(this->currentEvent->end()); -} - -VisualNovelManager::~VisualNovelManager() { - if(this->currentEvent != nullptr) { - delete this->currentEvent; - } - this->getScene()->eventSceneUnpausedUpdate.removeListener(this, &VisualNovelManager::onUnpausedUpdate); -} - - -// // // // // // // // // // // // // // // // // // // // // // // // // // // - - -IVisualNovelEvent::IVisualNovelEvent(VisualNovelManager *man) { - assertNotNull(man); - this->manager = man; -} - -void IVisualNovelEvent::start(IVisualNovelEvent *previous) { - this->hasStarted = true; - this->onStart(previous); -} - -bool_t IVisualNovelEvent::update() { - return this->onUpdate(); -} - -IVisualNovelEvent * IVisualNovelEvent::end() { - this->onEnd(); - - if(this->doNext != nullptr) { - auto next = this->doNext; - this->doNext = nullptr; - return next; - } - return nullptr; -} - -IVisualNovelEvent::~IVisualNovelEvent() { - if(this->doNext != nullptr) delete this->doNext; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "VisualNovelManager.hpp" +#include "visualnovel/scene/SimpleVNScene.hpp" + +using namespace Dawn; + +VisualNovelManager::VisualNovelManager(SceneItem *item) : + SceneItemComponent(item) +{ +} + +void VisualNovelManager::onStart() { + SceneItemComponent::onStart(); + + this->uiCanvas = getScene()->findComponent(); + assertNotNull(this->uiCanvas); + + this->textBox = this->uiCanvas->findElement(); + this->fader = this->uiCanvas->findElement(); + + assertNotNull(this->textBox); + + this->getScene()->eventSceneUnpausedUpdate.addListener(this, &VisualNovelManager::onUnpausedUpdate); + + // Handle queuing simple VN Manager + auto scene = this->getScene(); + auto sceneAsSimple = dynamic_cast(scene); + if(sceneAsSimple != nullptr) { + this->setEvent(sceneAsSimple->getVNEvent()); + } + + if(this->currentEvent != nullptr) this->currentEvent->start(nullptr); +} + +void VisualNovelManager::onUnpausedUpdate() { + if(this->currentEvent == nullptr) return; + + if(!this->currentEvent->hasStarted) this->currentEvent->start(nullptr); + if(this->currentEvent->update()) return; + this->setEvent(this->currentEvent->end()); +} + +VisualNovelManager::~VisualNovelManager() { + if(this->currentEvent != nullptr) { + delete this->currentEvent; + } + this->getScene()->eventSceneUnpausedUpdate.removeListener(this, &VisualNovelManager::onUnpausedUpdate); +} + + +// // // // // // // // // // // // // // // // // // // // // // // // // // // + + +IVisualNovelEvent::IVisualNovelEvent(VisualNovelManager *man) { + assertNotNull(man); + this->manager = man; +} + +void IVisualNovelEvent::start(IVisualNovelEvent *previous) { + this->hasStarted = true; + this->onStart(previous); +} + +bool_t IVisualNovelEvent::update() { + return this->onUpdate(); +} + +IVisualNovelEvent * IVisualNovelEvent::end() { + this->onEnd(); + + if(this->doNext != nullptr) { + auto next = this->doNext; + this->doNext = nullptr; + return next; + } + return nullptr; +} + +IVisualNovelEvent::~IVisualNovelEvent() { + if(this->doNext != nullptr) delete this->doNext; } \ No newline at end of file diff --git a/src/dawn/visualnovel/VisualNovelManager.hpp b/src/dawn/games/visualnovel/VisualNovelManager.hpp similarity index 96% rename from src/dawn/visualnovel/VisualNovelManager.hpp rename to src/dawn/games/visualnovel/VisualNovelManager.hpp index 77f50ee2..b3fa7be3 100644 --- a/src/dawn/visualnovel/VisualNovelManager.hpp +++ b/src/dawn/games/visualnovel/VisualNovelManager.hpp @@ -1,124 +1,124 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/SceneItemComponent.hpp" -#include "visualnovel/ui/VisualNovelTextbox.hpp" -#include "visualnovel/ui/VisualNovelFader.hpp" - -namespace Dawn { - class IVisualNovelEvent; - - class VisualNovelManager : public SceneItemComponent { - private: - IVisualNovelEvent* currentEvent = nullptr; - - public: - UICanvas *uiCanvas = nullptr; - VisualNovelTextbox *textBox = nullptr; - VisualNovelFader *fader = nullptr; - - AudioSource *audioBackground = nullptr; - AudioSource *audioCharacter = nullptr; - - /** Event listener for unpaused scene updates. */ - void onUnpausedUpdate(); - - /** - * Constructs a visual novel manager, scene item component. - * - * @param item Item that the VN manager belongs to. - */ - VisualNovelManager(SceneItem *item); - - /** - * Sets the currently active visual novel event. This is assumed to be - * the only way to handle events (no multiples currently). - * - * @param event Event to set. - */ - template - T * setEvent(T *event) { - auto oldCurrent = this->currentEvent; - this->currentEvent = event; - if(this->hasInitialized && event != nullptr) event->start(oldCurrent); - delete oldCurrent; - return event; - } - - /** - * Override to the SceneItemComponent on start event. - * - */ - void onStart() override; - - /** - * Dispose / Cleanup the VN manager. - * - */ - ~VisualNovelManager(); - - friend class IVisualNovelEvent; - }; - - - class IVisualNovelEvent { - protected: - VisualNovelManager *manager; - IVisualNovelEvent *doNext = nullptr; - bool_t hasStarted = false; - - virtual void onStart(IVisualNovelEvent *previous) = 0; - virtual bool_t onUpdate() = 0; - virtual void onEnd() = 0; - - public: - IVisualNovelEvent(VisualNovelManager *manager); - - /** - * Chains an event to be executed after this event has finished. - * - * @param next Event to process next. - * @return Whatever you pass in to next. - */ - template - T * then(T *next) { - this->doNext = next; - return next; - } - - /** - * Begins this visual novel event, internally updates some flags and - * calls the event to do its own start logic. - * - * @param previous Previous event, this is for doing logic based chains. - */ - void start(IVisualNovelEvent *previous); - - /** - * Performs a tick on this event. The event can then decide whether or not - * it has finished processing. - * - * @return True if the event is still active, otherwise false. - */ - bool_t update(); - - /** - * End this current event. Returns the "next event" to process. Most of - * the events can handle this with the simple ->then() chaining, but some - * events may chose to do complex if-style logic. - * - * @return Event to run next. - */ - IVisualNovelEvent * end(); - - /** - * Dispose the VN event. - */ - virtual ~IVisualNovelEvent(); - - friend class VisualNovelManager; - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "scene/SceneItemComponent.hpp" +#include "visualnovel/ui/VisualNovelTextbox.hpp" +#include "visualnovel/ui/VisualNovelFader.hpp" + +namespace Dawn { + class IVisualNovelEvent; + + class VisualNovelManager : public SceneItemComponent { + private: + IVisualNovelEvent* currentEvent = nullptr; + + public: + UICanvas *uiCanvas = nullptr; + VisualNovelTextbox *textBox = nullptr; + VisualNovelFader *fader = nullptr; + + AudioSource *audioBackground = nullptr; + AudioSource *audioCharacter = nullptr; + + /** Event listener for unpaused scene updates. */ + void onUnpausedUpdate(); + + /** + * Constructs a visual novel manager, scene item component. + * + * @param item Item that the VN manager belongs to. + */ + VisualNovelManager(SceneItem *item); + + /** + * Sets the currently active visual novel event. This is assumed to be + * the only way to handle events (no multiples currently). + * + * @param event Event to set. + */ + template + T * setEvent(T *event) { + auto oldCurrent = this->currentEvent; + this->currentEvent = event; + if(this->hasInitialized && event != nullptr) event->start(oldCurrent); + delete oldCurrent; + return event; + } + + /** + * Override to the SceneItemComponent on start event. + * + */ + void onStart() override; + + /** + * Dispose / Cleanup the VN manager. + * + */ + ~VisualNovelManager(); + + friend class IVisualNovelEvent; + }; + + + class IVisualNovelEvent { + protected: + VisualNovelManager *manager; + IVisualNovelEvent *doNext = nullptr; + bool_t hasStarted = false; + + virtual void onStart(IVisualNovelEvent *previous) = 0; + virtual bool_t onUpdate() = 0; + virtual void onEnd() = 0; + + public: + IVisualNovelEvent(VisualNovelManager *manager); + + /** + * Chains an event to be executed after this event has finished. + * + * @param next Event to process next. + * @return Whatever you pass in to next. + */ + template + T * then(T *next) { + this->doNext = next; + return next; + } + + /** + * Begins this visual novel event, internally updates some flags and + * calls the event to do its own start logic. + * + * @param previous Previous event, this is for doing logic based chains. + */ + void start(IVisualNovelEvent *previous); + + /** + * Performs a tick on this event. The event can then decide whether or not + * it has finished processing. + * + * @return True if the event is still active, otherwise false. + */ + bool_t update(); + + /** + * End this current event. Returns the "next event" to process. Most of + * the events can handle this with the simple ->then() chaining, but some + * events may chose to do complex if-style logic. + * + * @return Event to run next. + */ + IVisualNovelEvent * end(); + + /** + * Dispose the VN event. + */ + virtual ~IVisualNovelEvent(); + + friend class VisualNovelManager; + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/components/CMakeLists.txt b/src/dawn/games/visualnovel/components/CMakeLists.txt similarity index 100% rename from src/dawn/visualnovel/components/CMakeLists.txt rename to src/dawn/games/visualnovel/components/CMakeLists.txt diff --git a/src/dawn/visualnovel/components/SimpleVisualNovelBackground.cpp b/src/dawn/games/visualnovel/components/SimpleVisualNovelBackground.cpp similarity index 96% rename from src/dawn/visualnovel/components/SimpleVisualNovelBackground.cpp rename to src/dawn/games/visualnovel/components/SimpleVisualNovelBackground.cpp index 39ce4401..5864ef59 100644 --- a/src/dawn/visualnovel/components/SimpleVisualNovelBackground.cpp +++ b/src/dawn/games/visualnovel/components/SimpleVisualNovelBackground.cpp @@ -1,56 +1,56 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "SimpleVisualNovelBackground.hpp" - -using namespace Dawn; - -SimpleVisualNovelBackground * SimpleVisualNovelBackground::create(Scene *s) { - auto item = s->createSceneItem(); - // item->addComponent(); - item->addComponent(); - item->addComponent(); - auto background = item->addComponent(); - return background; -} - -SimpleVisualNovelBackground::SimpleVisualNovelBackground(SceneItem *item) : - SceneItemComponent(item) -{ - -} - -std::vector SimpleVisualNovelBackground::getDependencies(){ - return std::vector{ - this->material = this->item->getComponent(), - this->meshHost = this->item->getComponent() - }; -} - -void SimpleVisualNovelBackground::setTexture(Texture *texture) { - assertNotNull(texture); - this->material->texture = texture; - - // Since we go both negative and positive, actual height is doubled - float_t aspect = (float_t)texture->getWidth() / (float_t)texture->getHeight(); - float_t height = 0.5f; - - QuadMesh::bufferQuadMeshWithZ(&this->meshHost->mesh, - glm::vec2(-aspect * height, -height), glm::vec2(0, 1), - glm::vec2( aspect * height, height), glm::vec2(1, 0), - 0.0f, 0, 0 - ); -} - -void SimpleVisualNovelBackground::onStart() { - assertNotNull(this->material); - assertNotNull(this->meshHost); - - QuadMesh::initQuadMesh(&this->meshHost->mesh, - glm::vec2(-1, -1), glm::vec2(0, 1), - glm::vec2(1, 1), glm::vec2(1, 0), - 0.0f - ); +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "SimpleVisualNovelBackground.hpp" + +using namespace Dawn; + +SimpleVisualNovelBackground * SimpleVisualNovelBackground::create(Scene *s) { + auto item = s->createSceneItem(); + // item->addComponent(); + item->addComponent(); + item->addComponent(); + auto background = item->addComponent(); + return background; +} + +SimpleVisualNovelBackground::SimpleVisualNovelBackground(SceneItem *item) : + SceneItemComponent(item) +{ + +} + +std::vector SimpleVisualNovelBackground::getDependencies(){ + return std::vector{ + this->material = this->item->getComponent(), + this->meshHost = this->item->getComponent() + }; +} + +void SimpleVisualNovelBackground::setTexture(Texture *texture) { + assertNotNull(texture); + this->material->texture = texture; + + // Since we go both negative and positive, actual height is doubled + float_t aspect = (float_t)texture->getWidth() / (float_t)texture->getHeight(); + float_t height = 0.5f; + + QuadMesh::bufferQuadMeshWithZ(&this->meshHost->mesh, + glm::vec2(-aspect * height, -height), glm::vec2(0, 1), + glm::vec2( aspect * height, height), glm::vec2(1, 0), + 0.0f, 0, 0 + ); +} + +void SimpleVisualNovelBackground::onStart() { + assertNotNull(this->material); + assertNotNull(this->meshHost); + + QuadMesh::initQuadMesh(&this->meshHost->mesh, + glm::vec2(-1, -1), glm::vec2(0, 1), + glm::vec2(1, 1), glm::vec2(1, 0), + 0.0f + ); } \ No newline at end of file diff --git a/src/dawn/visualnovel/components/SimpleVisualNovelBackground.hpp b/src/dawn/games/visualnovel/components/SimpleVisualNovelBackground.hpp similarity index 97% rename from src/dawn/visualnovel/components/SimpleVisualNovelBackground.hpp rename to src/dawn/games/visualnovel/components/SimpleVisualNovelBackground.hpp index 79d37c17..93bf2e87 100644 --- a/src/dawn/visualnovel/components/SimpleVisualNovelBackground.hpp +++ b/src/dawn/games/visualnovel/components/SimpleVisualNovelBackground.hpp @@ -1,44 +1,44 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/components/Components.hpp" -#include "scene/components/display/material/SimpleTexturedMaterial.hpp" - -namespace Dawn { - class SimpleVisualNovelBackground : public SceneItemComponent { - public: - SimpleTexturedMaterial *material; - MeshHost *meshHost; - - /** - * Create a simple Visual Novel Background prefab. - * - * @param scene Scene to add this background to. - * @return Created background Scene Item. - */ - static SimpleVisualNovelBackground * create(Scene *scene); - - /** - * Construct a Simple Visual Novel Background. Simple Background is used - * for a quick up and running Visual Novel scene, but does not have any - * special effects or controls beyond updating a texture and mesh. - * - * @param item Scene Item this background belongs to. - */ - SimpleVisualNovelBackground(SceneItem *item); - - std::vector getDependencies() override; - void onStart() override; - - /** - * Set the texture for the background. Auto updates the material and the - * dimensions of the internal quad. - * - * @param texture Texture to use. - */ - void setTexture(Texture *texture); - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "scene/components/Components.hpp" +#include "scene/components/display/material/SimpleTexturedMaterial.hpp" + +namespace Dawn { + class SimpleVisualNovelBackground : public SceneItemComponent { + public: + SimpleTexturedMaterial *material; + MeshHost *meshHost; + + /** + * Create a simple Visual Novel Background prefab. + * + * @param scene Scene to add this background to. + * @return Created background Scene Item. + */ + static SimpleVisualNovelBackground * create(Scene *scene); + + /** + * Construct a Simple Visual Novel Background. Simple Background is used + * for a quick up and running Visual Novel scene, but does not have any + * special effects or controls beyond updating a texture and mesh. + * + * @param item Scene Item this background belongs to. + */ + SimpleVisualNovelBackground(SceneItem *item); + + std::vector getDependencies() override; + void onStart() override; + + /** + * Set the texture for the background. Auto updates the material and the + * dimensions of the internal quad. + * + * @param texture Texture to use. + */ + void setTexture(Texture *texture); + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/components/VisualNovelCharacter.cpp b/src/dawn/games/visualnovel/components/VisualNovelCharacter.cpp similarity index 96% rename from src/dawn/visualnovel/components/VisualNovelCharacter.cpp rename to src/dawn/games/visualnovel/components/VisualNovelCharacter.cpp index de086bdc..f3a7ba21 100644 --- a/src/dawn/visualnovel/components/VisualNovelCharacter.cpp +++ b/src/dawn/games/visualnovel/components/VisualNovelCharacter.cpp @@ -1,25 +1,25 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "VisualNovelCharacter.hpp" - -using namespace Dawn; - -VisualNovelCharacter::VisualNovelCharacter(SceneItem *item) : - SceneItemComponent(item) -{ -} - -std::vector VisualNovelCharacter::getDependencies() { - return std::vector{ - (this->material = this->item->getComponent()), - (this->tiledSprite = this->item->getComponent()) - }; -} - -void VisualNovelCharacter::onStart() { - assertNotNull(this->material); - assertNotNull(this->tiledSprite); +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "VisualNovelCharacter.hpp" + +using namespace Dawn; + +VisualNovelCharacter::VisualNovelCharacter(SceneItem *item) : + SceneItemComponent(item) +{ +} + +std::vector VisualNovelCharacter::getDependencies() { + return std::vector{ + (this->material = this->item->getComponent()), + (this->tiledSprite = this->item->getComponent()) + }; +} + +void VisualNovelCharacter::onStart() { + assertNotNull(this->material); + assertNotNull(this->tiledSprite); } \ No newline at end of file diff --git a/src/dawn/visualnovel/components/VisualNovelCharacter.hpp b/src/dawn/games/visualnovel/components/VisualNovelCharacter.hpp similarity index 96% rename from src/dawn/visualnovel/components/VisualNovelCharacter.hpp rename to src/dawn/games/visualnovel/components/VisualNovelCharacter.hpp index 42fd873c..bd2af706 100644 --- a/src/dawn/visualnovel/components/VisualNovelCharacter.hpp +++ b/src/dawn/games/visualnovel/components/VisualNovelCharacter.hpp @@ -1,37 +1,37 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/SceneItemComponent.hpp" -#include "asset/assets/AudioAsset.hpp" -#include "scene/components/display/material/SimpleTexturedMaterial.hpp" -#include "scene/components/display/TiledSprite.hpp" -#include "scene/components/audio/AudioSource.hpp" - -namespace Dawn { - struct VisualNovelCharacterEmotion { - int32_t tile = 0; - AudioAsset *talkSound = nullptr; - AudioAsset *emotionSound = nullptr; - }; - - class VisualNovelCharacter : public SceneItemComponent { - public: - std::string nameKey = "character.unknown"; - SimpleTexturedMaterial *material = nullptr; - TiledSprite *tiledSprite = nullptr; - - /** - * Visual Novel Character Component. Mostly logic-less but provides nice - * interfaces for sibling components. - * - * @param item Item that this component belongs to. - */ - VisualNovelCharacter(SceneItem *item); - - std::vector getDependencies() override; - void onStart() override; - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "scene/SceneItemComponent.hpp" +#include "asset/assets/AudioAsset.hpp" +#include "scene/components/display/material/SimpleTexturedMaterial.hpp" +#include "scene/components/display/TiledSprite.hpp" +#include "scene/components/audio/AudioSource.hpp" + +namespace Dawn { + struct VisualNovelCharacterEmotion { + int32_t tile = 0; + AudioAsset *talkSound = nullptr; + AudioAsset *emotionSound = nullptr; + }; + + class VisualNovelCharacter : public SceneItemComponent { + public: + std::string nameKey = "character.unknown"; + SimpleTexturedMaterial *material = nullptr; + TiledSprite *tiledSprite = nullptr; + + /** + * Visual Novel Character Component. Mostly logic-less but provides nice + * interfaces for sibling components. + * + * @param item Item that this component belongs to. + */ + VisualNovelCharacter(SceneItem *item); + + std::vector getDependencies() override; + void onStart() override; + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/CMakeLists.txt b/src/dawn/games/visualnovel/events/CMakeLists.txt similarity index 100% rename from src/dawn/visualnovel/events/CMakeLists.txt rename to src/dawn/games/visualnovel/events/CMakeLists.txt diff --git a/src/dawn/visualnovel/events/VisualNovelCallbackEvent.hpp b/src/dawn/games/visualnovel/events/VisualNovelCallbackEvent.hpp similarity index 95% rename from src/dawn/visualnovel/events/VisualNovelCallbackEvent.hpp rename to src/dawn/games/visualnovel/events/VisualNovelCallbackEvent.hpp index 6fc873c9..b03f1c06 100644 --- a/src/dawn/visualnovel/events/VisualNovelCallbackEvent.hpp +++ b/src/dawn/games/visualnovel/events/VisualNovelCallbackEvent.hpp @@ -1,38 +1,38 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/VisualNovelManager.hpp" - -namespace Dawn { - template - class VisualNovelCallbackEvent : public IVisualNovelEvent { - protected: - T *instance; - void (T::*callback)(); - - void onStart(IVisualNovelEvent *previous) { - - } - - bool_t onUpdate() { - return false; - } - - void onEnd() { - ((*this->instance).*(this->callback))(); - } - - public: - VisualNovelCallbackEvent( - VisualNovelManager *manager, - T *instance, - void (T::*callback)() - ) : IVisualNovelEvent(manager) { - this->instance = instance; - this->callback = callback; - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/VisualNovelManager.hpp" + +namespace Dawn { + template + class VisualNovelCallbackEvent : public IVisualNovelEvent { + protected: + T *instance; + void (T::*callback)(); + + void onStart(IVisualNovelEvent *previous) { + + } + + bool_t onUpdate() { + return false; + } + + void onEnd() { + ((*this->instance).*(this->callback))(); + } + + public: + VisualNovelCallbackEvent( + VisualNovelManager *manager, + T *instance, + void (T::*callback)() + ) : IVisualNovelEvent(manager) { + this->instance = instance; + this->callback = callback; + } + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/VisualNovelChangeSimpleBackgroundEvent.cpp b/src/dawn/games/visualnovel/events/VisualNovelChangeSimpleBackgroundEvent.cpp similarity index 96% rename from src/dawn/visualnovel/events/VisualNovelChangeSimpleBackgroundEvent.cpp rename to src/dawn/games/visualnovel/events/VisualNovelChangeSimpleBackgroundEvent.cpp index cfc64de6..747eee54 100644 --- a/src/dawn/visualnovel/events/VisualNovelChangeSimpleBackgroundEvent.cpp +++ b/src/dawn/games/visualnovel/events/VisualNovelChangeSimpleBackgroundEvent.cpp @@ -1,32 +1,32 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "VisualNovelChangeSimpleBackgroundEvent.hpp" -#include "game/DawnGame.hpp" - -using namespace Dawn; - -VisualNovelChangeSimpleBackgroundEvent::VisualNovelChangeSimpleBackgroundEvent( - VisualNovelManager *manager, Texture *texture -) : IVisualNovelEvent(manager) { - this->texture = texture; -} - -void VisualNovelChangeSimpleBackgroundEvent::onStart(IVisualNovelEvent *prev) { - auto back = this->manager->getScene() - ->findComponent() - ; - - assertNotNull(back); - back->setTexture(this->texture); -} - -bool_t VisualNovelChangeSimpleBackgroundEvent::onUpdate() { - return false; -} - -void VisualNovelChangeSimpleBackgroundEvent::onEnd() { - +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "VisualNovelChangeSimpleBackgroundEvent.hpp" +#include "game/DawnGame.hpp" + +using namespace Dawn; + +VisualNovelChangeSimpleBackgroundEvent::VisualNovelChangeSimpleBackgroundEvent( + VisualNovelManager *manager, Texture *texture +) : IVisualNovelEvent(manager) { + this->texture = texture; +} + +void VisualNovelChangeSimpleBackgroundEvent::onStart(IVisualNovelEvent *prev) { + auto back = this->manager->getScene() + ->findComponent() + ; + + assertNotNull(back); + back->setTexture(this->texture); +} + +bool_t VisualNovelChangeSimpleBackgroundEvent::onUpdate() { + return false; +} + +void VisualNovelChangeSimpleBackgroundEvent::onEnd() { + } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/VisualNovelChangeSimpleBackgroundEvent.hpp b/src/dawn/games/visualnovel/events/VisualNovelChangeSimpleBackgroundEvent.hpp similarity index 96% rename from src/dawn/visualnovel/events/VisualNovelChangeSimpleBackgroundEvent.hpp rename to src/dawn/games/visualnovel/events/VisualNovelChangeSimpleBackgroundEvent.hpp index f0547a0f..6434de7d 100644 --- a/src/dawn/visualnovel/events/VisualNovelChangeSimpleBackgroundEvent.hpp +++ b/src/dawn/games/visualnovel/events/VisualNovelChangeSimpleBackgroundEvent.hpp @@ -1,25 +1,25 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/VisualNovelManager.hpp" -#include "visualnovel/components/SimpleVisualNovelBackground.hpp" - -namespace Dawn { - class VisualNovelChangeSimpleBackgroundEvent : public IVisualNovelEvent { - protected: - Texture *texture = nullptr; - - void onStart(IVisualNovelEvent *previous) override; - bool_t onUpdate() override; - void onEnd() override; - - public: - VisualNovelChangeSimpleBackgroundEvent( - VisualNovelManager *manager, - Texture *texture - ); - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/VisualNovelManager.hpp" +#include "visualnovel/components/SimpleVisualNovelBackground.hpp" + +namespace Dawn { + class VisualNovelChangeSimpleBackgroundEvent : public IVisualNovelEvent { + protected: + Texture *texture = nullptr; + + void onStart(IVisualNovelEvent *previous) override; + bool_t onUpdate() override; + void onEnd() override; + + public: + VisualNovelChangeSimpleBackgroundEvent( + VisualNovelManager *manager, + Texture *texture + ); + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/VisualNovelEmptyEvent.cpp b/src/dawn/games/visualnovel/events/VisualNovelEmptyEvent.cpp similarity index 95% rename from src/dawn/visualnovel/events/VisualNovelEmptyEvent.cpp rename to src/dawn/games/visualnovel/events/VisualNovelEmptyEvent.cpp index 43a80d32..e543c483 100644 --- a/src/dawn/visualnovel/events/VisualNovelEmptyEvent.cpp +++ b/src/dawn/games/visualnovel/events/VisualNovelEmptyEvent.cpp @@ -1,25 +1,25 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "VisualNovelEmptyEvent.hpp" - -using namespace Dawn; - -VisualNovelEmptyEvent::VisualNovelEmptyEvent(VisualNovelManager *man) : - IVisualNovelEvent(man) -{ - -} - -void VisualNovelEmptyEvent::onStart(IVisualNovelEvent *prev) { - -} - -bool_t VisualNovelEmptyEvent::onUpdate() { - return false; -} - -void VisualNovelEmptyEvent::onEnd() { +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "VisualNovelEmptyEvent.hpp" + +using namespace Dawn; + +VisualNovelEmptyEvent::VisualNovelEmptyEvent(VisualNovelManager *man) : + IVisualNovelEvent(man) +{ + +} + +void VisualNovelEmptyEvent::onStart(IVisualNovelEvent *prev) { + +} + +bool_t VisualNovelEmptyEvent::onUpdate() { + return false; +} + +void VisualNovelEmptyEvent::onEnd() { } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/VisualNovelEmptyEvent.hpp b/src/dawn/games/visualnovel/events/VisualNovelEmptyEvent.hpp similarity index 96% rename from src/dawn/visualnovel/events/VisualNovelEmptyEvent.hpp rename to src/dawn/games/visualnovel/events/VisualNovelEmptyEvent.hpp index a111fe6b..b26bef65 100644 --- a/src/dawn/visualnovel/events/VisualNovelEmptyEvent.hpp +++ b/src/dawn/games/visualnovel/events/VisualNovelEmptyEvent.hpp @@ -1,19 +1,19 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/VisualNovelManager.hpp" - -namespace Dawn { - class VisualNovelEmptyEvent : public IVisualNovelEvent { - protected: - void onStart(IVisualNovelEvent *previous) override; - bool_t onUpdate() override; - void onEnd() override; - - public: - VisualNovelEmptyEvent(VisualNovelManager *manager); - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/VisualNovelManager.hpp" + +namespace Dawn { + class VisualNovelEmptyEvent : public IVisualNovelEvent { + protected: + void onStart(IVisualNovelEvent *previous) override; + bool_t onUpdate() override; + void onEnd() override; + + public: + VisualNovelEmptyEvent(VisualNovelManager *manager); + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/VisualNovelFadeEvent.cpp b/src/dawn/games/visualnovel/events/VisualNovelFadeEvent.cpp similarity index 96% rename from src/dawn/visualnovel/events/VisualNovelFadeEvent.cpp rename to src/dawn/games/visualnovel/events/VisualNovelFadeEvent.cpp index 3ffdf18b..905645b1 100644 --- a/src/dawn/visualnovel/events/VisualNovelFadeEvent.cpp +++ b/src/dawn/games/visualnovel/events/VisualNovelFadeEvent.cpp @@ -1,35 +1,35 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "VisualNovelFadeEvent.hpp" - -using namespace Dawn; - -VisualNovelFadeEvent::VisualNovelFadeEvent( - VisualNovelManager *man, - struct Color color, - bool_t fadeIn, - easefunction_t *ease, - float_t duration -) : VisualNovelSimpleAnimationEvent(man, &duration) { - this->color = color; - this->fadeIn = fadeIn; - this->duration = duration; - this->simpleAnimation.easing = ease; -} - -void VisualNovelFadeEvent::onStart(IVisualNovelEvent *previous) { - VisualNovelSimpleAnimationEvent::onStart(previous); - - this->simpleAnimation = SimpleAnimation(&this->manager->fader->color.a); - this->manager->fader->color = this->color; - this->manager->fader->color.a = this->fadeIn ? 0.0f : 1.0f; - this->simpleAnimation.addKeyframe( - 0.0f, this->fadeIn ? 0.0f : 1.0f - ); - this->simpleAnimation.addKeyframe( - this->duration, this->fadeIn ? 1.0f : 0.0f - ); +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "VisualNovelFadeEvent.hpp" + +using namespace Dawn; + +VisualNovelFadeEvent::VisualNovelFadeEvent( + VisualNovelManager *man, + struct Color color, + bool_t fadeIn, + easefunction_t *ease, + float_t duration +) : VisualNovelSimpleAnimationEvent(man, &duration) { + this->color = color; + this->fadeIn = fadeIn; + this->duration = duration; + this->simpleAnimation.easing = ease; +} + +void VisualNovelFadeEvent::onStart(IVisualNovelEvent *previous) { + VisualNovelSimpleAnimationEvent::onStart(previous); + + this->simpleAnimation = SimpleAnimation(&this->manager->fader->color.a); + this->manager->fader->color = this->color; + this->manager->fader->color.a = this->fadeIn ? 0.0f : 1.0f; + this->simpleAnimation.addKeyframe( + 0.0f, this->fadeIn ? 0.0f : 1.0f + ); + this->simpleAnimation.addKeyframe( + this->duration, this->fadeIn ? 1.0f : 0.0f + ); } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/VisualNovelFadeEvent.hpp b/src/dawn/games/visualnovel/events/VisualNovelFadeEvent.hpp similarity index 96% rename from src/dawn/visualnovel/events/VisualNovelFadeEvent.hpp rename to src/dawn/games/visualnovel/events/VisualNovelFadeEvent.hpp index 4939a21e..f43f7455 100644 --- a/src/dawn/visualnovel/events/VisualNovelFadeEvent.hpp +++ b/src/dawn/games/visualnovel/events/VisualNovelFadeEvent.hpp @@ -1,36 +1,36 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/events/animation/VisualNovelSimpleAnimationEvent.hpp" - -namespace Dawn { - class VisualNovelFadeEvent : public VisualNovelSimpleAnimationEvent { - protected: - struct Color color; - bool_t fadeIn; - float_t duration; - - void onStart(IVisualNovelEvent *previous) override; - - public: - /** - * Create a new visual novel event for fading the screen in/out. - * - * @param man Manager that this VN event belongs to. - * @param color Color to fade to/from. - * @param fadeIn True to make the color go from 0 to 1 opacity. - * @param ease Easing function to use. - * @param duration How long does the fade take. - */ - VisualNovelFadeEvent( - VisualNovelManager *man, - struct Color color, - bool_t fadeIn, - easefunction_t *ease, - float_t duration - ); - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/events/animation/VisualNovelSimpleAnimationEvent.hpp" + +namespace Dawn { + class VisualNovelFadeEvent : public VisualNovelSimpleAnimationEvent { + protected: + struct Color color; + bool_t fadeIn; + float_t duration; + + void onStart(IVisualNovelEvent *previous) override; + + public: + /** + * Create a new visual novel event for fading the screen in/out. + * + * @param man Manager that this VN event belongs to. + * @param color Color to fade to/from. + * @param fadeIn True to make the color go from 0 to 1 opacity. + * @param ease Easing function to use. + * @param duration How long does the fade take. + */ + VisualNovelFadeEvent( + VisualNovelManager *man, + struct Color color, + bool_t fadeIn, + easefunction_t *ease, + float_t duration + ); + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/VisualNovelTextboxEvent.cpp b/src/dawn/games/visualnovel/events/VisualNovelTextboxEvent.cpp similarity index 96% rename from src/dawn/visualnovel/events/VisualNovelTextboxEvent.cpp rename to src/dawn/games/visualnovel/events/VisualNovelTextboxEvent.cpp index ce53d8d8..0f9366be 100644 --- a/src/dawn/visualnovel/events/VisualNovelTextboxEvent.cpp +++ b/src/dawn/games/visualnovel/events/VisualNovelTextboxEvent.cpp @@ -1,59 +1,59 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "VisualNovelTextboxEvent.hpp" - -using namespace Dawn; - -VisualNovelTextboxEvent::VisualNovelTextboxEvent( - VisualNovelManager *manager, - VisualNovelCharacter *character, - struct VisualNovelCharacterEmotion emotion, - std::string languageKey -) : IVisualNovelEvent(manager) { - this->character = character; - this->languageKey = languageKey; - this->emotion = emotion; -} - -VisualNovelTextboxEvent::VisualNovelTextboxEvent( - VisualNovelManager *manager, - std::string languageKey -) : IVisualNovelEvent(manager) { - this->character = nullptr; - this->languageKey = languageKey; -} - -void VisualNovelTextboxEvent::onStart(IVisualNovelEvent *previous) { - if(this->manager->textBox == nullptr) return; - - this->manager->textBox->setText(this->languageKey); - this->manager->textBox->setCharacter(this->character); - - if(this->character != nullptr) { - this->character->tiledSprite->setTile(this->emotion.tile); - } - - if(this->emotion.emotionSound != nullptr) { - if(this->manager->audioCharacter != nullptr) { - this->manager->audioCharacter->stop(); - this->manager->audioCharacter->loop = false; - this->manager->audioCharacter->setAudioData(this->emotion.emotionSound); - this->manager->audioCharacter->play(); - } - } else if(this->emotion.talkSound != nullptr) { - this->manager->textBox->setTalkingSound(this->emotion.talkSound); - } - - this->manager->textBox->show(); -} - -bool_t VisualNovelTextboxEvent::onUpdate() { - return this->manager->textBox->isVisible(); -} - -void VisualNovelTextboxEvent::onEnd() { - +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "VisualNovelTextboxEvent.hpp" + +using namespace Dawn; + +VisualNovelTextboxEvent::VisualNovelTextboxEvent( + VisualNovelManager *manager, + VisualNovelCharacter *character, + struct VisualNovelCharacterEmotion emotion, + std::string languageKey +) : IVisualNovelEvent(manager) { + this->character = character; + this->languageKey = languageKey; + this->emotion = emotion; +} + +VisualNovelTextboxEvent::VisualNovelTextboxEvent( + VisualNovelManager *manager, + std::string languageKey +) : IVisualNovelEvent(manager) { + this->character = nullptr; + this->languageKey = languageKey; +} + +void VisualNovelTextboxEvent::onStart(IVisualNovelEvent *previous) { + if(this->manager->textBox == nullptr) return; + + this->manager->textBox->setText(this->languageKey); + this->manager->textBox->setCharacter(this->character); + + if(this->character != nullptr) { + this->character->tiledSprite->setTile(this->emotion.tile); + } + + if(this->emotion.emotionSound != nullptr) { + if(this->manager->audioCharacter != nullptr) { + this->manager->audioCharacter->stop(); + this->manager->audioCharacter->loop = false; + this->manager->audioCharacter->setAudioData(this->emotion.emotionSound); + this->manager->audioCharacter->play(); + } + } else if(this->emotion.talkSound != nullptr) { + this->manager->textBox->setTalkingSound(this->emotion.talkSound); + } + + this->manager->textBox->show(); +} + +bool_t VisualNovelTextboxEvent::onUpdate() { + return this->manager->textBox->isVisible(); +} + +void VisualNovelTextboxEvent::onEnd() { + } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/VisualNovelTextboxEvent.hpp b/src/dawn/games/visualnovel/events/VisualNovelTextboxEvent.hpp similarity index 96% rename from src/dawn/visualnovel/events/VisualNovelTextboxEvent.hpp rename to src/dawn/games/visualnovel/events/VisualNovelTextboxEvent.hpp index 21602ef1..ec2b466c 100644 --- a/src/dawn/visualnovel/events/VisualNovelTextboxEvent.hpp +++ b/src/dawn/games/visualnovel/events/VisualNovelTextboxEvent.hpp @@ -1,42 +1,42 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/VisualNovelManager.hpp" -#include "visualnovel/components/VisualNovelCharacter.hpp" - -namespace Dawn { - class VisualNovelTextboxEvent : public IVisualNovelEvent { - protected: - std::string languageKey; - VisualNovelCharacter *character; - struct VisualNovelCharacterEmotion emotion; - - void onStart(IVisualNovelEvent *previous) override; - bool_t onUpdate() override; - void onEnd() override; - - public: - /** - * Create a new Textbox Event. This will queue a conversation item for the - * textbox to display. - * - * @param manager Visual Novel Manager instance for this event. - * @param character Character that is intended to be speaking. - * @param languageKey Language Key to talk. - */ - VisualNovelTextboxEvent( - VisualNovelManager *manager, - VisualNovelCharacter *character, - struct VisualNovelCharacterEmotion emotion, - std::string languageKey - ); - - VisualNovelTextboxEvent( - VisualNovelManager *manager, - std::string languageKey - ); - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/VisualNovelManager.hpp" +#include "visualnovel/components/VisualNovelCharacter.hpp" + +namespace Dawn { + class VisualNovelTextboxEvent : public IVisualNovelEvent { + protected: + std::string languageKey; + VisualNovelCharacter *character; + struct VisualNovelCharacterEmotion emotion; + + void onStart(IVisualNovelEvent *previous) override; + bool_t onUpdate() override; + void onEnd() override; + + public: + /** + * Create a new Textbox Event. This will queue a conversation item for the + * textbox to display. + * + * @param manager Visual Novel Manager instance for this event. + * @param character Character that is intended to be speaking. + * @param languageKey Language Key to talk. + */ + VisualNovelTextboxEvent( + VisualNovelManager *manager, + VisualNovelCharacter *character, + struct VisualNovelCharacterEmotion emotion, + std::string languageKey + ); + + VisualNovelTextboxEvent( + VisualNovelManager *manager, + std::string languageKey + ); + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/animation/CMakeLists.txt b/src/dawn/games/visualnovel/events/animation/CMakeLists.txt similarity index 96% rename from src/dawn/visualnovel/events/animation/CMakeLists.txt rename to src/dawn/games/visualnovel/events/animation/CMakeLists.txt index 73cd7e52..39ae1c69 100644 --- a/src/dawn/visualnovel/events/animation/CMakeLists.txt +++ b/src/dawn/games/visualnovel/events/animation/CMakeLists.txt @@ -1,10 +1,10 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - VisualNovelAnimationEvent.cpp +# Copyright (c) 2022 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + VisualNovelAnimationEvent.cpp ) \ No newline at end of file diff --git a/src/dawn/visualnovel/events/animation/VisualNovelAnimationEvent.cpp b/src/dawn/games/visualnovel/events/animation/VisualNovelAnimationEvent.cpp similarity index 96% rename from src/dawn/visualnovel/events/animation/VisualNovelAnimationEvent.cpp rename to src/dawn/games/visualnovel/events/animation/VisualNovelAnimationEvent.cpp index 7a30322d..6c9d4f1c 100644 --- a/src/dawn/visualnovel/events/animation/VisualNovelAnimationEvent.cpp +++ b/src/dawn/games/visualnovel/events/animation/VisualNovelAnimationEvent.cpp @@ -1,27 +1,27 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "VisualNovelAnimationEvent.hpp" -#include "game/DawnGame.hpp" - -using namespace Dawn; - -VisualNovelAnimationEvent::VisualNovelAnimationEvent( - VisualNovelManager *manager -) : IVisualNovelEvent(manager) { -} - -void VisualNovelAnimationEvent::onStart(IVisualNovelEvent *previous) { - -} - -bool_t VisualNovelAnimationEvent::onUpdate() { - this->animation->tick(this->manager->getGame()->timeManager.delta); - return !this->animation->finished; -} - -void VisualNovelAnimationEvent::onEnd() { - +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "VisualNovelAnimationEvent.hpp" +#include "game/DawnGame.hpp" + +using namespace Dawn; + +VisualNovelAnimationEvent::VisualNovelAnimationEvent( + VisualNovelManager *manager +) : IVisualNovelEvent(manager) { +} + +void VisualNovelAnimationEvent::onStart(IVisualNovelEvent *previous) { + +} + +bool_t VisualNovelAnimationEvent::onUpdate() { + this->animation->tick(this->manager->getGame()->timeManager.delta); + return !this->animation->finished; +} + +void VisualNovelAnimationEvent::onEnd() { + } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/animation/VisualNovelAnimationEvent.hpp b/src/dawn/games/visualnovel/events/animation/VisualNovelAnimationEvent.hpp similarity index 96% rename from src/dawn/visualnovel/events/animation/VisualNovelAnimationEvent.hpp rename to src/dawn/games/visualnovel/events/animation/VisualNovelAnimationEvent.hpp index 36ecc495..213817c3 100644 --- a/src/dawn/visualnovel/events/animation/VisualNovelAnimationEvent.hpp +++ b/src/dawn/games/visualnovel/events/animation/VisualNovelAnimationEvent.hpp @@ -1,22 +1,22 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/VisualNovelManager.hpp" -#include "display/animation/Animation.hpp" - -namespace Dawn { - class VisualNovelAnimationEvent : public IVisualNovelEvent { - protected: - struct Animation *animation; - - void onStart(IVisualNovelEvent *previous) override; - bool_t onUpdate() override; - void onEnd() override; - - public: - VisualNovelAnimationEvent(VisualNovelManager *manager); - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/VisualNovelManager.hpp" +#include "display/animation/Animation.hpp" + +namespace Dawn { + class VisualNovelAnimationEvent : public IVisualNovelEvent { + protected: + struct Animation *animation; + + void onStart(IVisualNovelEvent *previous) override; + bool_t onUpdate() override; + void onEnd() override; + + public: + VisualNovelAnimationEvent(VisualNovelManager *manager); + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/animation/VisualNovelSimpleAnimationEvent.hpp b/src/dawn/games/visualnovel/events/animation/VisualNovelSimpleAnimationEvent.hpp similarity index 96% rename from src/dawn/visualnovel/events/animation/VisualNovelSimpleAnimationEvent.hpp rename to src/dawn/games/visualnovel/events/animation/VisualNovelSimpleAnimationEvent.hpp index 066d8b89..eb5ce109 100644 --- a/src/dawn/visualnovel/events/animation/VisualNovelSimpleAnimationEvent.hpp +++ b/src/dawn/games/visualnovel/events/animation/VisualNovelSimpleAnimationEvent.hpp @@ -1,26 +1,26 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "VisualNovelAnimationEvent.hpp" -#include "display/animation/SimpleAnimation.hpp" - -namespace Dawn { - template - class VisualNovelSimpleAnimationEvent : public VisualNovelAnimationEvent { - public: - struct SimpleAnimation simpleAnimation; - - VisualNovelSimpleAnimationEvent( - VisualNovelManager *man, - T *modifies - ) : - VisualNovelAnimationEvent(man), - simpleAnimation(modifies) - { - this->animation = &this->simpleAnimation; - } - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "VisualNovelAnimationEvent.hpp" +#include "display/animation/SimpleAnimation.hpp" + +namespace Dawn { + template + class VisualNovelSimpleAnimationEvent : public VisualNovelAnimationEvent { + public: + struct SimpleAnimation simpleAnimation; + + VisualNovelSimpleAnimationEvent( + VisualNovelManager *man, + T *modifies + ) : + VisualNovelAnimationEvent(man), + simpleAnimation(modifies) + { + this->animation = &this->simpleAnimation; + } + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/animation/VisualNovelSimpleCallbackAnimationEvent.hpp b/src/dawn/games/visualnovel/events/animation/VisualNovelSimpleCallbackAnimationEvent.hpp similarity index 96% rename from src/dawn/visualnovel/events/animation/VisualNovelSimpleCallbackAnimationEvent.hpp rename to src/dawn/games/visualnovel/events/animation/VisualNovelSimpleCallbackAnimationEvent.hpp index 658b77a3..1ebce40b 100644 --- a/src/dawn/visualnovel/events/animation/VisualNovelSimpleCallbackAnimationEvent.hpp +++ b/src/dawn/games/visualnovel/events/animation/VisualNovelSimpleCallbackAnimationEvent.hpp @@ -1,24 +1,24 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "VisualNovelAnimationEvent.hpp" -#include "display/animation/SimpleCallbackAnimation.hpp" - -namespace Dawn { - template - class VisualNovelSimpleCallbackAnimationEvent : - public VisualNovelAnimationEvent - { - public: - struct SimpleCallbackAnimation callbackAnimation; - - VisualNovelSimpleCallbackAnimationEvent(VisualNovelManager *man) : - VisualNovelAnimationEvent(man) - { - this->animation = &callbackAnimation; - } - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "VisualNovelAnimationEvent.hpp" +#include "display/animation/SimpleCallbackAnimation.hpp" + +namespace Dawn { + template + class VisualNovelSimpleCallbackAnimationEvent : + public VisualNovelAnimationEvent + { + public: + struct SimpleCallbackAnimation callbackAnimation; + + VisualNovelSimpleCallbackAnimationEvent(VisualNovelManager *man) : + VisualNovelAnimationEvent(man) + { + this->animation = &callbackAnimation; + } + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/characters/CMakeLists.txt b/src/dawn/games/visualnovel/events/characters/CMakeLists.txt similarity index 96% rename from src/dawn/visualnovel/events/characters/CMakeLists.txt rename to src/dawn/games/visualnovel/events/characters/CMakeLists.txt index 2a67eb44..6eb84fb3 100644 --- a/src/dawn/visualnovel/events/characters/CMakeLists.txt +++ b/src/dawn/games/visualnovel/events/characters/CMakeLists.txt @@ -1,11 +1,11 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - VisualNovelFadeCharacterEvent.cpp - VisualNovelTransformItemEvent.cpp +# Copyright (c) 2022 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + VisualNovelFadeCharacterEvent.cpp + VisualNovelTransformItemEvent.cpp ) \ No newline at end of file diff --git a/src/dawn/visualnovel/events/characters/VisualNovelFadeCharacterEvent.cpp b/src/dawn/games/visualnovel/events/characters/VisualNovelFadeCharacterEvent.cpp similarity index 96% rename from src/dawn/visualnovel/events/characters/VisualNovelFadeCharacterEvent.cpp rename to src/dawn/games/visualnovel/events/characters/VisualNovelFadeCharacterEvent.cpp index e8cb8d9e..b2d87b6d 100644 --- a/src/dawn/visualnovel/events/characters/VisualNovelFadeCharacterEvent.cpp +++ b/src/dawn/games/visualnovel/events/characters/VisualNovelFadeCharacterEvent.cpp @@ -1,28 +1,28 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "VisualNovelFadeCharacterEvent.hpp" - -using namespace Dawn; - -VisualNovelFadeCharacterEvent::VisualNovelFadeCharacterEvent( - VisualNovelManager *man, - VisualNovelCharacter *character, - bool_t fadeIn, - easefunction_t *ease, - float_t duration -) : VisualNovelSimpleAnimationEvent( - man, - &character->material->color.a -) { - this->simpleAnimation.easing = ease; - if(fadeIn) { - this->simpleAnimation.addKeyframe(0.0f, 0.0f); - this->simpleAnimation.addKeyframe(duration, 1.0f); - } else { - this->simpleAnimation.addKeyframe(0.0f, 1.0f); - this->simpleAnimation.addKeyframe(duration, 0.0f); - } +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "VisualNovelFadeCharacterEvent.hpp" + +using namespace Dawn; + +VisualNovelFadeCharacterEvent::VisualNovelFadeCharacterEvent( + VisualNovelManager *man, + VisualNovelCharacter *character, + bool_t fadeIn, + easefunction_t *ease, + float_t duration +) : VisualNovelSimpleAnimationEvent( + man, + &character->material->color.a +) { + this->simpleAnimation.easing = ease; + if(fadeIn) { + this->simpleAnimation.addKeyframe(0.0f, 0.0f); + this->simpleAnimation.addKeyframe(duration, 1.0f); + } else { + this->simpleAnimation.addKeyframe(0.0f, 1.0f); + this->simpleAnimation.addKeyframe(duration, 0.0f); + } } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/characters/VisualNovelFadeCharacterEvent.hpp b/src/dawn/games/visualnovel/events/characters/VisualNovelFadeCharacterEvent.hpp similarity index 96% rename from src/dawn/visualnovel/events/characters/VisualNovelFadeCharacterEvent.hpp rename to src/dawn/games/visualnovel/events/characters/VisualNovelFadeCharacterEvent.hpp index 6dbc6d52..50847fc4 100644 --- a/src/dawn/visualnovel/events/characters/VisualNovelFadeCharacterEvent.hpp +++ b/src/dawn/games/visualnovel/events/characters/VisualNovelFadeCharacterEvent.hpp @@ -1,24 +1,24 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/events/animation/VisualNovelSimpleAnimationEvent.hpp" -#include "visualnovel/components/VisualNovelCharacter.hpp" -#include "scene/components/display/Material.hpp" - -namespace Dawn { - class VisualNovelFadeCharacterEvent : - public VisualNovelSimpleAnimationEvent - { - public: - VisualNovelFadeCharacterEvent( - VisualNovelManager *man, - VisualNovelCharacter *character, - bool_t fadeIn, - easefunction_t *ease, - float_t duration - ); - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/events/animation/VisualNovelSimpleAnimationEvent.hpp" +#include "visualnovel/components/VisualNovelCharacter.hpp" +#include "scene/components/display/Material.hpp" + +namespace Dawn { + class VisualNovelFadeCharacterEvent : + public VisualNovelSimpleAnimationEvent + { + public: + VisualNovelFadeCharacterEvent( + VisualNovelManager *man, + VisualNovelCharacter *character, + bool_t fadeIn, + easefunction_t *ease, + float_t duration + ); + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/characters/VisualNovelTransformItemEvent.cpp b/src/dawn/games/visualnovel/events/characters/VisualNovelTransformItemEvent.cpp similarity index 96% rename from src/dawn/visualnovel/events/characters/VisualNovelTransformItemEvent.cpp rename to src/dawn/games/visualnovel/events/characters/VisualNovelTransformItemEvent.cpp index d122ea1d..f7a7b1b9 100644 --- a/src/dawn/visualnovel/events/characters/VisualNovelTransformItemEvent.cpp +++ b/src/dawn/games/visualnovel/events/characters/VisualNovelTransformItemEvent.cpp @@ -1,53 +1,53 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "VisualNovelTransformItemEvent.hpp" - -using namespace Dawn; - -VisualNovelTransformItemEvent::VisualNovelTransformItemEvent( - VisualNovelManager *man, - SceneItem *item, - glm::vec3 start, - glm::vec3 end, - easefunction_t *ease, - float_t duration -) : VisualNovelSimpleCallbackAnimationEvent(man) { - assertNotNull(item); - this->item = item; - - this->callbackAnimation.setCallback( - &item->transform, &Transform::setLocalPosition - ); - if(duration != 0) { - this->callbackAnimation.addKeyframe(0.0f, start); - } - this->callbackAnimation.addKeyframe(duration, end); -} - -VisualNovelTransformItemEvent::VisualNovelTransformItemEvent( - VisualNovelManager *man, - SceneItem *item, - glm::vec3 end, - easefunction_t *ease, - float_t duration -) : VisualNovelSimpleCallbackAnimationEvent(man) { - assertNotNull(item); - this->item = item; - - this->callbackAnimation.setCallback( - &item->transform, &Transform::setLocalPosition - ); - - if(duration != 0) this->relative = true; - this->callbackAnimation.addKeyframe(duration, end); -} - -void VisualNovelTransformItemEvent::onStart(IVisualNovelEvent *previous) { - if(this->relative) { - this->callbackAnimation.addKeyframe(0.0f, this->item->transform.getLocalPosition()); - } - VisualNovelSimpleCallbackAnimationEvent::onStart(previous); +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "VisualNovelTransformItemEvent.hpp" + +using namespace Dawn; + +VisualNovelTransformItemEvent::VisualNovelTransformItemEvent( + VisualNovelManager *man, + SceneItem *item, + glm::vec3 start, + glm::vec3 end, + easefunction_t *ease, + float_t duration +) : VisualNovelSimpleCallbackAnimationEvent(man) { + assertNotNull(item); + this->item = item; + + this->callbackAnimation.setCallback( + &item->transform, &Transform::setLocalPosition + ); + if(duration != 0) { + this->callbackAnimation.addKeyframe(0.0f, start); + } + this->callbackAnimation.addKeyframe(duration, end); +} + +VisualNovelTransformItemEvent::VisualNovelTransformItemEvent( + VisualNovelManager *man, + SceneItem *item, + glm::vec3 end, + easefunction_t *ease, + float_t duration +) : VisualNovelSimpleCallbackAnimationEvent(man) { + assertNotNull(item); + this->item = item; + + this->callbackAnimation.setCallback( + &item->transform, &Transform::setLocalPosition + ); + + if(duration != 0) this->relative = true; + this->callbackAnimation.addKeyframe(duration, end); +} + +void VisualNovelTransformItemEvent::onStart(IVisualNovelEvent *previous) { + if(this->relative) { + this->callbackAnimation.addKeyframe(0.0f, this->item->transform.getLocalPosition()); + } + VisualNovelSimpleCallbackAnimationEvent::onStart(previous); } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/characters/VisualNovelTransformItemEvent.hpp b/src/dawn/games/visualnovel/events/characters/VisualNovelTransformItemEvent.hpp similarity index 96% rename from src/dawn/visualnovel/events/characters/VisualNovelTransformItemEvent.hpp rename to src/dawn/games/visualnovel/events/characters/VisualNovelTransformItemEvent.hpp index 974d0bdc..ec67fedd 100644 --- a/src/dawn/visualnovel/events/characters/VisualNovelTransformItemEvent.hpp +++ b/src/dawn/games/visualnovel/events/characters/VisualNovelTransformItemEvent.hpp @@ -1,36 +1,36 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/events/animation/VisualNovelSimpleCallbackAnimationEvent.hpp" - -namespace Dawn { - class VisualNovelTransformItemEvent : - public VisualNovelSimpleCallbackAnimationEvent - { - protected: - bool_t relative = false; - SceneItem *item = nullptr; - void onStart(IVisualNovelEvent *previous) override; - - public: - VisualNovelTransformItemEvent( - VisualNovelManager *man, - SceneItem *item, - glm::vec3 start, - glm::vec3 end, - easefunction_t *ease, - float_t duration - ); - - VisualNovelTransformItemEvent( - VisualNovelManager *man, - SceneItem *item, - glm::vec3 end, - easefunction_t *ease, - float_t duration - ); - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/events/animation/VisualNovelSimpleCallbackAnimationEvent.hpp" + +namespace Dawn { + class VisualNovelTransformItemEvent : + public VisualNovelSimpleCallbackAnimationEvent + { + protected: + bool_t relative = false; + SceneItem *item = nullptr; + void onStart(IVisualNovelEvent *previous) override; + + public: + VisualNovelTransformItemEvent( + VisualNovelManager *man, + SceneItem *item, + glm::vec3 start, + glm::vec3 end, + easefunction_t *ease, + float_t duration + ); + + VisualNovelTransformItemEvent( + VisualNovelManager *man, + SceneItem *item, + glm::vec3 end, + easefunction_t *ease, + float_t duration + ); + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/timing/CMakeLists.txt b/src/dawn/games/visualnovel/events/timing/CMakeLists.txt similarity index 96% rename from src/dawn/visualnovel/events/timing/CMakeLists.txt rename to src/dawn/games/visualnovel/events/timing/CMakeLists.txt index c633123e..01af79ad 100644 --- a/src/dawn/visualnovel/events/timing/CMakeLists.txt +++ b/src/dawn/games/visualnovel/events/timing/CMakeLists.txt @@ -1,11 +1,11 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - VisualNovelBatchEvent.cpp - VisualNovelPauseEvent.cpp +# Copyright (c) 2022 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + VisualNovelBatchEvent.cpp + VisualNovelPauseEvent.cpp ) \ No newline at end of file diff --git a/src/dawn/visualnovel/events/timing/VisualNovelBatchEvent.cpp b/src/dawn/games/visualnovel/events/timing/VisualNovelBatchEvent.cpp similarity index 95% rename from src/dawn/visualnovel/events/timing/VisualNovelBatchEvent.cpp rename to src/dawn/games/visualnovel/events/timing/VisualNovelBatchEvent.cpp index 0c4e26e9..024ff300 100644 --- a/src/dawn/visualnovel/events/timing/VisualNovelBatchEvent.cpp +++ b/src/dawn/games/visualnovel/events/timing/VisualNovelBatchEvent.cpp @@ -1,66 +1,66 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "VisualNovelBatchEvent.hpp" - -using namespace Dawn; - -VisualNovelBatchEvent::VisualNovelBatchEvent( - VisualNovelManager *man, - std::vector events -) : IVisualNovelEvent(man) { - this->activeEvents = events; -} - -void VisualNovelBatchEvent::onStart(IVisualNovelEvent *previous) { - auto it = this->activeEvents.begin(); - while(it != this->activeEvents.end()) { - auto evt = *it; - evt->start(previous); - ++it; - } -} - -bool_t VisualNovelBatchEvent::onUpdate() { - bool_t result; - auto it = this->activeEvents.begin(); - while(it != this->activeEvents.end()) { - auto evt = *it; - result = evt->update(); - if(result) { - ++it; - continue; - } - - auto subNext = evt->end(); - - // In future I may remove this and instead immediately queue the next thing. - assertNull(subNext); - - it = this->activeEvents.erase(it); - this->inactiveEvents.push_back(evt); - } - return this->activeEvents.size() > 0; -} - -void VisualNovelBatchEvent::onEnd() { - -} - -VisualNovelBatchEvent::~VisualNovelBatchEvent() { - auto itActive = this->activeEvents.begin(); - while(itActive != this->activeEvents.end()) { - auto evt = *itActive; - delete evt; - ++itActive; - } - - auto itInactive = this->inactiveEvents.begin(); - while(itInactive != this->inactiveEvents.end()) { - auto evt = *itInactive; - delete evt; - ++itInactive; - } -} +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "VisualNovelBatchEvent.hpp" + +using namespace Dawn; + +VisualNovelBatchEvent::VisualNovelBatchEvent( + VisualNovelManager *man, + std::vector events +) : IVisualNovelEvent(man) { + this->activeEvents = events; +} + +void VisualNovelBatchEvent::onStart(IVisualNovelEvent *previous) { + auto it = this->activeEvents.begin(); + while(it != this->activeEvents.end()) { + auto evt = *it; + evt->start(previous); + ++it; + } +} + +bool_t VisualNovelBatchEvent::onUpdate() { + bool_t result; + auto it = this->activeEvents.begin(); + while(it != this->activeEvents.end()) { + auto evt = *it; + result = evt->update(); + if(result) { + ++it; + continue; + } + + auto subNext = evt->end(); + + // In future I may remove this and instead immediately queue the next thing. + assertNull(subNext); + + it = this->activeEvents.erase(it); + this->inactiveEvents.push_back(evt); + } + return this->activeEvents.size() > 0; +} + +void VisualNovelBatchEvent::onEnd() { + +} + +VisualNovelBatchEvent::~VisualNovelBatchEvent() { + auto itActive = this->activeEvents.begin(); + while(itActive != this->activeEvents.end()) { + auto evt = *itActive; + delete evt; + ++itActive; + } + + auto itInactive = this->inactiveEvents.begin(); + while(itInactive != this->inactiveEvents.end()) { + auto evt = *itInactive; + delete evt; + ++itInactive; + } +} diff --git a/src/dawn/visualnovel/events/timing/VisualNovelBatchEvent.hpp b/src/dawn/games/visualnovel/events/timing/VisualNovelBatchEvent.hpp similarity index 96% rename from src/dawn/visualnovel/events/timing/VisualNovelBatchEvent.hpp rename to src/dawn/games/visualnovel/events/timing/VisualNovelBatchEvent.hpp index 6699052e..c80f2cff 100644 --- a/src/dawn/visualnovel/events/timing/VisualNovelBatchEvent.hpp +++ b/src/dawn/games/visualnovel/events/timing/VisualNovelBatchEvent.hpp @@ -1,27 +1,27 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/VisualNovelManager.hpp" - -namespace Dawn { - class VisualNovelBatchEvent : public IVisualNovelEvent { - protected: - std::vector activeEvents; - std::vector inactiveEvents; - - void onStart(IVisualNovelEvent *previous) override; - bool_t onUpdate() override; - void onEnd() override; - - public: - VisualNovelBatchEvent( - VisualNovelManager *man, - std::vector events - ); - - ~VisualNovelBatchEvent(); - }; +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/VisualNovelManager.hpp" + +namespace Dawn { + class VisualNovelBatchEvent : public IVisualNovelEvent { + protected: + std::vector activeEvents; + std::vector inactiveEvents; + + void onStart(IVisualNovelEvent *previous) override; + bool_t onUpdate() override; + void onEnd() override; + + public: + VisualNovelBatchEvent( + VisualNovelManager *man, + std::vector events + ); + + ~VisualNovelBatchEvent(); + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/timing/VisualNovelPauseEvent.cpp b/src/dawn/games/visualnovel/events/timing/VisualNovelPauseEvent.cpp similarity index 96% rename from src/dawn/visualnovel/events/timing/VisualNovelPauseEvent.cpp rename to src/dawn/games/visualnovel/events/timing/VisualNovelPauseEvent.cpp index 14a1d501..785c85ff 100644 --- a/src/dawn/visualnovel/events/timing/VisualNovelPauseEvent.cpp +++ b/src/dawn/games/visualnovel/events/timing/VisualNovelPauseEvent.cpp @@ -1,28 +1,28 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "VisualNovelPauseEvent.hpp" -#include "game/DawnGame.hpp" - -using namespace Dawn; - -VisualNovelPauseEvent::VisualNovelPauseEvent( - VisualNovelManager *manager, float_t duration -) : IVisualNovelEvent(manager) { - this->duration = duration; -} - -void VisualNovelPauseEvent::onStart(IVisualNovelEvent *prev) { - this->time = 0; -} - -bool_t VisualNovelPauseEvent::onUpdate() { - this->time += this->manager->getGame()->timeManager.delta; - return this->time < this->duration; -} - -void VisualNovelPauseEvent::onEnd() { - +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "VisualNovelPauseEvent.hpp" +#include "game/DawnGame.hpp" + +using namespace Dawn; + +VisualNovelPauseEvent::VisualNovelPauseEvent( + VisualNovelManager *manager, float_t duration +) : IVisualNovelEvent(manager) { + this->duration = duration; +} + +void VisualNovelPauseEvent::onStart(IVisualNovelEvent *prev) { + this->time = 0; +} + +bool_t VisualNovelPauseEvent::onUpdate() { + this->time += this->manager->getGame()->timeManager.delta; + return this->time < this->duration; +} + +void VisualNovelPauseEvent::onEnd() { + } \ No newline at end of file diff --git a/src/dawn/visualnovel/events/timing/VisualNovelPauseEvent.hpp b/src/dawn/games/visualnovel/events/timing/VisualNovelPauseEvent.hpp similarity index 96% rename from src/dawn/visualnovel/events/timing/VisualNovelPauseEvent.hpp rename to src/dawn/games/visualnovel/events/timing/VisualNovelPauseEvent.hpp index 439e9e22..3f5624dc 100644 --- a/src/dawn/visualnovel/events/timing/VisualNovelPauseEvent.hpp +++ b/src/dawn/games/visualnovel/events/timing/VisualNovelPauseEvent.hpp @@ -1,28 +1,28 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "visualnovel/VisualNovelManager.hpp" - -namespace Dawn { - class VisualNovelPauseEvent : public IVisualNovelEvent { - protected: - float_t time; - float_t duration; - - void onStart(IVisualNovelEvent *previous) override; - bool_t onUpdate() override; - void onEnd() override; - - public: - /** - * Create a new Visual Novel Pause Event. - * - * @param manager Manager this event belongs to. - * @param duration Duration to pause for. - */ - VisualNovelPauseEvent(VisualNovelManager *manager, float_t duration); - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "visualnovel/VisualNovelManager.hpp" + +namespace Dawn { + class VisualNovelPauseEvent : public IVisualNovelEvent { + protected: + float_t time; + float_t duration; + + void onStart(IVisualNovelEvent *previous) override; + bool_t onUpdate() override; + void onEnd() override; + + public: + /** + * Create a new Visual Novel Pause Event. + * + * @param manager Manager this event belongs to. + * @param duration Duration to pause for. + */ + VisualNovelPauseEvent(VisualNovelManager *manager, float_t duration); + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/scene/CMakeLists.txt b/src/dawn/games/visualnovel/scene/CMakeLists.txt similarity index 95% rename from src/dawn/visualnovel/scene/CMakeLists.txt rename to src/dawn/games/visualnovel/scene/CMakeLists.txt index 7aa8a484..f8abc9a3 100644 --- a/src/dawn/visualnovel/scene/CMakeLists.txt +++ b/src/dawn/games/visualnovel/scene/CMakeLists.txt @@ -1,10 +1,10 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - SimpleVNScene.cpp +# Copyright (c) 2022 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + SimpleVNScene.cpp ) \ No newline at end of file diff --git a/src/dawn/visualnovel/scene/SimpleVNScene.cpp b/src/dawn/games/visualnovel/scene/SimpleVNScene.cpp similarity index 100% rename from src/dawn/visualnovel/scene/SimpleVNScene.cpp rename to src/dawn/games/visualnovel/scene/SimpleVNScene.cpp diff --git a/src/dawn/visualnovel/scene/SimpleVNScene.hpp b/src/dawn/games/visualnovel/scene/SimpleVNScene.hpp similarity index 100% rename from src/dawn/visualnovel/scene/SimpleVNScene.hpp rename to src/dawn/games/visualnovel/scene/SimpleVNScene.hpp diff --git a/src/dawn/visualnovel/ui/CMakeLists.txt b/src/dawn/games/visualnovel/ui/CMakeLists.txt similarity index 95% rename from src/dawn/visualnovel/ui/CMakeLists.txt rename to src/dawn/games/visualnovel/ui/CMakeLists.txt index 79d3bf82..68ff4be5 100644 --- a/src/dawn/visualnovel/ui/CMakeLists.txt +++ b/src/dawn/games/visualnovel/ui/CMakeLists.txt @@ -1,11 +1,11 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - VisualNovelFader.cpp - VisualNovelTextbox.cpp +# Copyright (c) 2022 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + VisualNovelFader.cpp + VisualNovelTextbox.cpp ) \ No newline at end of file diff --git a/src/dawn/visualnovel/ui/VisualNovelFader.cpp b/src/dawn/games/visualnovel/ui/VisualNovelFader.cpp similarity index 96% rename from src/dawn/visualnovel/ui/VisualNovelFader.cpp rename to src/dawn/games/visualnovel/ui/VisualNovelFader.cpp index 7127e814..aa870ae5 100644 --- a/src/dawn/visualnovel/ui/VisualNovelFader.cpp +++ b/src/dawn/games/visualnovel/ui/VisualNovelFader.cpp @@ -1,25 +1,25 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "VisualNovelFader.hpp" - -using namespace Dawn; - -VisualNovelFader::VisualNovelFader(UICanvas *canvas) : UISprite(canvas) { - -} - -VisualNovelFader * VisualNovelFader::create(UICanvas *canvas) { - assertNotNull(canvas); - - auto item = canvas->addElement(); - item->setTransform( - UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH, - glm::vec4(0, 0, 0, 0), - 0.0f - ); - item->color = COLOR_BLACK_TRANSPARENT; - return item; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "VisualNovelFader.hpp" + +using namespace Dawn; + +VisualNovelFader::VisualNovelFader(UICanvas *canvas) : UISprite(canvas) { + +} + +VisualNovelFader * VisualNovelFader::create(UICanvas *canvas) { + assertNotNull(canvas); + + auto item = canvas->addElement(); + item->setTransform( + UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH, + glm::vec4(0, 0, 0, 0), + 0.0f + ); + item->color = COLOR_BLACK_TRANSPARENT; + return item; } \ No newline at end of file diff --git a/src/dawn/visualnovel/ui/VisualNovelFader.hpp b/src/dawn/games/visualnovel/ui/VisualNovelFader.hpp similarity index 96% rename from src/dawn/visualnovel/ui/VisualNovelFader.hpp rename to src/dawn/games/visualnovel/ui/VisualNovelFader.hpp index 0b4f1d41..f534f52a 100644 --- a/src/dawn/visualnovel/ui/VisualNovelFader.hpp +++ b/src/dawn/games/visualnovel/ui/VisualNovelFader.hpp @@ -1,32 +1,32 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "ui/UISprite.hpp" -#include "ui/UIEmpty.hpp" - -namespace Dawn { - class VisualNovelFader : public UISprite { - private: - - public: - /** - * Quickly create a visual novel fader. - * - * @param canvas Canvas the fader belongs to. - * @return Created VN Fader. - */ - static VisualNovelFader * create(UICanvas *canvas); - - /** - * Construct a new Visual Novel Fader. VN Fader is just a sprite that is - * easily found by the VN Manager for the purpose of adding transitions to - * a VN scene. - * - * @param canvas Canvas for this component. - */ - VisualNovelFader(UICanvas *canvas); - }; +// Copyright (c) 2022 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "ui/UISprite.hpp" +#include "ui/UIEmpty.hpp" + +namespace Dawn { + class VisualNovelFader : public UISprite { + private: + + public: + /** + * Quickly create a visual novel fader. + * + * @param canvas Canvas the fader belongs to. + * @return Created VN Fader. + */ + static VisualNovelFader * create(UICanvas *canvas); + + /** + * Construct a new Visual Novel Fader. VN Fader is just a sprite that is + * easily found by the VN Manager for the purpose of adding transitions to + * a VN scene. + * + * @param canvas Canvas for this component. + */ + VisualNovelFader(UICanvas *canvas); + }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/ui/VisualNovelTextbox.cpp b/src/dawn/games/visualnovel/ui/VisualNovelTextbox.cpp similarity index 100% rename from src/dawn/visualnovel/ui/VisualNovelTextbox.cpp rename to src/dawn/games/visualnovel/ui/VisualNovelTextbox.cpp diff --git a/src/dawn/visualnovel/ui/VisualNovelTextbox.hpp b/src/dawn/games/visualnovel/ui/VisualNovelTextbox.hpp similarity index 100% rename from src/dawn/visualnovel/ui/VisualNovelTextbox.hpp rename to src/dawn/games/visualnovel/ui/VisualNovelTextbox.hpp diff --git a/src/dawntools/tools/CMakeLists.txt b/src/dawntools/tools/CMakeLists.txt index cc0a33ab..99e9a37d 100644 --- a/src/dawntools/tools/CMakeLists.txt +++ b/src/dawntools/tools/CMakeLists.txt @@ -6,10 +6,8 @@ add_subdirectory(texturegen) add_subdirectory(tilesetgen) add_subdirectory(truetypegen) -add_subdirectory(uigen) add_subdirectory(languagegen) add_subdirectory(generatedlanguages) -add_subdirectory(sceneitemcomponentregister) # Settings set(DAWN_TOOL_GENERATED_LANG_DIR "${DAWN_TEMP_DIR}/languages" CACHE INTERNAL ${DAWN_CACHE_TARGET}) @@ -106,38 +104,6 @@ if(DAWN_TARGET_OPENAL) endfunction() endif() -# Scene Item Component Tool -function(tool_scenecomponent clazz hfile) - # add_custom_target(${clazz}_scenecomponent - # COMMENT "Registering component ${hfile}::${clazz}" - # DEPENDS ${ARGN} - # ) - # set( - # DAWN_SCENE_ITEM_COMPONENT_LIST - # ${DAWN_SCENE_ITEM_COMPONENT_LIST} - # ${clazz} - # ${hfile} - # CACHE INTERNAL ${DAWN_CACHE_TARGET} - # ) - # file(CONFIGURE OUTPUT - # "${DAWN_TEMP_DIR}/SceneItemComponents.txt" - # CONTENT "${DAWN_SCENE_ITEM_COMPONENT_LIST}" - # ) - # if(NOT TARGET sceneitemcomponentgen_cmd) - # add_custom_target(sceneitemcomponentgen_cmd - # COMMAND sceneitemcomponentgen --input="${DAWN_TEMP_DIR}/SceneItemComponents.txt" --output="${DAWN_GENERATED_DIR}/scene/SceneItemComponentListItems.cpp" - # COMMENT "Generating scene item component ${hfile}::${clazz}" - # DEPENDS sceneitemcomponentgen - # ) - # # target_sources(${DAWN_TARGET_NAME} - # # PRIVATE - # # ${DAWN_GENERATED_DIR}/scene/SceneItemComponentListItems.cpp - # # ) - # endif() - # add_dependencies(sceneitemcomponentgen ${clazz}_scenecomponent) - # add_dependencies(${DAWN_TARGET_NAME} ${clazz}_scenecomponent sceneitemcomponentgen sceneitemcomponentgen_cmd) -endfunction() - if(DAWN_VISUAL_NOVEL) add_subdirectory(vnscenegen)