Just breaking stuff

This commit is contained in:
2023-03-14 22:27:46 -07:00
parent 795e69237c
commit 09cb20271b
156 changed files with 4218 additions and 4389 deletions

View File

@ -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.

View File

@ -1,19 +1,3 @@
# Dawn Project # Dawn Project
Simple in code, complex in structure game engine for creating small, fast and Simple in code, complex in structure game engine for creating small, fast and
reusable games. 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
```

View File

@ -1,10 +1,10 @@
# Copyright (c) 2023 Dominic Masters # Copyright (c) 2023 Dominic Masters
# #
# This software is released under the MIT License. # This software is released under the MIT License.
# https://opensource.org/licenses/MIT # https://opensource.org/licenses/MIT
# Sources # Sources
target_sources(${DAWN_TARGET_NAME} target_sources(${DAWN_TARGET_NAME}
PRIVATE PRIVATE
PlayerController.cpp PlayerController.cpp
) )

View File

@ -1,35 +1,35 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#include "PlayerController.hpp" #include "PlayerController.hpp"
#include "game/DawnGame.hpp" #include "game/DawnGame.hpp"
using namespace Dawn; using namespace Dawn;
PlayerController::PlayerController(SceneItem *i) : SceneItemComponent(i) {} PlayerController::PlayerController(SceneItem *i) : SceneItemComponent(i) {}
void PlayerController::onSceneUpdate() { void PlayerController::onSceneUpdate() {
auto im = &getGame()->inputManager; auto im = &getGame()->inputManager;
auto delta = getGame()->timeManager.delta; auto delta = getGame()->timeManager.delta;
glm::vec2 iMove = im->getAxis2D( glm::vec2 iMove = im->getAxis2D(
INPUT_BIND_NEGATIVE_X, INPUT_BIND_POSITIVE_X, INPUT_BIND_NEGATIVE_X, INPUT_BIND_POSITIVE_X,
INPUT_BIND_NEGATIVE_Y, INPUT_BIND_POSITIVE_Y INPUT_BIND_NEGATIVE_Y, INPUT_BIND_POSITIVE_Y
); );
glm::vec2 pos = this->transform->getLocalPosition(); glm::vec2 pos = this->transform->getLocalPosition();
this->transform->setLocalPosition( this->transform->setLocalPosition(
this->transform->getLocalPosition() + glm::vec3(iMove * delta * 20.0f, 0) this->transform->getLocalPosition() + glm::vec3(iMove * delta * 20.0f, 0)
); );
} }
void PlayerController::onStart() { void PlayerController::onStart() {
assertNotNull(this->camera); assertNotNull(this->camera);
getScene()->eventSceneUnpausedUpdate.addListener(this, &PlayerController::onSceneUpdate); getScene()->eventSceneUnpausedUpdate.addListener(this, &PlayerController::onSceneUpdate);
} }
PlayerController::~PlayerController() { PlayerController::~PlayerController() {
getScene()->eventSceneUnpausedUpdate.removeListener(this, &PlayerController::onSceneUpdate); getScene()->eventSceneUnpausedUpdate.removeListener(this, &PlayerController::onSceneUpdate);
} }

View File

@ -1,23 +1,23 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "scene/components/Components.hpp" #include "scene/components/Components.hpp"
namespace Dawn { namespace Dawn {
class PlayerController : public SceneItemComponent { class PlayerController : public SceneItemComponent {
protected: protected:
void onSceneUpdate(); void onSceneUpdate();
public: public:
Camera *camera = nullptr; Camera *camera = nullptr;
PlayerController(SceneItem *item); PlayerController(SceneItem *item);
void onStart() override; void onStart() override;
~PlayerController(); ~PlayerController();
}; };
} }

View File

@ -1,40 +1,40 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#include "DawnGame.hpp" #include "DawnGame.hpp"
#include "scenes/TestScene.hpp" #include "scenes/TestScene.hpp"
using namespace Dawn; using namespace Dawn;
DawnGame::DawnGame(DawnHost *host) : DawnGame::DawnGame(DawnHost *host) :
host(host), host(host),
renderManager(this), renderManager(this),
inputManager(this), inputManager(this),
localeManager(this), localeManager(this),
saveManager(this) saveManager(this)
{ {
} }
int32_t DawnGame::init() { int32_t DawnGame::init() {
this->assetManager.init(); this->assetManager.init();
this->localeManager.init(); this->localeManager.init();
this->renderManager.init(); this->renderManager.init();
this->scene = new TestScene(this); this->scene = new TestScene(this);
return DAWN_GAME_INIT_RESULT_SUCCESS; return DAWN_GAME_INIT_RESULT_SUCCESS;
} }
int32_t DawnGame::update(float_t delta) { int32_t DawnGame::update(float_t delta) {
this->assetManager.update(); this->assetManager.update();
this->inputManager.update(); this->inputManager.update();
this->timeManager.update(delta); this->timeManager.update(delta);
if(this->scene != nullptr) this->scene->update(); if(this->scene != nullptr) this->scene->update();
this->renderManager.update(); this->renderManager.update();
return DAWN_GAME_UPDATE_RESULT_SUCCESS; return DAWN_GAME_UPDATE_RESULT_SUCCESS;
} }

View File

@ -1,27 +1,27 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "game/_DawnGame.hpp" #include "game/_DawnGame.hpp"
#include "scene/components/Components.hpp" #include "scene/components/Components.hpp"
#include "save/DawnGameSaveManager.hpp" #include "save/DawnGameSaveManager.hpp"
namespace Dawn { namespace Dawn {
class DawnGame : public IDawnGame { class DawnGame : public IDawnGame {
public: public:
DawnHost *host; DawnHost *host;
RenderManager renderManager; RenderManager renderManager;
AssetManager assetManager; AssetManager assetManager;
InputManager inputManager; InputManager inputManager;
TimeManager timeManager; TimeManager timeManager;
LocaleManager localeManager; LocaleManager localeManager;
DawnGameSaveManager saveManager; DawnGameSaveManager saveManager;
PhysicsManager physicsManager; PhysicsManager physicsManager;
DawnGame(DawnHost *host); DawnGame(DawnHost *host);
int32_t init() override; int32_t init() override;
int32_t update(float_t delta) override; int32_t update(float_t delta) override;
}; };
} }

View File

@ -1,14 +1,14 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "input/InputManager.hpp" #include "input/InputManager.hpp"
#define INPUT_BIND(n) ((inputbind_t)n) #define INPUT_BIND(n) ((inputbind_t)n)
#define INPUT_BIND_ACCEPT INPUT_BIND(1) #define INPUT_BIND_ACCEPT INPUT_BIND(1)
#define INPUT_BIND_NEGATIVE_X INPUT_BIND(2) #define INPUT_BIND_NEGATIVE_X INPUT_BIND(2)
#define INPUT_BIND_POSITIVE_X INPUT_BIND(3) #define INPUT_BIND_POSITIVE_X INPUT_BIND(3)
#define INPUT_BIND_NEGATIVE_Y INPUT_BIND(4) #define INPUT_BIND_NEGATIVE_Y INPUT_BIND(4)
#define INPUT_BIND_POSITIVE_Y INPUT_BIND(5) #define INPUT_BIND_POSITIVE_Y INPUT_BIND(5)

View File

@ -1,46 +1,46 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "prefab/SceneItemPrefab.hpp" #include "prefab/SceneItemPrefab.hpp"
#include "scene/components/Components.hpp" #include "scene/components/Components.hpp"
#include "components/PlayerController.hpp" #include "components/PlayerController.hpp"
namespace Dawn { namespace Dawn {
class PlayerPrefab : public SceneItemPrefab<PlayerPrefab> { class PlayerPrefab : public SceneItemPrefab<PlayerPrefab> {
public: public:
static std::vector<Asset*> prefabAssets(AssetManager *man) { static std::vector<Asset*> prefabAssets(AssetManager *man) {
std::vector<Asset*> assets; std::vector<Asset*> assets;
assets.push_back(man->get<TilesetAsset>("tileset_aqua")); assets.push_back(man->get<TilesetAsset>("tileset_aqua"));
assets.push_back(man->get<TextureAsset>("texture_aqua")); assets.push_back(man->get<TextureAsset>("texture_aqua"));
return assets; return assets;
} }
// //
MeshHost *meshHost; MeshHost *meshHost;
TiledSprite *tiledSprite; TiledSprite *tiledSprite;
Material *material; Material *material;
MeshRenderer *meshRenderer; MeshRenderer *meshRenderer;
PlayerController *playerController; PlayerController *playerController;
PlayerPrefab(Scene *s, sceneitemid_t i) : SceneItemPrefab(s, i) {} PlayerPrefab(Scene *s, sceneitemid_t i) : SceneItemPrefab(s, i) {}
void prefabInit(AssetManager *man) override { void prefabInit(AssetManager *man) override {
auto tileset = man->get<TilesetAsset>("tileset_aqua"); auto tileset = man->get<TilesetAsset>("tileset_aqua");
auto texture = man->get<TextureAsset>("texture_aqua"); auto texture = man->get<TextureAsset>("texture_aqua");
meshHost = addComponent<MeshHost>(); meshHost = addComponent<MeshHost>();
tiledSprite = addComponent<TiledSprite>(); tiledSprite = addComponent<TiledSprite>();
material = addComponent<Material>(); material = addComponent<Material>();
meshRenderer = addComponent<MeshRenderer>(); meshRenderer = addComponent<MeshRenderer>();
playerController = addComponent<PlayerController>(); playerController = addComponent<PlayerController>();
tiledSprite->setTilesetAndSize(&tileset->tileset); tiledSprite->setTilesetAndSize(&tileset->tileset);
tiledSprite->setTile(896); tiledSprite->setTile(896);
material->textureValues[material->getShader()->getParameterByName("u_Text")] = &texture->texture; material->textureValues[material->getShader()->getParameterByName("u_Text")] = &texture->texture;
} }
}; };
} }

View File

@ -1,10 +1,10 @@
# Copyright (c) 2022 Dominic Masters # Copyright (c) 2022 Dominic Masters
# #
# This software is released under the MIT License. # This software is released under the MIT License.
# https://opensource.org/licenses/MIT # https://opensource.org/licenses/MIT
# Sources # Sources
target_sources(${DAWN_TARGET_NAME} target_sources(${DAWN_TARGET_NAME}
PRIVATE PRIVATE
DawnGameSaveManager.cpp DawnGameSaveManager.cpp
) )

View File

@ -1,28 +1,28 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#include "DawnGameSaveManager.hpp" #include "DawnGameSaveManager.hpp"
using namespace Dawn; using namespace Dawn;
DawnGameSaveManager::DawnGameSaveManager(DawnGame *game) : SaveManager(game) { DawnGameSaveManager::DawnGameSaveManager(DawnGame *game) : SaveManager(game) {
} }
bool_t DawnGameSaveManager::validateSave(struct SaveFile raw) { bool_t DawnGameSaveManager::validateSave(struct SaveFile raw) {
if(!raw.has(POKER_SAVE_KEY_EXAMPLE)) return true; if(!raw.has(POKER_SAVE_KEY_EXAMPLE)) return true;
this->currentSave.copy(raw, POKER_SAVE_KEY_EXAMPLE); this->currentSave.copy(raw, POKER_SAVE_KEY_EXAMPLE);
return false; return false;
} }
void DawnGameSaveManager::setExample(int32_t val) { void DawnGameSaveManager::setExample(int32_t val) {
savedata_t value; savedata_t value;
value.i32 = val; value.i32 = val;
this->currentSave.set(POKER_SAVE_KEY_EXAMPLE, value); this->currentSave.set(POKER_SAVE_KEY_EXAMPLE, value);
} }
int32_t DawnGameSaveManager::getExample() { int32_t DawnGameSaveManager::getExample() {
return this->currentSave.get(POKER_SAVE_KEY_EXAMPLE).i32; return this->currentSave.get(POKER_SAVE_KEY_EXAMPLE).i32;
} }

View File

@ -1,22 +1,22 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "save/SaveManager.hpp" #include "save/SaveManager.hpp"
#define POKER_SAVE_KEY_EXAMPLE "poker.example" #define POKER_SAVE_KEY_EXAMPLE "poker.example"
namespace Dawn { namespace Dawn {
class DawnGameSaveManager : public SaveManager { class DawnGameSaveManager : public SaveManager {
protected: protected:
virtual bool_t validateSave(struct SaveFile raw) override; virtual bool_t validateSave(struct SaveFile raw) override;
public: public:
DawnGameSaveManager(DawnGame *game); DawnGameSaveManager(DawnGame *game);
void setExample(int32_t value); void setExample(int32_t value);
int32_t getExample(); int32_t getExample();
}; };
} }

View File

@ -1,33 +1,33 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "scene/Scene.hpp" #include "scene/Scene.hpp"
#include "prefabs/PlayerPrefab.hpp" #include "prefabs/PlayerPrefab.hpp"
namespace Dawn { namespace Dawn {
class TestScene : public Scene { class TestScene : public Scene {
protected: protected:
void stage() override { void stage() override {
auto camera = Camera::create(this); auto camera = Camera::create(this);
camera->type = CAMERA_TYPE_ORTHONOGRAPHIC; camera->type = CAMERA_TYPE_ORTHONOGRAPHIC;
camera->item->addComponent<PixelPerfectCamera>(); camera->item->addComponent<PixelPerfectCamera>();
camera->transform->lookAt(glm::vec3(0, 0, 10), glm::vec3(0, 0, 0)); camera->transform->lookAt(glm::vec3(0, 0, 10), glm::vec3(0, 0, 0));
auto player = PlayerPrefab::create(this); auto player = PlayerPrefab::create(this);
player->playerController->camera = camera; player->playerController->camera = camera;
} }
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
auto assMan = &this->game->assetManager; auto assMan = &this->game->assetManager;
std::vector<Asset*> assets; std::vector<Asset*> assets;
vectorAppend(&assets, PlayerPrefab::getRequiredAssets(assMan)); vectorAppend(&assets, PlayerPrefab::getRequiredAssets(assMan));
return assets; return assets;
} }
public: public:
TestScene(DawnGame *game) : Scene(game) {} TestScene(DawnGame *game) : Scene(game) {}
}; };
} }

View File

@ -1,10 +1,10 @@
# Copyright (c) 2022 Dominic Masters # Copyright (c) 2022 Dominic Masters
# #
# This software is released under the MIT License. # This software is released under the MIT License.
# https://opensource.org/licenses/MIT # https://opensource.org/licenses/MIT
# Sources # Sources
target_sources(${DAWN_TARGET_NAME} target_sources(${DAWN_TARGET_NAME}
PRIVATE PRIVATE
DawnGame.cpp DawnGame.cpp
) )

View File

@ -1,31 +1,31 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "game/_DawnGame.hpp" #include "game/_DawnGame.hpp"
#include "scene/components/Components.hpp" #include "scene/components/Components.hpp"
#include "save/PokerSaveManager.hpp" #include "save/PokerSaveManager.hpp"
namespace Dawn { namespace Dawn {
class DawnGame : public IDawnGame { class DawnGame : public IDawnGame {
private: private:
Scene *sceneToCutTo = nullptr; Scene *sceneToCutTo = nullptr;
public: public:
DawnHost *host; DawnHost *host;
RenderManager renderManager; RenderManager renderManager;
AssetManager assetManager; AssetManager assetManager;
InputManager inputManager; InputManager inputManager;
TimeManager timeManager; TimeManager timeManager;
LocaleManager localeManager; LocaleManager localeManager;
PokerSaveManager saveManager; PokerSaveManager saveManager;
AudioManager audioManager; AudioManager audioManager;
DawnGame(DawnHost *host); DawnGame(DawnHost *host);
int32_t init() override; int32_t init() override;
int32_t update(float_t delta) override; int32_t update(float_t delta) override;
void sceneCutover(Scene *scene) override; void sceneCutover(Scene *scene) override;
}; };
} }

View File

@ -1,15 +1,15 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "input/InputManager.hpp" #include "input/InputManager.hpp"
#define dbind(n) ((inputbind_t)n) #define dbind(n) ((inputbind_t)n)
#define INPUT_BIND_ACCEPT dbind(1) #define INPUT_BIND_ACCEPT dbind(1)
#define INPUT_BIND_NEGATIVE_X dbind(2) #define INPUT_BIND_NEGATIVE_X dbind(2)
#define INPUT_BIND_POSITIVE_X dbind(3) #define INPUT_BIND_POSITIVE_X dbind(3)
#define INPUT_BIND_NEGATIVE_Y dbind(4) #define INPUT_BIND_NEGATIVE_Y dbind(4)
#define INPUT_BIND_POSITIVE_Y dbind(5) #define INPUT_BIND_POSITIVE_Y dbind(5)

View File

@ -1,6 +1,6 @@
# Copyright (c) 2022 Dominic Masters # Copyright (c) 2022 Dominic Masters
# #
# This software is released under the MIT License. # This software is released under the MIT License.
# https://opensource.org/licenses/MIT # https://opensource.org/licenses/MIT
add_subdirectory(characters) add_subdirectory(characters)

View File

@ -1,11 +1,11 @@
# Copyright (c) 2023 Dominic Masters # Copyright (c) 2023 Dominic Masters
# #
# This software is released under the MIT License. # This software is released under the MIT License.
# https://opensource.org/licenses/MIT # https://opensource.org/licenses/MIT
# Sources # Sources
target_sources(${DAWN_TARGET_NAME} target_sources(${DAWN_TARGET_NAME}
PRIVATE PRIVATE
CharacterPrefab.cpp CharacterPrefab.cpp
DeathPrefab.cpp DeathPrefab.cpp
) )

View File

@ -1,8 +1,8 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#include "CharacterPrefab.hpp" #include "CharacterPrefab.hpp"
using namespace Dawn; using namespace Dawn;

View File

@ -1,82 +1,82 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "prefab/SceneItemPrefab.hpp" #include "prefab/SceneItemPrefab.hpp"
#include "scene/Scene.hpp" #include "scene/Scene.hpp"
#include "scene/components/display/MeshRenderer.hpp" #include "scene/components/display/MeshRenderer.hpp"
#include "scene/components/display/AnimationController.hpp" #include "scene/components/display/AnimationController.hpp"
#include "scene/components/display/MeshHost.hpp" #include "scene/components/display/MeshHost.hpp"
#include "scene/components/display/material/SimpleTexturedMaterial.hpp" #include "scene/components/display/material/SimpleTexturedMaterial.hpp"
#include "scene/components/audio/AudioSource.hpp" #include "scene/components/audio/AudioSource.hpp"
#include "visualnovel/components/VisualNovelCharacter.hpp" #include "visualnovel/components/VisualNovelCharacter.hpp"
namespace Dawn { namespace Dawn {
template<class O> template<class O>
class CharacterPrefab : public SceneItemPrefab<O> { class CharacterPrefab : public SceneItemPrefab<O> {
protected: protected:
/** /**
* Character Prefab will request you to initialize your characters' * Character Prefab will request you to initialize your characters'
* emotions here, including loading assets, * emotions here, including loading assets,
* *
* @return struct VisualNovelCharacterEmotion * @return struct VisualNovelCharacterEmotion
*/ */
virtual struct VisualNovelCharacterEmotion defineAndGetInitialEmotion( virtual struct VisualNovelCharacterEmotion defineAndGetInitialEmotion(
AssetManager *assMan AssetManager *assMan
) = 0; ) = 0;
public: public:
static std::vector<Asset*> prefabAssets(AssetManager *assMan) { static std::vector<Asset*> prefabAssets(AssetManager *assMan) {
return std::vector<Asset*>{ return std::vector<Asset*>{
assMan->get<TextureAsset>(O::getCharacterTexture()), assMan->get<TextureAsset>(O::getCharacterTexture()),
assMan->get<TilesetAsset>(O::getCharacterTileset()) assMan->get<TilesetAsset>(O::getCharacterTileset())
}; };
} }
// Instance // Instance
VisualNovelCharacter *vnCharacter; VisualNovelCharacter *vnCharacter;
AnimationController *animation; AnimationController *animation;
TextureAsset *characterTexture; TextureAsset *characterTexture;
TilesetAsset *characterTileset; TilesetAsset *characterTileset;
MeshRenderer *meshRenderer; MeshRenderer *meshRenderer;
MeshHost *meshHost; MeshHost *meshHost;
SimpleTexturedMaterial *material; SimpleTexturedMaterial *material;
TiledSprite *tiledSprite; TiledSprite *tiledSprite;
AudioSource *audioSource; AudioSource *audioSource;
CharacterPrefab(Scene *s, sceneitemid_t i) : SceneItemPrefab<O>(s, i) {} CharacterPrefab(Scene *s, sceneitemid_t i) : SceneItemPrefab<O>(s, i) {}
void prefabInit(AssetManager *man) override { void prefabInit(AssetManager *man) override {
characterTexture = man->get<TextureAsset>(O::getCharacterTexture()); characterTexture = man->get<TextureAsset>(O::getCharacterTexture());
characterTileset = man->get<TilesetAsset>(O::getCharacterTileset()); characterTileset = man->get<TilesetAsset>(O::getCharacterTileset());
// Emotions // Emotions
auto emotion = this->defineAndGetInitialEmotion(man); auto emotion = this->defineAndGetInitialEmotion(man);
// Components // Components
meshRenderer = this->template addComponent<MeshRenderer>(); meshRenderer = this->template addComponent<MeshRenderer>();
meshHost = this->template addComponent<MeshHost>(); meshHost = this->template addComponent<MeshHost>();
material = this->template addComponent<SimpleTexturedMaterial>(); material = this->template addComponent<SimpleTexturedMaterial>();
material->texture = &characterTexture->texture; material->texture = &characterTexture->texture;
vnCharacter = this->template addComponent<VisualNovelCharacter>(); vnCharacter = this->template addComponent<VisualNovelCharacter>();
vnCharacter->nameKey = O::getLanguagePrefix() + ".name"; vnCharacter->nameKey = O::getLanguagePrefix() + ".name";
animation = this->template addComponent<AnimationController>(); animation = this->template addComponent<AnimationController>();
tiledSprite = this->template addComponent<TiledSprite>(); tiledSprite = this->template addComponent<TiledSprite>();
tiledSprite->setTileset(&characterTileset->tileset); tiledSprite->setTileset(&characterTileset->tileset);
float_t ratio = characterTileset->tileset.getTileWidth() / characterTileset->tileset.getTileHeight(); float_t ratio = characterTileset->tileset.getTileWidth() / characterTileset->tileset.getTileHeight();
tiledSprite->setSize(glm::vec2(ratio, 1.0f)); tiledSprite->setSize(glm::vec2(ratio, 1.0f));
tiledSprite->setTile(emotion.tile); tiledSprite->setTile(emotion.tile);
audioSource = this->template addComponent<AudioSource>(); audioSource = this->template addComponent<AudioSource>();
this->transform.setLocalPosition(glm::vec3(0, 0, 0)); this->transform.setLocalPosition(glm::vec3(0, 0, 0));
} }
}; };
} }

View File

@ -1,68 +1,68 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "prefab/SceneItemPrefab.hpp" #include "prefab/SceneItemPrefab.hpp"
#include "asset/AssetManager.hpp" #include "asset/AssetManager.hpp"
#include "poker/PokerPlayer.hpp" #include "poker/PokerPlayer.hpp"
#include "scene/components/Components.hpp" #include "scene/components/Components.hpp"
#include "visualnovel/components/VisualNovelCharacter.hpp" #include "visualnovel/components/VisualNovelCharacter.hpp"
#include "display/animation/TiledSpriteAnimation.hpp" #include "display/animation/TiledSpriteAnimation.hpp"
#include "scene/components/display/material/SimpleTexturedMaterial.hpp" #include "scene/components/display/material/SimpleTexturedMaterial.hpp"
namespace Dawn { namespace Dawn {
class PennyPrefab : public SceneItemPrefab<PennyPrefab> { class PennyPrefab : public SceneItemPrefab<PennyPrefab> {
public: public:
VisualNovelCharacter *vnCharacter; VisualNovelCharacter *vnCharacter;
PokerPlayer *pokerPlayer; PokerPlayer *pokerPlayer;
SimpleTexturedMaterial *material; SimpleTexturedMaterial *material;
struct VisualNovelCharacterEmotion emotionHappy; struct VisualNovelCharacterEmotion emotionHappy;
struct VisualNovelCharacterEmotion emotionSurprised; struct VisualNovelCharacterEmotion emotionSurprised;
struct VisualNovelCharacterEmotion emotionConcerned; struct VisualNovelCharacterEmotion emotionConcerned;
static std::vector<Asset*> prefabAssets(AssetManager *assMan) { static std::vector<Asset*> prefabAssets(AssetManager *assMan) {
return std::vector<Asset*>{ return std::vector<Asset*>{
assMan->get<TextureAsset>("texture_penny"), assMan->get<TextureAsset>("texture_penny"),
assMan->get<TilesetAsset>("tileset_penny") assMan->get<TilesetAsset>("tileset_penny")
}; };
} }
PennyPrefab(Scene *scene, sceneitemid_t id) : SceneItemPrefab(scene, id){} PennyPrefab(Scene *scene, sceneitemid_t id) : SceneItemPrefab(scene, id){}
void prefabInit(AssetManager *man) override { void prefabInit(AssetManager *man) override {
// Assets // Assets
auto textureAsset = man->get<TextureAsset>("texture_penny"); auto textureAsset = man->get<TextureAsset>("texture_penny");
auto tilesetAsset = man->get<TilesetAsset>("tileset_penny"); auto tilesetAsset = man->get<TilesetAsset>("tileset_penny");
// Emotions // Emotions
this->emotionHappy.tile = 0; this->emotionHappy.tile = 0;
this->emotionSurprised.tile = 1; this->emotionSurprised.tile = 1;
this->emotionConcerned.tile = 2; this->emotionConcerned.tile = 2;
// Components // Components
auto meshRenderer = this->addComponent<MeshRenderer>(); auto meshRenderer = this->addComponent<MeshRenderer>();
auto meshHost = this->addComponent<MeshHost>(); auto meshHost = this->addComponent<MeshHost>();
material = this->addComponent<SimpleTexturedMaterial>(); material = this->addComponent<SimpleTexturedMaterial>();
material->texture = &textureAsset->texture; material->texture = &textureAsset->texture;
auto animation = this->addComponent<AnimationController>(); auto animation = this->addComponent<AnimationController>();
pokerPlayer = this->addComponent<PokerPlayer>(); pokerPlayer = this->addComponent<PokerPlayer>();
vnCharacter = this->addComponent<VisualNovelCharacter>(); vnCharacter = this->addComponent<VisualNovelCharacter>();
vnCharacter->nameKey = "character.penny.name"; vnCharacter->nameKey = "character.penny.name";
auto tiledSprite = this->addComponent<TiledSprite>(); auto tiledSprite = this->addComponent<TiledSprite>();
tiledSprite->setTilesetAndSize(&tilesetAsset->tileset); tiledSprite->setTilesetAndSize(&tilesetAsset->tileset);
tiledSprite->setTile(0); tiledSprite->setTile(0);
this->transform.setLocalPosition(glm::vec3(0, 0, 0)); this->transform.setLocalPosition(glm::vec3(0, 0, 0));
} }
}; };
} }

View File

@ -1,25 +1,25 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "prefab/UIPrefab.hpp" #include "prefab/UIPrefab.hpp"
#include "ui/UIBorder.hpp" #include "ui/UIBorder.hpp"
namespace Dawn { namespace Dawn {
class UIBorderPrefab : public UIPrefab<UIBorder, UIBorderPrefab> { class UIBorderPrefab : public UIPrefab<UIBorder, UIBorderPrefab> {
public: public:
static std::vector<Asset*> prefabAssets(AssetManager *man) { static std::vector<Asset*> prefabAssets(AssetManager *man) {
std::vector<Asset*> assets; std::vector<Asset*> assets;
assets.push_back(man->get<TextureAsset>("texture_test")); assets.push_back(man->get<TextureAsset>("texture_test"));
return assets; return assets;
} }
static void prefabApply(AssetManager *man, UIBorder *border) { static void prefabApply(AssetManager *man, UIBorder *border) {
auto text = man->get<TextureAsset>("texture_test"); auto text = man->get<TextureAsset>("texture_test");
border->texture = &text->texture; border->texture = &text->texture;
border->setBorderSize(glm::vec2(4, 4)); border->setBorderSize(glm::vec2(4, 4));
} }
}; };
} }

View File

@ -1,10 +1,10 @@
# Copyright (c) 2022 Dominic Masters # Copyright (c) 2022 Dominic Masters
# #
# This software is released under the MIT License. # This software is released under the MIT License.
# https://opensource.org/licenses/MIT # https://opensource.org/licenses/MIT
# Sources # Sources
target_sources(${DAWN_TARGET_NAME} target_sources(${DAWN_TARGET_NAME}
PRIVATE PRIVATE
PokerSaveManager.cpp PokerSaveManager.cpp
) )

View File

@ -1,28 +1,28 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#include "PokerSaveManager.hpp" #include "PokerSaveManager.hpp"
using namespace Dawn; using namespace Dawn;
PokerSaveManager::PokerSaveManager(DawnGame *game) : SaveManager(game) { PokerSaveManager::PokerSaveManager(DawnGame *game) : SaveManager(game) {
} }
bool_t PokerSaveManager::validateSave(struct SaveFile raw) { bool_t PokerSaveManager::validateSave(struct SaveFile raw) {
if(!raw.has(POKER_SAVE_KEY_EXAMPLE)) return true; if(!raw.has(POKER_SAVE_KEY_EXAMPLE)) return true;
this->currentSave.copy(raw, POKER_SAVE_KEY_EXAMPLE); this->currentSave.copy(raw, POKER_SAVE_KEY_EXAMPLE);
return false; return false;
} }
void PokerSaveManager::setExample(int32_t val) { void PokerSaveManager::setExample(int32_t val) {
savedata_t value; savedata_t value;
value.i32 = val; value.i32 = val;
this->currentSave.set(POKER_SAVE_KEY_EXAMPLE, value); this->currentSave.set(POKER_SAVE_KEY_EXAMPLE, value);
} }
int32_t PokerSaveManager::getExample() { int32_t PokerSaveManager::getExample() {
return this->currentSave.get(POKER_SAVE_KEY_EXAMPLE).i32; return this->currentSave.get(POKER_SAVE_KEY_EXAMPLE).i32;
} }

View File

@ -1,22 +1,22 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "save/SaveManager.hpp" #include "save/SaveManager.hpp"
#define POKER_SAVE_KEY_EXAMPLE "poker.example" #define POKER_SAVE_KEY_EXAMPLE "poker.example"
namespace Dawn { namespace Dawn {
class PokerSaveManager : public SaveManager { class PokerSaveManager : public SaveManager {
protected: protected:
virtual bool_t validateSave(struct SaveFile raw) override; virtual bool_t validateSave(struct SaveFile raw) override;
public: public:
PokerSaveManager(DawnGame *game); PokerSaveManager(DawnGame *game);
void setExample(int32_t value); void setExample(int32_t value);
int32_t getExample(); int32_t getExample();
}; };
} }

View File

@ -1,10 +1,10 @@
# Copyright (c) 2022 Dominic Masters # Copyright (c) 2022 Dominic Masters
# #
# This software is released under the MIT License. # This software is released under the MIT License.
# https://opensource.org/licenses/MIT # https://opensource.org/licenses/MIT
# Sources # Sources
target_sources(${DAWN_TARGET_NAME} target_sources(${DAWN_TARGET_NAME}
PRIVATE PRIVATE
PokerVNScene.cpp PokerVNScene.cpp
) )

View File

@ -1,39 +1,39 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#include "PokerVNScene.hpp" #include "PokerVNScene.hpp"
using namespace Dawn; using namespace Dawn;
PokerVNScene::PokerVNScene(DawnGame *game) : SimpleVNScene(game) { PokerVNScene::PokerVNScene(DawnGame *game) : SimpleVNScene(game) {
} }
std::vector<Asset*> PokerVNScene::getRequiredAssets() { std::vector<Asset*> PokerVNScene::getRequiredAssets() {
auto assMan = &this->game->assetManager; auto assMan = &this->game->assetManager;
std::vector<Asset*> assets; std::vector<Asset*> assets;
vectorAppend(&assets, SimpleVNScene::getRequiredAssets()); vectorAppend(&assets, SimpleVNScene::getRequiredAssets());
vectorAppend(&assets, PokerPlayerDisplay::getAssets(assMan)); vectorAppend(&assets, PokerPlayerDisplay::getAssets(assMan));
return assets; return assets;
} }
void PokerVNScene::vnStage() { void PokerVNScene::vnStage() {
auto pokerGameItem = this->createSceneItem(); auto pokerGameItem = this->createSceneItem();
this->pokerGame = pokerGameItem->addComponent<PokerGame>(); this->pokerGame = pokerGameItem->addComponent<PokerGame>();
this->pokerPlayers = this->getPokerPlayers(); this->pokerPlayers = this->getPokerPlayers();
auto it = this->pokerPlayers.begin(); auto it = this->pokerPlayers.begin();
int32_t i = 0; int32_t i = 0;
while(it != this->pokerPlayers.end()) { while(it != this->pokerPlayers.end()) {
auto player = *it; auto player = *it;
// auto uiPlayer = canvas->addElement<PokerPlayerDisplay>(); // auto uiPlayer = canvas->addElement<PokerPlayerDisplay>();
// uiPlayer->setTransform(UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START, glm::vec4(i * 220, 0, 220, 200), 0); // uiPlayer->setTransform(UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START, glm::vec4(i * 220, 0, 220, 200), 0);
// uiPlayer->setPlayer(player); // uiPlayer->setPlayer(player);
++it; ++it;
++i; ++i;
} }
} }

View File

@ -1,39 +1,39 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "visualnovel/scene/SimpleVNScene.hpp" #include "visualnovel/scene/SimpleVNScene.hpp"
#include "poker/PokerGame.hpp" #include "poker/PokerGame.hpp"
#include "visualnovel/events/PokerBetLoopEvent.hpp" #include "visualnovel/events/PokerBetLoopEvent.hpp"
#include "visualnovel/events/PokerInitialEvent.hpp" #include "visualnovel/events/PokerInitialEvent.hpp"
#include "ui/PokerPlayerDisplay.hpp" #include "ui/PokerPlayerDisplay.hpp"
namespace Dawn { namespace Dawn {
class PokerVNScene : public SimpleVNScene { class PokerVNScene : public SimpleVNScene {
protected: protected:
void vnStage() override; void vnStage() override;
std::vector<Asset*> getRequiredAssets() override; std::vector<Asset*> getRequiredAssets() override;
/** /**
* Returns the Poker Players that are in this poker scene. * Returns the Poker Players that are in this poker scene.
* *
* @return List of Poker Players. * @return List of Poker Players.
*/ */
virtual std::vector<PokerPlayer*> getPokerPlayers() = 0; virtual std::vector<PokerPlayer*> getPokerPlayers() = 0;
public: public:
PokerGame *pokerGame; PokerGame *pokerGame;
std::vector<PokerPlayer*> pokerPlayers; std::vector<PokerPlayer*> pokerPlayers;
std::map<PokerPlayer*, PokerPlayerDisplay*> pokerPlayerDisplays; std::map<PokerPlayer*, PokerPlayerDisplay*> pokerPlayerDisplays;
/** /**
* Create a simple Poker Visual Novel Scene. Simplifies some of the less * Create a simple Poker Visual Novel Scene. Simplifies some of the less
* interesting parts of a poker VN game. * interesting parts of a poker VN game.
* *
* @param game Game that this poker scene belongs to. * @param game Game that this poker scene belongs to.
*/ */
PokerVNScene(DawnGame *game); PokerVNScene(DawnGame *game);
}; };
} }

View File

@ -1,45 +1,45 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "visualnovel/scene/SimpleVNScene.hpp" #include "visualnovel/scene/SimpleVNScene.hpp"
#include "scenes/Scene_11.hpp" #include "scenes/Scene_11.hpp"
namespace Dawn { namespace Dawn {
class Scene_10 : public SimpleVNScene { class Scene_10 : public SimpleVNScene {
protected: protected:
void vnStage() override { void vnStage() override {
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_11(this->game); auto scene = new Scene_11(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
public: public:
Scene_10(DawnGame *game) : SimpleVNScene(game) { Scene_10(DawnGame *game) : SimpleVNScene(game) {
} }
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets(); std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelPauseEvent(vnManager, 0.1f); auto start = new VisualNovelPauseEvent(vnManager, 0.1f);
start start
->then(new VisualNovelTextboxEvent(vnManager, "scene.10.1")) ->then(new VisualNovelTextboxEvent(vnManager, "scene.10.1"))
->then(new VisualNovelCallbackEvent<Scene_10>(vnManager, this, &Scene_10::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_10>(vnManager, this, &Scene_10::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,45 +1,45 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "visualnovel/scene/SimpleVNScene.hpp" #include "visualnovel/scene/SimpleVNScene.hpp"
#include "scenes/Scene_12.hpp" #include "scenes/Scene_12.hpp"
namespace Dawn { namespace Dawn {
class Scene_11 : public SimpleVNScene { class Scene_11 : public SimpleVNScene {
protected: protected:
void vnStage() override { void vnStage() override {
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_12(this->game); auto scene = new Scene_12(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
public: public:
Scene_11(DawnGame *game) : SimpleVNScene(game) { Scene_11(DawnGame *game) : SimpleVNScene(game) {
} }
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets(); std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelPauseEvent(vnManager, 0.1f); auto start = new VisualNovelPauseEvent(vnManager, 0.1f);
start start
->then(new VisualNovelTextboxEvent(vnManager, "scene.11.1")) ->then(new VisualNovelTextboxEvent(vnManager, "scene.11.1"))
->then(new VisualNovelCallbackEvent<Scene_11>(vnManager, this, &Scene_11::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_11>(vnManager, this, &Scene_11::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,66 +1,66 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "PokerVNScene.hpp" #include "PokerVNScene.hpp"
#include "prefabs/characters/PennyPrefab.hpp" #include "prefabs/characters/PennyPrefab.hpp"
#include "scenes/Scene_13.hpp" #include "scenes/Scene_13.hpp"
namespace Dawn { namespace Dawn {
class Scene_12 : public PokerVNScene { class Scene_12 : public PokerVNScene {
protected: protected:
PennyPrefab *penny; PennyPrefab *penny;
PennyPrefab *julie; PennyPrefab *julie;
PennyPrefab *sammy; PennyPrefab *sammy;
PennyPrefab *lucy; PennyPrefab *lucy;
void vnStage() override { void vnStage() override {
penny = PennyPrefab::create(this); penny = PennyPrefab::create(this);
julie = PennyPrefab::create(this); julie = PennyPrefab::create(this);
sammy = PennyPrefab::create(this); sammy = PennyPrefab::create(this);
lucy = PennyPrefab::create(this); lucy = PennyPrefab::create(this);
PokerVNScene::vnStage(); PokerVNScene::vnStage();
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_13(this->game); auto scene = new Scene_13(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
std::vector<PokerPlayer *> getPokerPlayers() override { std::vector<PokerPlayer *> getPokerPlayers() override {
return std::vector<PokerPlayer*>{ return std::vector<PokerPlayer*>{
this->penny->getComponent<PokerPlayer>(), this->penny->getComponent<PokerPlayer>(),
this->julie->getComponent<PokerPlayer>(), this->julie->getComponent<PokerPlayer>(),
this->sammy->getComponent<PokerPlayer>(), this->sammy->getComponent<PokerPlayer>(),
this->lucy->getComponent<PokerPlayer>() this->lucy->getComponent<PokerPlayer>()
}; };
} }
public: public:
Scene_12(DawnGame *game) : PokerVNScene(game) {} Scene_12(DawnGame *game) : PokerVNScene(game) {}
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
auto assMan = &this->game->assetManager; auto assMan = &this->game->assetManager;
std::vector<Asset*> assets; std::vector<Asset*> assets;
vectorAppend(&assets, PokerVNScene::getRequiredAssets()); vectorAppend(&assets, PokerVNScene::getRequiredAssets());
vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan)); vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan));
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelTextboxEvent(vnManager, "scene.12.1"); auto start = new VisualNovelTextboxEvent(vnManager, "scene.12.1");
start start
->then(new VisualNovelCallbackEvent<Scene_12>(vnManager, this, &Scene_12::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_12>(vnManager, this, &Scene_12::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,45 +1,45 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "visualnovel/scene/SimpleVNScene.hpp" #include "visualnovel/scene/SimpleVNScene.hpp"
#include "scenes/Scene_14.hpp" #include "scenes/Scene_14.hpp"
namespace Dawn { namespace Dawn {
class Scene_13 : public SimpleVNScene { class Scene_13 : public SimpleVNScene {
protected: protected:
void vnStage() override { void vnStage() override {
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_14(this->game); auto scene = new Scene_14(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
public: public:
Scene_13(DawnGame *game) : SimpleVNScene(game) { Scene_13(DawnGame *game) : SimpleVNScene(game) {
} }
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets(); std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelPauseEvent(vnManager, 0.1f); auto start = new VisualNovelPauseEvent(vnManager, 0.1f);
start start
->then(new VisualNovelTextboxEvent(vnManager, "scene.13.1")) ->then(new VisualNovelTextboxEvent(vnManager, "scene.13.1"))
->then(new VisualNovelCallbackEvent<Scene_13>(vnManager, this, &Scene_13::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_13>(vnManager, this, &Scene_13::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,45 +1,45 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "visualnovel/scene/SimpleVNScene.hpp" #include "visualnovel/scene/SimpleVNScene.hpp"
#include "scenes/Scene_15.hpp" #include "scenes/Scene_15.hpp"
namespace Dawn { namespace Dawn {
class Scene_14 : public SimpleVNScene { class Scene_14 : public SimpleVNScene {
protected: protected:
void vnStage() override { void vnStage() override {
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_15(this->game); auto scene = new Scene_15(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
public: public:
Scene_14(DawnGame *game) : SimpleVNScene(game) { Scene_14(DawnGame *game) : SimpleVNScene(game) {
} }
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets(); std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelPauseEvent(vnManager, 0.1f); auto start = new VisualNovelPauseEvent(vnManager, 0.1f);
start start
->then(new VisualNovelTextboxEvent(vnManager, "scene.14.1")) ->then(new VisualNovelTextboxEvent(vnManager, "scene.14.1"))
->then(new VisualNovelCallbackEvent<Scene_14>(vnManager, this, &Scene_14::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_14>(vnManager, this, &Scene_14::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,45 +1,45 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "visualnovel/scene/SimpleVNScene.hpp" #include "visualnovel/scene/SimpleVNScene.hpp"
#include "scenes/Scene_16.hpp" #include "scenes/Scene_16.hpp"
namespace Dawn { namespace Dawn {
class Scene_15 : public SimpleVNScene { class Scene_15 : public SimpleVNScene {
protected: protected:
void vnStage() override { void vnStage() override {
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_16(this->game); auto scene = new Scene_16(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
public: public:
Scene_15(DawnGame *game) : SimpleVNScene(game) { Scene_15(DawnGame *game) : SimpleVNScene(game) {
} }
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets(); std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelPauseEvent(vnManager, 0.1f); auto start = new VisualNovelPauseEvent(vnManager, 0.1f);
start start
->then(new VisualNovelTextboxEvent(vnManager, "scene.15.1")) ->then(new VisualNovelTextboxEvent(vnManager, "scene.15.1"))
->then(new VisualNovelCallbackEvent<Scene_15>(vnManager, this, &Scene_15::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_15>(vnManager, this, &Scene_15::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,45 +1,45 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "visualnovel/scene/SimpleVNScene.hpp" #include "visualnovel/scene/SimpleVNScene.hpp"
#include "scenes/Scene_17.hpp" #include "scenes/Scene_17.hpp"
namespace Dawn { namespace Dawn {
class Scene_16 : public SimpleVNScene { class Scene_16 : public SimpleVNScene {
protected: protected:
void vnStage() override { void vnStage() override {
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_17(this->game); auto scene = new Scene_17(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
public: public:
Scene_16(DawnGame *game) : SimpleVNScene(game) { Scene_16(DawnGame *game) : SimpleVNScene(game) {
} }
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets(); std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelPauseEvent(vnManager, 0.1f); auto start = new VisualNovelPauseEvent(vnManager, 0.1f);
start start
->then(new VisualNovelTextboxEvent(vnManager, "scene.16.1")) ->then(new VisualNovelTextboxEvent(vnManager, "scene.16.1"))
->then(new VisualNovelCallbackEvent<Scene_16>(vnManager, this, &Scene_16::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_16>(vnManager, this, &Scene_16::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,66 +1,66 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "PokerVNScene.hpp" #include "PokerVNScene.hpp"
#include "prefabs/characters/PennyPrefab.hpp" #include "prefabs/characters/PennyPrefab.hpp"
#include "scenes/Scene_18.hpp" #include "scenes/Scene_18.hpp"
namespace Dawn { namespace Dawn {
class Scene_17 : public PokerVNScene { class Scene_17 : public PokerVNScene {
protected: protected:
PennyPrefab *penny; PennyPrefab *penny;
PennyPrefab *julie; PennyPrefab *julie;
PennyPrefab *sammy; PennyPrefab *sammy;
PennyPrefab *lucy; PennyPrefab *lucy;
void vnStage() override { void vnStage() override {
penny = PennyPrefab::create(this); penny = PennyPrefab::create(this);
julie = PennyPrefab::create(this); julie = PennyPrefab::create(this);
sammy = PennyPrefab::create(this); sammy = PennyPrefab::create(this);
lucy = PennyPrefab::create(this); lucy = PennyPrefab::create(this);
PokerVNScene::vnStage(); PokerVNScene::vnStage();
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_18(this->game); auto scene = new Scene_18(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
std::vector<PokerPlayer *> getPokerPlayers() override { std::vector<PokerPlayer *> getPokerPlayers() override {
return std::vector<PokerPlayer*>{ return std::vector<PokerPlayer*>{
this->penny->getComponent<PokerPlayer>(), this->penny->getComponent<PokerPlayer>(),
this->julie->getComponent<PokerPlayer>(), this->julie->getComponent<PokerPlayer>(),
this->sammy->getComponent<PokerPlayer>(), this->sammy->getComponent<PokerPlayer>(),
this->lucy->getComponent<PokerPlayer>() this->lucy->getComponent<PokerPlayer>()
}; };
} }
public: public:
Scene_17(DawnGame *game) : PokerVNScene(game) {} Scene_17(DawnGame *game) : PokerVNScene(game) {}
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
auto assMan = &this->game->assetManager; auto assMan = &this->game->assetManager;
std::vector<Asset*> assets; std::vector<Asset*> assets;
vectorAppend(&assets, PokerVNScene::getRequiredAssets()); vectorAppend(&assets, PokerVNScene::getRequiredAssets());
vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan)); vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan));
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelTextboxEvent(vnManager, "scene.17.1"); auto start = new VisualNovelTextboxEvent(vnManager, "scene.17.1");
start start
->then(new VisualNovelCallbackEvent<Scene_17>(vnManager, this, &Scene_17::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_17>(vnManager, this, &Scene_17::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,37 +1,37 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "visualnovel/scene/SimpleVNScene.hpp" #include "visualnovel/scene/SimpleVNScene.hpp"
namespace Dawn { namespace Dawn {
class Scene_18 : public SimpleVNScene { class Scene_18 : public SimpleVNScene {
protected: protected:
void vnStage() override { void vnStage() override {
} }
void onSceneEnded() { void onSceneEnded() {
} }
public: public:
Scene_18(DawnGame *game) : SimpleVNScene(game) { Scene_18(DawnGame *game) : SimpleVNScene(game) {
} }
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets(); std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelPauseEvent(vnManager, 0.1f); auto start = new VisualNovelPauseEvent(vnManager, 0.1f);
start start
->then(new VisualNovelTextboxEvent(vnManager, "scene.18.1")) ->then(new VisualNovelTextboxEvent(vnManager, "scene.18.1"))
->then(new VisualNovelCallbackEvent<Scene_18>(vnManager, this, &Scene_18::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_18>(vnManager, this, &Scene_18::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,46 +1,46 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "visualnovel/scene/SimpleVNScene.hpp" #include "visualnovel/scene/SimpleVNScene.hpp"
#include "scenes/Scene_3.hpp" #include "scenes/Scene_3.hpp"
namespace Dawn { namespace Dawn {
class Scene_2 : public SimpleVNScene { class Scene_2 : public SimpleVNScene {
protected: protected:
void vnStage() override { void vnStage() override {
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_3(this->game); auto scene = new Scene_3(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
public: public:
Scene_2(DawnGame *game) : SimpleVNScene(game) { Scene_2(DawnGame *game) : SimpleVNScene(game) {
} }
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets(); std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelPauseEvent(vnManager, 0.1f); auto start = new VisualNovelPauseEvent(vnManager, 0.1f);
start start
->then(new VisualNovelTextboxEvent(vnManager, "scene.2.1")) ->then(new VisualNovelTextboxEvent(vnManager, "scene.2.1"))
->then(new VisualNovelCallbackEvent<Scene_2>(vnManager, this, &Scene_2::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_2>(vnManager, this, &Scene_2::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,46 +1,46 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "visualnovel/scene/SimpleVNScene.hpp" #include "visualnovel/scene/SimpleVNScene.hpp"
#include "scenes/Scene_4.hpp" #include "scenes/Scene_4.hpp"
namespace Dawn { namespace Dawn {
class Scene_3 : public SimpleVNScene { class Scene_3 : public SimpleVNScene {
protected: protected:
void vnStage() override { void vnStage() override {
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_4(this->game); auto scene = new Scene_4(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
public: public:
Scene_3(DawnGame *game) : SimpleVNScene(game) { Scene_3(DawnGame *game) : SimpleVNScene(game) {
} }
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets(); std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelPauseEvent(vnManager, 0.1f); auto start = new VisualNovelPauseEvent(vnManager, 0.1f);
start start
->then(new VisualNovelTextboxEvent(vnManager, "scene.3.1")) ->then(new VisualNovelTextboxEvent(vnManager, "scene.3.1"))
->then(new VisualNovelCallbackEvent<Scene_3>(vnManager, this, &Scene_3::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_3>(vnManager, this, &Scene_3::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,66 +1,66 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "PokerVNScene.hpp" #include "PokerVNScene.hpp"
#include "prefabs/characters/PennyPrefab.hpp" #include "prefabs/characters/PennyPrefab.hpp"
#include "scenes/Scene_5.hpp" #include "scenes/Scene_5.hpp"
namespace Dawn { namespace Dawn {
class Scene_4 : public PokerVNScene { class Scene_4 : public PokerVNScene {
protected: protected:
PennyPrefab *penny; PennyPrefab *penny;
PennyPrefab *julie; PennyPrefab *julie;
PennyPrefab *sammy; PennyPrefab *sammy;
PennyPrefab *lucy; PennyPrefab *lucy;
void vnStage() override { void vnStage() override {
penny = PennyPrefab::create(this); penny = PennyPrefab::create(this);
julie = PennyPrefab::create(this); julie = PennyPrefab::create(this);
sammy = PennyPrefab::create(this); sammy = PennyPrefab::create(this);
lucy = PennyPrefab::create(this); lucy = PennyPrefab::create(this);
PokerVNScene::vnStage(); PokerVNScene::vnStage();
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_5(this->game); auto scene = new Scene_5(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
std::vector<PokerPlayer *> getPokerPlayers() override { std::vector<PokerPlayer *> getPokerPlayers() override {
return std::vector<PokerPlayer*>{ return std::vector<PokerPlayer*>{
this->penny->getComponent<PokerPlayer>(), this->penny->getComponent<PokerPlayer>(),
this->julie->getComponent<PokerPlayer>(), this->julie->getComponent<PokerPlayer>(),
this->sammy->getComponent<PokerPlayer>(), this->sammy->getComponent<PokerPlayer>(),
this->lucy->getComponent<PokerPlayer>() this->lucy->getComponent<PokerPlayer>()
}; };
} }
public: public:
Scene_4(DawnGame *game) : PokerVNScene(game) {} Scene_4(DawnGame *game) : PokerVNScene(game) {}
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
auto assMan = &this->game->assetManager; auto assMan = &this->game->assetManager;
std::vector<Asset*> assets; std::vector<Asset*> assets;
vectorAppend(&assets, PokerVNScene::getRequiredAssets()); vectorAppend(&assets, PokerVNScene::getRequiredAssets());
vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan)); vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan));
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelTextboxEvent(vnManager, "scene.4.1"); auto start = new VisualNovelTextboxEvent(vnManager, "scene.4.1");
start start
->then(new VisualNovelCallbackEvent<Scene_4>(vnManager, this, &Scene_4::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_4>(vnManager, this, &Scene_4::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,46 +1,46 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "visualnovel/scene/SimpleVNScene.hpp" #include "visualnovel/scene/SimpleVNScene.hpp"
#include "scenes/Scene_6.hpp" #include "scenes/Scene_6.hpp"
namespace Dawn { namespace Dawn {
class Scene_5 : public SimpleVNScene { class Scene_5 : public SimpleVNScene {
protected: protected:
void vnStage() override { void vnStage() override {
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_6(this->game); auto scene = new Scene_6(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
public: public:
Scene_5(DawnGame *game) : SimpleVNScene(game) { Scene_5(DawnGame *game) : SimpleVNScene(game) {
} }
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets(); std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelPauseEvent(vnManager, 0.1f); auto start = new VisualNovelPauseEvent(vnManager, 0.1f);
start start
->then(new VisualNovelTextboxEvent(vnManager, "scene.5.1")) ->then(new VisualNovelTextboxEvent(vnManager, "scene.5.1"))
->then(new VisualNovelCallbackEvent<Scene_5>(vnManager, this, &Scene_5::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_5>(vnManager, this, &Scene_5::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,46 +1,46 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "visualnovel/scene/SimpleVNScene.hpp" #include "visualnovel/scene/SimpleVNScene.hpp"
#include "scenes/Scene_7.hpp" #include "scenes/Scene_7.hpp"
namespace Dawn { namespace Dawn {
class Scene_6 : public SimpleVNScene { class Scene_6 : public SimpleVNScene {
protected: protected:
void vnStage() override { void vnStage() override {
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_7(this->game); auto scene = new Scene_7(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
public: public:
Scene_6(DawnGame *game) : SimpleVNScene(game) { Scene_6(DawnGame *game) : SimpleVNScene(game) {
} }
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets(); std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelPauseEvent(vnManager, 0.1f); auto start = new VisualNovelPauseEvent(vnManager, 0.1f);
start start
->then(new VisualNovelTextboxEvent(vnManager, "scene.6.1")) ->then(new VisualNovelTextboxEvent(vnManager, "scene.6.1"))
->then(new VisualNovelCallbackEvent<Scene_6>(vnManager, this, &Scene_6::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_6>(vnManager, this, &Scene_6::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,45 +1,45 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "visualnovel/scene/SimpleVNScene.hpp" #include "visualnovel/scene/SimpleVNScene.hpp"
#include "scenes/Scene_8.hpp" #include "scenes/Scene_8.hpp"
namespace Dawn { namespace Dawn {
class Scene_7 : public SimpleVNScene { class Scene_7 : public SimpleVNScene {
protected: protected:
void vnStage() override { void vnStage() override {
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_8(this->game); auto scene = new Scene_8(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
public: public:
Scene_7(DawnGame *game) : SimpleVNScene(game) { Scene_7(DawnGame *game) : SimpleVNScene(game) {
} }
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets(); std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelPauseEvent(vnManager, 0.1f); auto start = new VisualNovelPauseEvent(vnManager, 0.1f);
start start
->then(new VisualNovelTextboxEvent(vnManager, "scene.7.1")) ->then(new VisualNovelTextboxEvent(vnManager, "scene.7.1"))
->then(new VisualNovelCallbackEvent<Scene_7>(vnManager, this, &Scene_7::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_7>(vnManager, this, &Scene_7::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,66 +1,66 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "PokerVNScene.hpp" #include "PokerVNScene.hpp"
#include "prefabs/characters/PennyPrefab.hpp" #include "prefabs/characters/PennyPrefab.hpp"
#include "scenes/Scene_9.hpp" #include "scenes/Scene_9.hpp"
namespace Dawn { namespace Dawn {
class Scene_8 : public PokerVNScene { class Scene_8 : public PokerVNScene {
protected: protected:
PennyPrefab *penny; PennyPrefab *penny;
PennyPrefab *julie; PennyPrefab *julie;
PennyPrefab *sammy; PennyPrefab *sammy;
PennyPrefab *lucy; PennyPrefab *lucy;
void vnStage() override { void vnStage() override {
penny = PennyPrefab::create(this); penny = PennyPrefab::create(this);
julie = PennyPrefab::create(this); julie = PennyPrefab::create(this);
sammy = PennyPrefab::create(this); sammy = PennyPrefab::create(this);
lucy = PennyPrefab::create(this); lucy = PennyPrefab::create(this);
PokerVNScene::vnStage(); PokerVNScene::vnStage();
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_9(this->game); auto scene = new Scene_9(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
std::vector<PokerPlayer *> getPokerPlayers() override { std::vector<PokerPlayer *> getPokerPlayers() override {
return std::vector<PokerPlayer*>{ return std::vector<PokerPlayer*>{
this->penny->getComponent<PokerPlayer>(), this->penny->getComponent<PokerPlayer>(),
this->julie->getComponent<PokerPlayer>(), this->julie->getComponent<PokerPlayer>(),
this->sammy->getComponent<PokerPlayer>(), this->sammy->getComponent<PokerPlayer>(),
this->lucy->getComponent<PokerPlayer>() this->lucy->getComponent<PokerPlayer>()
}; };
} }
public: public:
Scene_8(DawnGame *game) : PokerVNScene(game) {} Scene_8(DawnGame *game) : PokerVNScene(game) {}
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
auto assMan = &this->game->assetManager; auto assMan = &this->game->assetManager;
std::vector<Asset*> assets; std::vector<Asset*> assets;
vectorAppend(&assets, PokerVNScene::getRequiredAssets()); vectorAppend(&assets, PokerVNScene::getRequiredAssets());
vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan)); vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan));
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelTextboxEvent(vnManager, "scene.8.1"); auto start = new VisualNovelTextboxEvent(vnManager, "scene.8.1");
start start
->then(new VisualNovelCallbackEvent<Scene_8>(vnManager, this, &Scene_8::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_8>(vnManager, this, &Scene_8::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,45 +1,45 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "visualnovel/scene/SimpleVNScene.hpp" #include "visualnovel/scene/SimpleVNScene.hpp"
#include "scenes/Scene_10.hpp" #include "scenes/Scene_10.hpp"
namespace Dawn { namespace Dawn {
class Scene_9 : public SimpleVNScene { class Scene_9 : public SimpleVNScene {
protected: protected:
void vnStage() override { void vnStage() override {
} }
void onSceneEnded() { void onSceneEnded() {
auto scene = new Scene_10(this->game); auto scene = new Scene_10(this->game);
game->assetManager.queueSwap( game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets() scene->getRequiredAssets(), this->getRequiredAssets()
); );
game->assetManager.syncLoad(); game->assetManager.syncLoad();
scene->stage(); scene->stage();
this->game->sceneCutover(scene); this->game->sceneCutover(scene);
} }
public: public:
Scene_9(DawnGame *game) : SimpleVNScene(game) { Scene_9(DawnGame *game) : SimpleVNScene(game) {
} }
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets(); std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelPauseEvent(vnManager, 0.1f); auto start = new VisualNovelPauseEvent(vnManager, 0.1f);
start start
->then(new VisualNovelTextboxEvent(vnManager, "scene.9.1")) ->then(new VisualNovelTextboxEvent(vnManager, "scene.9.1"))
->then(new VisualNovelCallbackEvent<Scene_9>(vnManager, this, &Scene_9::onSceneEnded)) ->then(new VisualNovelCallbackEvent<Scene_9>(vnManager, this, &Scene_9::onSceneEnded))
; ;
return start; return start;
} }
}; };
} }

View File

@ -1,57 +1,57 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "PokerVNScene.hpp" #include "PokerVNScene.hpp"
#include "prefabs/characters/PennyPrefab.hpp" #include "prefabs/characters/PennyPrefab.hpp"
namespace Dawn { namespace Dawn {
class TestScene : public PokerVNScene { class TestScene : public PokerVNScene {
protected: protected:
PennyPrefab *penny; PennyPrefab *penny;
PennyPrefab *julie; PennyPrefab *julie;
PennyPrefab *sammy; PennyPrefab *sammy;
PennyPrefab *lucy; PennyPrefab *lucy;
void vnStage() override { void vnStage() override {
penny = PennyPrefab::create(this); penny = PennyPrefab::create(this);
julie = PennyPrefab::create(this); julie = PennyPrefab::create(this);
sammy = PennyPrefab::create(this); sammy = PennyPrefab::create(this);
lucy = PennyPrefab::create(this); lucy = PennyPrefab::create(this);
PokerVNScene::vnStage(); PokerVNScene::vnStage();
} }
std::vector<PokerPlayer *> getPokerPlayers() override { std::vector<PokerPlayer *> getPokerPlayers() override {
return std::vector<PokerPlayer*>{ return std::vector<PokerPlayer*>{
this->penny->getComponent<PokerPlayer>(), this->penny->getComponent<PokerPlayer>(),
this->julie->getComponent<PokerPlayer>(), this->julie->getComponent<PokerPlayer>(),
this->sammy->getComponent<PokerPlayer>(), this->sammy->getComponent<PokerPlayer>(),
this->lucy->getComponent<PokerPlayer>() this->lucy->getComponent<PokerPlayer>()
}; };
} }
public: public:
TestScene(DawnGame *game) : PokerVNScene(game) {} TestScene(DawnGame *game) : PokerVNScene(game) {}
std::vector<Asset*> getRequiredAssets() override { std::vector<Asset*> getRequiredAssets() override {
auto assMan = &this->game->assetManager; auto assMan = &this->game->assetManager;
std::vector<Asset*> assets; std::vector<Asset*> assets;
vectorAppend(&assets, PokerVNScene::getRequiredAssets()); vectorAppend(&assets, PokerVNScene::getRequiredAssets());
vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan)); vectorAppend(&assets, PennyPrefab::getRequiredAssets(assMan));
assets.push_back(assMan->get<TextureAsset>("texture_tavern_night")); assets.push_back(assMan->get<TextureAsset>("texture_tavern_night"));
return assets; return assets;
} }
IVisualNovelEvent * getVNEvent() override { IVisualNovelEvent * getVNEvent() override {
auto texture = this->game->assetManager.get<TextureAsset>("texture_tavern_night"); auto texture = this->game->assetManager.get<TextureAsset>("texture_tavern_night");
auto start = new VisualNovelChangeSimpleBackgroundEvent( auto start = new VisualNovelChangeSimpleBackgroundEvent(
vnManager, &texture->texture vnManager, &texture->texture
); );
start->then(new VisualNovelTextboxEvent(vnManager, penny->getComponent<VisualNovelCharacter>(), "1234")); start->then(new VisualNovelTextboxEvent(vnManager, penny->getComponent<VisualNovelCharacter>(), "1234"));
return start; return start;
} }
}; };
} }

View File

@ -1,32 +1,32 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "ui/UIBorder.hpp" #include "ui/UIBorder.hpp"
#include "asset/assets/TextureAsset.hpp" #include "asset/assets/TextureAsset.hpp"
#include "game/DawnGame.hpp" #include "game/DawnGame.hpp"
namespace Dawn { namespace Dawn {
class PokerGameBorder { class PokerGameBorder {
public: public:
static std::vector<Asset*> getAssets(AssetManager *man) { static std::vector<Asset*> getAssets(AssetManager *man) {
return std::vector<Asset*>{ return std::vector<Asset*>{
man->get<TextureAsset>("texture_test") man->get<TextureAsset>("texture_test")
}; };
} }
static void apply(UIBorder *border) { static void apply(UIBorder *border) {
auto text = border->getGame()->assetManager.get<TextureAsset>("texture_test"); auto text = border->getGame()->assetManager.get<TextureAsset>("texture_test");
border->texture = &text->texture; border->texture = &text->texture;
border->setBorderSize(glm::vec2(16, 16)); border->setBorderSize(glm::vec2(16, 16));
} }
static UIBorder * create(UICanvas *canvas) { static UIBorder * create(UICanvas *canvas) {
auto border = canvas->addElement<UIBorder>(); auto border = canvas->addElement<UIBorder>();
PokerGameBorder::apply(border); PokerGameBorder::apply(border);
return border; return border;
} }
}; };
} }

View File

@ -1,46 +1,46 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "ui/PokerGameBorder.hpp" #include "ui/PokerGameBorder.hpp"
#include "visualnovel/ui/VisualNovelTextbox.hpp" #include "visualnovel/ui/VisualNovelTextbox.hpp"
#include "asset/assets/TrueTypeAsset.hpp" #include "asset/assets/TrueTypeAsset.hpp"
namespace Dawn { namespace Dawn {
class PokerGameTextbox { class PokerGameTextbox {
public: public:
static std::vector<Asset*> getAssets(AssetManager *man) { static std::vector<Asset*> getAssets(AssetManager *man) {
assertNotNull(man); assertNotNull(man);
std::vector<Asset*> assets; std::vector<Asset*> assets;
vectorAppend(&assets, &PokerGameBorder::getAssets(man)); vectorAppend(&assets, &PokerGameBorder::getAssets(man));
assets.push_back(man->get<TrueTypeAsset>("truetype_ark")); assets.push_back(man->get<TrueTypeAsset>("truetype_ark"));
return assets; return assets;
} }
static void apply(VisualNovelTextbox *textbox) { static void apply(VisualNovelTextbox *textbox) {
assertNotNull(textbox); assertNotNull(textbox);
auto assetFont = textbox->getGame()->assetManager.get<TrueTypeAsset>("truetype_ark"); auto assetFont = textbox->getGame()->assetManager.get<TrueTypeAsset>("truetype_ark");
PokerGameBorder::apply(&textbox->border); PokerGameBorder::apply(&textbox->border);
textbox->setFont(&assetFont->font); textbox->setFont(&assetFont->font);
textbox->setFontSize(40); textbox->setFontSize(40);
textbox->setLabelPadding(glm::vec2(10, 8)); textbox->setLabelPadding(glm::vec2(10, 8));
} }
static VisualNovelTextbox * create(UICanvas *canvas) { static VisualNovelTextbox * create(UICanvas *canvas) {
assertNotNull(canvas); assertNotNull(canvas);
auto textbox = canvas->addElement<VisualNovelTextbox>(); auto textbox = canvas->addElement<VisualNovelTextbox>();
PokerGameTextbox::apply(textbox); PokerGameTextbox::apply(textbox);
textbox->setTransform( textbox->setTransform(
UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_END, UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_END,
glm::vec4(0, 238, 0, 0), glm::vec4(0, 238, 0, 0),
0.0f 0.0f
); );
return textbox; return textbox;
} }
}; };
} }

View File

@ -1,101 +1,101 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#include "PokerPlayerDisplay.hpp" #include "PokerPlayerDisplay.hpp"
#include "game/DawnGame.hpp" #include "game/DawnGame.hpp"
using namespace Dawn; using namespace Dawn;
PokerPlayerDisplay::PokerPlayerDisplay(UICanvas *canvas) : PokerPlayerDisplay::PokerPlayerDisplay(UICanvas *canvas) :
UIEmpty(canvas), UIEmpty(canvas),
labelName(canvas), labelName(canvas),
labelChips(canvas), labelChips(canvas),
borderInner(canvas), borderInner(canvas),
border(canvas), border(canvas),
animChips(&animChipsValue) animChips(&animChipsValue)
{ {
this->font = getGame()->assetManager.get<TrueTypeAsset>("truetype_ark"); this->font = getGame()->assetManager.get<TrueTypeAsset>("truetype_ark");
// Border // Border
this->addChild(&this->border); this->addChild(&this->border);
PokerGameBorder::apply(&this->border); PokerGameBorder::apply(&this->border);
this->border.setTransform( this->border.setTransform(
UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH,
glm::vec4(0, 0, 0, 0), glm::vec4(0, 0, 0, 0),
0.0f 0.0f
); );
// Border Inner // Border Inner
this->addChild(&this->borderInner); this->addChild(&this->borderInner);
this->borderInner.setTransform( this->borderInner.setTransform(
UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH,
glm::vec4(this->border.getBorderSize(), this->border.getBorderSize()), glm::vec4(this->border.getBorderSize(), this->border.getBorderSize()),
0.0f 0.0f
); );
// Player Name // Player Name
this->borderInner.addChild(&this->labelName); this->borderInner.addChild(&this->labelName);
this->labelName.setText("undefined"); this->labelName.setText("undefined");
this->labelName.setFont(&this->font->font); this->labelName.setFont(&this->font->font);
this->labelName.setFontSize(40); this->labelName.setFontSize(40);
this->labelName.setTransform( this->labelName.setTransform(
UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START,
glm::vec4(0, 0, 0, 0), glm::vec4(0, 0, 0, 0),
0.0f 0.0f
); );
// Chips label // Chips label
this->borderInner.addChild(&this->labelChips); this->borderInner.addChild(&this->labelChips);
this->labelChips.setFont(&this->font->font); this->labelChips.setFont(&this->font->font);
this->labelChips.setFontSize(40); this->labelChips.setFontSize(40);
this->labelChips.setTransform( this->labelChips.setTransform(
UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START,
glm::vec4(0, this->labelName.getContentHeight(), 0, 0), glm::vec4(0, this->labelName.getContentHeight(), 0, 0),
0.0f 0.0f
); );
// Anim // Anim
this->animChips.easing = &easeOutQuart; this->animChips.easing = &easeOutQuart;
// Events // Events
getScene()->eventSceneUnpausedUpdate.addListener(this, &PokerPlayerDisplay::onSceneUpdate); getScene()->eventSceneUnpausedUpdate.addListener(this, &PokerPlayerDisplay::onSceneUpdate);
} }
void PokerPlayerDisplay::setPlayer(PokerPlayer *player) { void PokerPlayerDisplay::setPlayer(PokerPlayer *player) {
assertNull(this->player); assertNull(this->player);
this->player = player; this->player = player;
player->eventChipsChanged.addListener(this, &PokerPlayerDisplay::onPlayerChipsChanged); player->eventChipsChanged.addListener(this, &PokerPlayerDisplay::onPlayerChipsChanged);
this->labelName.setText("undefined"); this->labelName.setText("undefined");
this->animChips.clear(); this->animChips.clear();
this->animChips.restart(); this->animChips.restart();
this->animChipsValue = player->chips; this->animChipsValue = player->chips;
this->updatePositions(); this->updatePositions();
} }
void PokerPlayerDisplay::onSceneUpdate() { void PokerPlayerDisplay::onSceneUpdate() {
this->animChips.tick(getGame()->timeManager.delta); this->animChips.tick(getGame()->timeManager.delta);
// std::stringstream stream; // std::stringstream stream;
// stream.precision(0); // stream.precision(0);
// stream << "$"; // stream << "$";
// stream << this->animChipsValue; // stream << this->animChipsValue;
this->labelChips.setText("undefined"); this->labelChips.setText("undefined");
} }
void PokerPlayerDisplay::onPlayerChipsChanged() { void PokerPlayerDisplay::onPlayerChipsChanged() {
std::cout << "Chips" << player->chips << std::endl; std::cout << "Chips" << player->chips << std::endl;
this->animChips.clear(); this->animChips.clear();
this->animChips.addKeyframe(0.0f, this->animChipsValue); this->animChips.addKeyframe(0.0f, this->animChipsValue);
this->animChips.addKeyframe(1.0f, this->player->chips); this->animChips.addKeyframe(1.0f, this->player->chips);
this->animChips.restart(); this->animChips.restart();
} }
PokerPlayerDisplay::~PokerPlayerDisplay() { PokerPlayerDisplay::~PokerPlayerDisplay() {
this->canvas->getScene()->eventSceneUnpausedUpdate.removeListener(this, &PokerPlayerDisplay::onSceneUpdate); this->canvas->getScene()->eventSceneUnpausedUpdate.removeListener(this, &PokerPlayerDisplay::onSceneUpdate);
} }

View File

@ -1,48 +1,48 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "ui/UILabel.hpp" #include "ui/UILabel.hpp"
#include "ui/UIEmpty.hpp" #include "ui/UIEmpty.hpp"
#include "ui/UIBorder.hpp" #include "ui/UIBorder.hpp"
#include "poker/PokerPlayer.hpp" #include "poker/PokerPlayer.hpp"
#include "asset/AssetManager.hpp" #include "asset/AssetManager.hpp"
#include "asset/assets/TrueTypeAsset.hpp" #include "asset/assets/TrueTypeAsset.hpp"
#include "display/animation/SimpleAnimation.hpp" #include "display/animation/SimpleAnimation.hpp"
#include "ui/PokerGameBorder.hpp" #include "ui/PokerGameBorder.hpp"
namespace Dawn { namespace Dawn {
class PokerPlayerDisplay : public UIEmpty { class PokerPlayerDisplay : public UIEmpty {
private: private:
SimpleAnimation<int32_t> animChips; SimpleAnimation<int32_t> animChips;
int32_t animChipsValue; int32_t animChipsValue;
protected: protected:
PokerPlayer *player = nullptr; PokerPlayer *player = nullptr;
UILabel labelName; UILabel labelName;
UILabel labelChips; UILabel labelChips;
UIEmpty borderInner; UIEmpty borderInner;
UIBorder border; UIBorder border;
TrueTypeAsset *font; TrueTypeAsset *font;
void onPlayerChipsChanged(); void onPlayerChipsChanged();
void onSceneUpdate(); void onSceneUpdate();
public: public:
static std::vector<Asset*> getAssets(AssetManager *assMan) { static std::vector<Asset*> getAssets(AssetManager *assMan) {
std::vector<Asset*> assets; std::vector<Asset*> assets;
assets = PokerGameBorder::getAssets(assMan); assets = PokerGameBorder::getAssets(assMan);
assets.push_back(assMan->get<TrueTypeAsset>("truetype_alice")); assets.push_back(assMan->get<TrueTypeAsset>("truetype_alice"));
return assets; return assets;
} }
PokerPlayerDisplay(UICanvas *canvas); PokerPlayerDisplay(UICanvas *canvas);
void setPlayer(PokerPlayer *player); void setPlayer(PokerPlayer *player);
~PokerPlayerDisplay(); ~PokerPlayerDisplay();
}; };
} }

View File

@ -1,13 +1,13 @@
# Copyright (c) 2022 Dominic Masters # Copyright (c) 2022 Dominic Masters
# #
# This software is released under the MIT License. # This software is released under the MIT License.
# https://opensource.org/licenses/MIT # https://opensource.org/licenses/MIT
# Sources # Sources
target_sources(${DAWN_TARGET_NAME} target_sources(${DAWN_TARGET_NAME}
PRIVATE PRIVATE
VNPlayer.cpp VNPlayer.cpp
) )
# Subdirs # Subdirs
add_subdirectory(events) add_subdirectory(events)

View File

@ -1,12 +1,12 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#include "VNPlayer.hpp" #include "VNPlayer.hpp"
using namespace Dawn; using namespace Dawn;
VNPlayer::VNPlayer(SceneItem *item) : SceneItemComponent(item) { VNPlayer::VNPlayer(SceneItem *item) : SceneItemComponent(item) {
} }

View File

@ -1,18 +1,18 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "dawnlibs.hpp" #include "dawnlibs.hpp"
#include "scene/SceneItemComponent.hpp" #include "scene/SceneItemComponent.hpp"
namespace Dawn { namespace Dawn {
class VNPlayer : public SceneItemComponent { class VNPlayer : public SceneItemComponent {
protected: protected:
public: public:
VNPlayer(SceneItem *item); VNPlayer(SceneItem *item);
}; };
} }

View File

@ -1,10 +1,10 @@
# Copyright (c) 2022 Dominic Masters # Copyright (c) 2022 Dominic Masters
# #
# This software is released under the MIT License. # This software is released under the MIT License.
# https://opensource.org/licenses/MIT # https://opensource.org/licenses/MIT
# Sources # Sources
target_sources(${DAWN_TARGET_NAME} target_sources(${DAWN_TARGET_NAME}
PRIVATE PRIVATE
PokerBetLoopEvent.cpp PokerBetLoopEvent.cpp
) )

View File

@ -1,64 +1,64 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#include "PokerBetLoopEvent.hpp" #include "PokerBetLoopEvent.hpp"
#include "PokerInitialEvent.hpp" #include "PokerInitialEvent.hpp"
using namespace Dawn; using namespace Dawn;
void PokerBetLoopEvent::onStart(IVisualNovelEvent *prev) { void PokerBetLoopEvent::onStart(IVisualNovelEvent *prev) {
PokerGameEvent::onStart(prev); PokerGameEvent::onStart(prev);
std::cout << "Bet Loop, bet" << std::endl; std::cout << "Bet Loop, bet" << std::endl;
auto evt2 = new PokerDetermineBetterEvent(this->manager); auto evt2 = new PokerDetermineBetterEvent(this->manager);
auto betting = this->then(evt2); auto betting = this->then(evt2);
betting betting
// ->whenEveryoneFolded(new VisualNovelTextboxEvent(this->manager, "Everyone Folded")) // ->whenEveryoneFolded(new VisualNovelTextboxEvent(this->manager, "Everyone Folded"))
->then(new PokerWinnerEvent(this->manager)) ->then(new PokerWinnerEvent(this->manager))
->then(new PokerInitialEvent(this->manager)) ->then(new PokerInitialEvent(this->manager))
; ;
betting betting
// ->whenBettingFinished(new VisualNovelTextboxEvent(this->manager, "Betting Finished")) // ->whenBettingFinished(new VisualNovelTextboxEvent(this->manager, "Betting Finished"))
->then(new PokerWinnerEvent(this->manager)) ->then(new PokerWinnerEvent(this->manager))
->then(new PokerInitialEvent(this->manager)) ->then(new PokerInitialEvent(this->manager))
; ;
betting betting
->whenTurn(new PokerTurnEvent(this->manager)) ->whenTurn(new PokerTurnEvent(this->manager))
// ->then(new VisualNovelTextboxEvent(this->manager, "Turn Time")) // ->then(new VisualNovelTextboxEvent(this->manager, "Turn Time"))
->then(new PokerNewBettingRoundEvent(this->manager)) ->then(new PokerNewBettingRoundEvent(this->manager))
->then(new PokerBetLoopEvent(this->manager)) ->then(new PokerBetLoopEvent(this->manager))
; ;
betting betting
// ->whenHumanBet(new VisualNovelTextboxEvent(this->manager, "Human Bet")) // ->whenHumanBet(new VisualNovelTextboxEvent(this->manager, "Human Bet"))
->then(new PokerBetLoopEvent(this->manager)) ->then(new PokerBetLoopEvent(this->manager))
; ;
// AI Betting // AI Betting
auto aiBet = betting auto aiBet = betting
// ->whenAiBet(new VisualNovelTextboxEvent(this->manager, "AI Bet")) // ->whenAiBet(new VisualNovelTextboxEvent(this->manager, "AI Bet"))
->then(new PokerAIBetEvent(this->manager)) ->then(new PokerAIBetEvent(this->manager))
; ;
aiBet aiBet
// ->whenFolded(new VisualNovelTextboxEvent(this->manager, "Folded")) // ->whenFolded(new VisualNovelTextboxEvent(this->manager, "Folded"))
->then(new PokerBetLoopEvent(this->manager)) ->then(new PokerBetLoopEvent(this->manager))
; ;
aiBet aiBet
// ->whenAllIn(new VisualNovelTextboxEvent(this->manager, "All In")) // ->whenAllIn(new VisualNovelTextboxEvent(this->manager, "All In"))
->then(new PokerBetLoopEvent(this->manager)) ->then(new PokerBetLoopEvent(this->manager))
; ;
aiBet aiBet
// ->whenBetting(new VisualNovelTextboxEvent(this->manager, "Betting")) // ->whenBetting(new VisualNovelTextboxEvent(this->manager, "Betting"))
->then(new PokerBetLoopEvent(this->manager)) ->then(new PokerBetLoopEvent(this->manager))
; ;
aiBet aiBet
// ->whenCalling(new VisualNovelTextboxEvent(this->manager, "Calling")) // ->whenCalling(new VisualNovelTextboxEvent(this->manager, "Calling"))
->then(new PokerBetLoopEvent(this->manager)) ->then(new PokerBetLoopEvent(this->manager))
; ;
aiBet aiBet
// ->whenChecking(new VisualNovelTextboxEvent(this->manager, "Checking")) // ->whenChecking(new VisualNovelTextboxEvent(this->manager, "Checking"))
->then(new PokerBetLoopEvent(this->manager)) ->then(new PokerBetLoopEvent(this->manager))
; ;
} }

View File

@ -1,36 +1,36 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "poker/visualnovel/PokerNewGameEvent.hpp" #include "poker/visualnovel/PokerNewGameEvent.hpp"
#include "poker/visualnovel/PokerNewRoundEvent.hpp" #include "poker/visualnovel/PokerNewRoundEvent.hpp"
#include "poker/visualnovel/PokerTakeBlindsEvent.hpp" #include "poker/visualnovel/PokerTakeBlindsEvent.hpp"
#include "poker/visualnovel/PokerDealEvent.hpp" #include "poker/visualnovel/PokerDealEvent.hpp"
#include "poker/visualnovel/PokerTurnEvent.hpp" #include "poker/visualnovel/PokerTurnEvent.hpp"
#include "poker/visualnovel/PokerDetermineBetterEvent.hpp" #include "poker/visualnovel/PokerDetermineBetterEvent.hpp"
#include "poker/visualnovel/PokerAIBetEvent.hpp" #include "poker/visualnovel/PokerAIBetEvent.hpp"
#include "poker/visualnovel/PokerNewBettingRoundEvent.hpp" #include "poker/visualnovel/PokerNewBettingRoundEvent.hpp"
#include "poker/visualnovel/PokerWinnerEvent.hpp" #include "poker/visualnovel/PokerWinnerEvent.hpp"
#define POKER_DEAL_EVENT_CARD_COUNT 2 #define POKER_DEAL_EVENT_CARD_COUNT 2
namespace Dawn { namespace Dawn {
class PokerBetLoopEvent : public PokerGameEvent { class PokerBetLoopEvent : public PokerGameEvent {
protected: protected:
void onStart(IVisualNovelEvent *previous) override; void onStart(IVisualNovelEvent *previous) override;
bool_t onUpdate() override { bool_t onUpdate() override {
return false; return false;
} }
void onEnd() override { void onEnd() override {
std::cout << "Bet lop fin" << std::endl; std::cout << "Bet lop fin" << std::endl;
} }
public: public:
PokerBetLoopEvent(VisualNovelManager *manager) : PokerGameEvent(manager) { PokerBetLoopEvent(VisualNovelManager *manager) : PokerGameEvent(manager) {
} }
}; };
} }

View File

@ -1,43 +1,43 @@
// Copyright (c) 2022 Dominic Masters // Copyright (c) 2022 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "poker/visualnovel/PokerNewRoundEvent.hpp" #include "poker/visualnovel/PokerNewRoundEvent.hpp"
#include "poker/visualnovel/PokerDealEvent.hpp" #include "poker/visualnovel/PokerDealEvent.hpp"
#include "poker/visualnovel/PokerTakeBlindsEvent.hpp" #include "poker/visualnovel/PokerTakeBlindsEvent.hpp"
#include "PokerBetLoopEvent.hpp" #include "PokerBetLoopEvent.hpp"
#include "visualnovel/events/VisualNovelTextboxEvent.hpp" #include "visualnovel/events/VisualNovelTextboxEvent.hpp"
#define POKER_DEAL_EVENT_CARD_COUNT 2 #define POKER_DEAL_EVENT_CARD_COUNT 2
namespace Dawn { namespace Dawn {
class PokerInitialEvent : public PokerGameEvent { class PokerInitialEvent : public PokerGameEvent {
protected: protected:
void onStart(IVisualNovelEvent *previous) override { void onStart(IVisualNovelEvent *previous) override {
PokerGameEvent::onStart(previous); PokerGameEvent::onStart(previous);
this this
->then(new PokerNewRoundEvent(this->manager)) ->then(new PokerNewRoundEvent(this->manager))
// ->then(new VisualNovelTextboxEvent(this->manager, "Round Started")) // ->then(new VisualNovelTextboxEvent(this->manager, "Round Started"))
->then(new PokerTakeBlindsEvent(this->manager)) ->then(new PokerTakeBlindsEvent(this->manager))
// ->then(new VisualNovelTextboxEvent(this->manager, "Blinds Taken")) // ->then(new VisualNovelTextboxEvent(this->manager, "Blinds Taken"))
->then(new PokerDealEvent(this->manager)) ->then(new PokerDealEvent(this->manager))
// ->then(new VisualNovelTextboxEvent(this->manager, "Cards Dealt")) // ->then(new VisualNovelTextboxEvent(this->manager, "Cards Dealt"))
->then(new PokerBetLoopEvent(this->manager)) ->then(new PokerBetLoopEvent(this->manager))
; ;
} }
bool_t onUpdate() override { bool_t onUpdate() override {
return false; return false;
} }
void onEnd() override { void onEnd() override {
} }
public: public:
PokerInitialEvent(VisualNovelManager *manager) : PokerGameEvent(manager) { PokerInitialEvent(VisualNovelManager *manager) : PokerGameEvent(manager) {
} }
}; };
} }

View File

@ -1,31 +1,31 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#include "TicTacToeTile.hpp" #include "TicTacToeTile.hpp"
#include "scene/SceneItem.hpp" #include "scene/SceneItem.hpp"
#include "game/DawnGame.hpp" #include "game/DawnGame.hpp"
using namespace Dawn; using namespace Dawn;
TicTacToeTile::TicTacToeTile(SceneItem *item) : TicTacToeTile::TicTacToeTile(SceneItem *item) :
SceneItemComponent(item), SceneItemComponent(item),
tileState(TIC_TAC_TOE_EMPTY), tileState(TIC_TAC_TOE_EMPTY),
hovered(false) hovered(false)
{ {
} }
void TicTacToeTile::onStart() { void TicTacToeTile::onStart() {
auto cb = [&]{ auto cb = [&]{
auto sprite = this->item->getComponent<TiledSprite>(); auto sprite = this->item->getComponent<TiledSprite>();
if(this->hovered && tileState == TIC_TAC_TOE_EMPTY) { if(this->hovered && tileState == TIC_TAC_TOE_EMPTY) {
sprite->setTile(0x03); sprite->setTile(0x03);
} else { } else {
sprite->setTile(tileState); sprite->setTile(tileState);
} }
}; };
useEffect(cb, tileState); useEffect(cb, tileState);
useEffect(cb, hovered)(); useEffect(cb, hovered)();
} }

View File

@ -1,21 +1,21 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "scene/SceneItemComponent.hpp" #include "scene/SceneItemComponent.hpp"
#include "scene/components/display/TiledSprite.hpp" #include "scene/components/display/TiledSprite.hpp"
#include "games/tictactoe/TicTacToeLogic.hpp" #include "games/tictactoe/TicTacToeLogic.hpp"
namespace Dawn { namespace Dawn {
class TicTacToeTile : public SceneItemComponent { class TicTacToeTile : public SceneItemComponent {
public: public:
StateProperty<enum TicTacToeTileState> tileState; StateProperty<enum TicTacToeTileState> tileState;
StateProperty<bool_t> hovered; StateProperty<bool_t> hovered;
uint8_t tile; uint8_t tile;
TicTacToeTile(SceneItem *item); TicTacToeTile(SceneItem *item);
void onStart() override; void onStart() override;
}; };
} }

View File

@ -1,29 +1,29 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "game/_DawnGame.hpp" #include "game/_DawnGame.hpp"
#include "save/DawnGameSaveManager.hpp" #include "save/DawnGameSaveManager.hpp"
namespace Dawn { namespace Dawn {
class DawnGame : public IDawnGame { class DawnGame : public IDawnGame {
private: private:
Scene *sceneToCutTo = nullptr; Scene *sceneToCutTo = nullptr;
public: public:
DawnHost *host; DawnHost *host;
RenderManager renderManager; RenderManager renderManager;
AssetManager assetManager; AssetManager assetManager;
InputManager inputManager; InputManager inputManager;
TimeManager timeManager; TimeManager timeManager;
LocaleManager localeManager; LocaleManager localeManager;
DawnGameSaveManager saveManager; DawnGameSaveManager saveManager;
DawnGame(DawnHost *host); DawnGame(DawnHost *host);
int32_t init() override; int32_t init() override;
int32_t update(float_t delta) override; int32_t update(float_t delta) override;
void sceneCutover(Scene *scene) override; void sceneCutover(Scene *scene) override;
}; };
} }

View File

@ -1,62 +1,62 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "prefab/SceneItemPrefab.hpp" #include "prefab/SceneItemPrefab.hpp"
#include "scene/components/display/TiledSprite.hpp" #include "scene/components/display/TiledSprite.hpp"
#include "scene/components/display/MeshHost.hpp" #include "scene/components/display/MeshHost.hpp"
#include "scene/components/display/MeshRenderer.hpp" #include "scene/components/display/MeshRenderer.hpp"
#include "scene/components/display/material/SimpleTexturedMaterial.hpp" #include "scene/components/display/material/SimpleTexturedMaterial.hpp"
#include "scene/components/physics/3d/CubeCollider.hpp" #include "scene/components/physics/3d/CubeCollider.hpp"
#include "components/TicTacToeTile.hpp" #include "components/TicTacToeTile.hpp"
namespace Dawn { namespace Dawn {
class TicTacToeTilePrefab : public SceneItemPrefab<TicTacToeTilePrefab> { class TicTacToeTilePrefab : public SceneItemPrefab<TicTacToeTilePrefab> {
public: public:
static std::vector<Asset*> prefabAssets(AssetManager *ass) { static std::vector<Asset*> prefabAssets(AssetManager *ass) {
return std::vector<Asset*>{ return std::vector<Asset*>{
ass->get<TextureAsset>("texture_xo"), ass->get<TextureAsset>("texture_xo"),
ass->get<TilesetAsset>("tileset_xo") ass->get<TilesetAsset>("tileset_xo")
}; };
} }
// //
MeshHost *meshHost; MeshHost *meshHost;
TiledSprite *sprite; TiledSprite *sprite;
MeshRenderer *meshRenderer; MeshRenderer *meshRenderer;
SimpleTexturedMaterial *material; SimpleTexturedMaterial *material;
TicTacToeTile *ticTacToe; TicTacToeTile *ticTacToe;
CubeCollider *collider; CubeCollider *collider;
TicTacToeTilePrefab(Scene *s, sceneitemid_t i) : TicTacToeTilePrefab(Scene *s, sceneitemid_t i) :
SceneItemPrefab<TicTacToeTilePrefab>(s,i) SceneItemPrefab<TicTacToeTilePrefab>(s,i)
{ {
} }
void prefabInit(AssetManager *man) override { void prefabInit(AssetManager *man) override {
auto tileset = man->get<TilesetAsset>("tileset_xo"); auto tileset = man->get<TilesetAsset>("tileset_xo");
auto texture = man->get<TextureAsset>("texture_xo"); auto texture = man->get<TextureAsset>("texture_xo");
meshHost = this->addComponent<MeshHost>(); meshHost = this->addComponent<MeshHost>();
meshRenderer = this->addComponent<MeshRenderer>(); meshRenderer = this->addComponent<MeshRenderer>();
material = this->template addComponent<SimpleTexturedMaterial>(); material = this->template addComponent<SimpleTexturedMaterial>();
material->texture = &texture->texture; material->texture = &texture->texture;
sprite = this->addComponent<TiledSprite>(); sprite = this->addComponent<TiledSprite>();
sprite->setTileset(&tileset->tileset); sprite->setTileset(&tileset->tileset);
sprite->setSize(glm::vec2(1, 1)); sprite->setSize(glm::vec2(1, 1));
sprite->setTile(0x01); sprite->setTile(0x01);
collider = this->addComponent<CubeCollider>(); collider = this->addComponent<CubeCollider>();
collider->min = glm::vec3(-0.5f, -0.5f, -0.1f); collider->min = glm::vec3(-0.5f, -0.5f, -0.1f);
collider->max = glm::vec3( 0.5f, 0.5f, 0.1f); collider->max = glm::vec3( 0.5f, 0.5f, 0.1f);
ticTacToe = this->addComponent<TicTacToeTile>(); ticTacToe = this->addComponent<TicTacToeTile>();
} }
}; };
} }

View File

@ -1,36 +1,36 @@
# Copyright (c) 2023 Dominic Msters # Copyright (c) 2023 Dominic Msters
# #
# This software is released under the MIT License. # This software is released under the MIT License.
# https://opensource.org/licenses/MIT # https://opensource.org/licenses/MIT
project(sceneitemcomponentgen VERSION 1.0) project(sceneitemcomponentgen VERSION 1.0)
add_executable(sceneitemcomponentgen) add_executable(sceneitemcomponentgen)
# Sources # Sources
target_sources(sceneitemcomponentgen target_sources(sceneitemcomponentgen
PRIVATE PRIVATE
${DAWN_SHARED_SOURCES} ${DAWN_SHARED_SOURCES}
${DAWN_TOOL_SOURCES} ${DAWN_TOOL_SOURCES}
SceneItemComponentRegister.cpp SceneItemComponentRegister.cpp
) )
# Includes # Includes
target_include_directories(sceneitemcomponentgen target_include_directories(sceneitemcomponentgen
PUBLIC PUBLIC
${DAWN_SHARED_INCLUDES} ${DAWN_SHARED_INCLUDES}
${DAWN_TOOL_INCLUDES} ${DAWN_TOOL_INCLUDES}
${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}
) )
# Definitions # Definitions
target_compile_definitions(sceneitemcomponentgen target_compile_definitions(sceneitemcomponentgen
PUBLIC PUBLIC
DAWN_TOOL_INSTANCE=SceneItemComponentRegister DAWN_TOOL_INSTANCE=SceneItemComponentRegister
DAWN_TOOL_HEADER="SceneItemComponentRegister.hpp" DAWN_TOOL_HEADER="SceneItemComponentRegister.hpp"
) )
# Libraries # Libraries
target_link_libraries(sceneitemcomponentgen target_link_libraries(sceneitemcomponentgen
PUBLIC PUBLIC
${DAWN_BUILD_HOST_LIBS} ${DAWN_BUILD_HOST_LIBS}
) )

View File

@ -1,119 +1,119 @@
/** /**
* Copyright (c) 2023 Dominic Masters * Copyright (c) 2023 Dominic Masters
* *
* This software is released under the MIT License. * This software is released under the MIT License.
* https://opensource.org/licenses/MIT * https://opensource.org/licenses/MIT
*/ */
#include "SceneItemComponentRegister.hpp" #include "SceneItemComponentRegister.hpp"
using namespace Dawn; using namespace Dawn;
void SceneItemComponentRootGen::generate( void SceneItemComponentRootGen::generate(
std::vector<std::string> *out, std::vector<std::string> *out,
std::vector<struct SceneItemComponent> *info, std::vector<struct SceneItemComponent> *info,
std::string tabs = "" std::string tabs = ""
) { ) {
line(out, "#include \"scene/SceneItemComponentList.hpp\"", tabs); line(out, "#include \"scene/SceneItemComponentList.hpp\"", tabs);
line(out, "", tabs); line(out, "", tabs);
auto it = info->begin(); auto it = info->begin();
while(it != info->end()) { while(it != info->end()) {
auto c = *it; auto c = *it;
line(out, "#include \"" + c.header + "\"", tabs); line(out, "#include \"" + c.header + "\"", tabs);
++it; ++it;
} }
line(out, "", tabs); line(out, "", tabs);
line(out, "using namespace Dawn;", tabs); line(out, "using namespace Dawn;", tabs);
line(out, "", tabs); line(out, "", tabs);
line(out, "SceneItemComponentList::SceneItemComponentList() {", tabs); line(out, "SceneItemComponentList::SceneItemComponentList() {", tabs);
it = info->begin(); it = info->begin();
while(it != info->end()) { while(it != info->end()) {
auto c = *it; auto c = *it;
line(out, "this->append<" + c.clazz + ">();", tabs + " "); line(out, "this->append<" + c.clazz + ">();", tabs + " ");
++it; ++it;
} }
line(out, "}", tabs); line(out, "}", tabs);
} }
std::vector<std::string> SceneItemComponentRegister::getRequiredFlags() { std::vector<std::string> SceneItemComponentRegister::getRequiredFlags() {
return std::vector<std::string>{ "input", "output" }; return std::vector<std::string>{ "input", "output" };
} }
int32_t SceneItemComponentRegister::start() { int32_t SceneItemComponentRegister::start() {
File fileIn(flags["input"]); File fileIn(flags["input"]);
if(!fileIn.exists()) { if(!fileIn.exists()) {
std::cout << "Input scene item component file does not exist." << std::endl; std::cout << "Input scene item component file does not exist." << std::endl;
return 1; return 1;
} }
std::string buffer; std::string buffer;
if(!fileIn.readString(&buffer)) { if(!fileIn.readString(&buffer)) {
std::cout << "Failed to read input scene item component file" << std::endl; std::cout << "Failed to read input scene item component file" << std::endl;
return 1; return 1;
} }
std::vector<struct SceneItemComponent> components; std::vector<struct SceneItemComponent> components;
struct SceneItemComponent sci; struct SceneItemComponent sci;
size_t i = 0; size_t i = 0;
std::string t; std::string t;
uint8_t state = 0x00; uint8_t state = 0x00;
while(i < buffer.size()) { while(i < buffer.size()) {
char c = buffer[i++]; char c = buffer[i++];
if(c != ';') { if(c != ';') {
t.push_back(c); t.push_back(c);
continue; continue;
} }
switch(state) { switch(state) {
case 0x00: case 0x00:
sci.clazz = t; sci.clazz = t;
t.clear(); t.clear();
state = 0x01; state = 0x01;
break; break;
case 0x01: case 0x01:
sci.header = t; sci.header = t;
t.clear(); t.clear();
state = 0x00; state = 0x00;
components.push_back(sci); components.push_back(sci);
break; break;
default: default:
assertUnreachable(); assertUnreachable();
} }
} }
if(state == 0x01) { if(state == 0x01) {
sci.header = t; sci.header = t;
components.push_back(sci); components.push_back(sci);
} else { } else {
assertUnreachable(); assertUnreachable();
} }
std::vector<std::string> lines; std::vector<std::string> lines;
SceneItemComponentRootGen::generate(&lines, &components, ""); SceneItemComponentRootGen::generate(&lines, &components, "");
// Generate buffer // Generate buffer
std::string bufferOut; std::string bufferOut;
auto itLine = lines.begin(); auto itLine = lines.begin();
while(itLine != lines.end()) { while(itLine != lines.end()) {
bufferOut += *itLine + "\n"; bufferOut += *itLine + "\n";
++itLine; ++itLine;
} }
File fileOut(flags["output"]); File fileOut(flags["output"]);
if(!fileOut.mkdirp()) { if(!fileOut.mkdirp()) {
std::cout << "Failed to create Scene Item Component List Dir" << std::endl; std::cout << "Failed to create Scene Item Component List Dir" << std::endl;
return 1; return 1;
} }
if(!fileOut.writeString(bufferOut)) { if(!fileOut.writeString(bufferOut)) {
std::cout << "Failed to write SceneItemComponentList file" << std::endl; std::cout << "Failed to write SceneItemComponentList file" << std::endl;
return 1; return 1;
} }
return 0; return 0;
} }

View File

@ -1,33 +1,33 @@
// Copyright (c) 2023 Dominic Masters // Copyright (c) 2023 Dominic Masters
// //
// This software is released under the MIT License. // This software is released under the MIT License.
// https://opensource.org/licenses/MIT // https://opensource.org/licenses/MIT
#pragma once #pragma once
#include "util/DawnTool.hpp" #include "util/DawnTool.hpp"
#include "util/File.hpp" #include "util/File.hpp"
#include "util/CodeGen.hpp" #include "util/CodeGen.hpp"
namespace Dawn { namespace Dawn {
struct SceneItemComponent { struct SceneItemComponent {
std::string clazz; std::string clazz;
std::string header; std::string header;
}; };
class SceneItemComponentRootGen : public CodeGen { class SceneItemComponentRootGen : public CodeGen {
public: public:
static void generate( static void generate(
std::vector<std::string> *out, std::vector<std::string> *out,
std::vector<struct SceneItemComponent> *info, std::vector<struct SceneItemComponent> *info,
std::string tabs std::string tabs
); );
}; };
class SceneItemComponentRegister : public DawnTool { class SceneItemComponentRegister : public DawnTool {
protected: protected:
std::vector<std::string> getRequiredFlags() override; std::vector<std::string> getRequiredFlags() override;
public: public:
int32_t start() override; int32_t start() override;
}; };
} }

Some files were not shown because too many files have changed in this diff Show More