First attempt to play audio

This commit is contained in:
2023-01-17 00:11:22 -08:00
parent f2a0d3b3bb
commit 2950bc9184
44 changed files with 698 additions and 82 deletions

View File

@ -27,35 +27,22 @@ add_subdirectory(scenes)
# Assets
set(DIR_GAME_ASSETS games/pokergame)
tool_language(language_en ${DIR_GAME_ASSETS}/locale/en.csv)
tool_texture(texture_test texture_test.png)
tool_texture(texture_city_day borrowed/city_day.png)
tool_texture(texture_city_night borrowed/city_night.png)
tool_texture(texture_tavern_day borrowed/tavern_day.png)
tool_texture(texture_tavern_morning borrowed/tavern_morning.png)
tool_texture(texture_tavern_night borrowed/tavern_night.png)
tool_texture(texture_village_day borrowed/village_day.png)
tool_tileset(tileset_penny texture_penny characters/penny/penny-blink.png 1 22)
tool_tileset(tileset_cards texture_cards ${DIR_GAME_ASSETS}/cards.png 14 4)
tool_truetype(truetype_ark
ark-pixel.ttf
truetype_ark
2048
2048
60
)
tool_language(language_en ${DIR_GAME_ASSETS}/locale/en.csv)
tool_language(language_jp ${DIR_GAME_ASSETS}/locale/jp.csv)
tool_tileset(tileset_death texture_death ${DIR_GAME_ASSETS}/characters/death/sheet.png 1 2)
tool_truetype(truetype_alice ${DIR_GAME_ASSETS}/font/Alice-Regular.ttf truetype_alice 2048 2048 120)
add_dependencies(${DAWN_TARGET_NAME}
language_en
tileset_penny
tileset_cards
language_jp
tileset_death
truetype_alice
texture_test
truetype_ark
texture_city_day
texture_city_night
texture_tavern_day
texture_tavern_morning
texture_tavern_night
texture_village_day
)

View File

@ -7,9 +7,6 @@
#include "scenes/SubSceneRendererScene.hpp"
#include "scenes/Scene_1.hpp"
#include <thread>
#include <chrono>
using namespace Dawn;
DawnGame::DawnGame(DawnHost *host) :
@ -26,7 +23,7 @@ int32_t DawnGame::init() {
this->localeManager.init();
this->renderManager.init();
this->scene = new SubSceneRendererScene<Scene_4>(this);
this->scene = new SubSceneRendererScene<Scene_1>(this);
return DAWN_GAME_INIT_RESULT_SUCCESS;
}

View File

@ -0,0 +1,52 @@
// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "prefab/SceneItemPrefab.hpp"
#include "asset/AssetManager.hpp"
#include "poker/PokerPlayer.hpp"
#include "scene/components/Components.hpp"
#include "visualnovel/components/VisualNovelCharacter.hpp"
#include "display/animation/TiledSpriteAnimation.hpp"
#include "scene/components/display/shader/SimpleTexturedShaderInterface.hpp"
namespace Dawn {
class DeathPrefab : public SceneItemPrefab<DeathPrefab> {
public:
VisualNovelCharacter *vnCharacter;
SimpleTexturedShaderInterface *shaderInterface;
static std::vector<Asset*> prefabAssets(AssetManager *assMan) {
return std::vector<Asset*>{
assMan->get<TextureAsset>("texture_death"),
assMan->get<TilesetAsset>("tileset_death")
};
}
DeathPrefab(Scene *scene, sceneitemid_t id) : SceneItemPrefab(scene, id){}
void prefabInit(AssetManager *man) override {
auto textureAsset = man->get<TextureAsset>("texture_death");
auto tilesetAsset = man->get<TilesetAsset>("tileset_death");
auto meshRenderer = this->addComponent<MeshRenderer>();
auto material = this->addComponent<Material>();
auto meshHost = this->addComponent<MeshHost>();
auto animation = this->addComponent<AnimationController>();
auto tiledSprite = this->addComponent<TiledSprite>();
tiledSprite->setTilesetAndSize(&tilesetAsset->tileset);
tiledSprite->setTile(0);
vnCharacter = this->addComponent<VisualNovelCharacter>();
vnCharacter->nameKey = "character.death.name";
shaderInterface = this->addComponent<SimpleTexturedShaderInterface>();
shaderInterface->setTexture(&textureAsset->texture);
this->transform.setLocalPosition(glm::vec3(0, 0, 0));
}
};
}

View File

@ -46,10 +46,10 @@ namespace Dawn {
tiledSprite->setTile(0);
this->transform.setLocalPosition(glm::vec3(0, 0, 0));
auto anim = new TiledSpriteAnimation(tiledSprite);
anim->addSequentialKeyframes(0.1f, 0, 22);
anim->loop = true;
animation->animation = anim;
// auto anim = new TiledSpriteAnimation(tiledSprite);
// anim->addSequentialKeyframes(0.1f, 0, 22);
// anim->loop = true;
// animation->animation = anim;
}
};
}

View File

@ -14,17 +14,18 @@ namespace Dawn {
public:
static std::vector<Asset*> prefabAssets(AssetManager *man) {
std::vector<Asset*> assets;
assets.push_back(man->get<TrueTypeAsset>("truetype_ark"));
assets.push_back(man->get<TrueTypeAsset>("truetype_alice"));
vectorAppend(&assets, UIBorderPrefab::getRequiredAssets(man));
return assets;
}
static void prefabApply(AssetManager *man, VisualNovelTextbox *textbox) {
auto assetFont = man->get<TrueTypeAsset>("truetype_ark");
auto assetFont = man->get<TrueTypeAsset>("truetype_alice");
UIBorderPrefab::apply(&textbox->border);
textbox->setFont(&assetFont->font);
textbox->setFontSize(10.0f);
textbox->setFontSize(48.0f);
textbox->setLabelPadding(glm::vec2(2, 2));
textbox->label.textColor = COLOR_WHITE;
textbox->setTransform(
UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_END,

View File

@ -9,7 +9,7 @@ using namespace Dawn;
PixelVNScene::PixelVNScene(DawnGame *game) :
SimpleVNScene(game),
renderTarget(320, 180)
renderTarget(1280, 720)
{
}

View File

@ -6,25 +6,32 @@
#pragma once
#include "scenes/PixelVNScene.hpp"
#include "scenes/Scene_2.hpp"
#include "prefabs/characters/DeathPrefab.hpp"
namespace Dawn {
class Scene_1 : public PixelVNScene {
protected:
DeathPrefab *death;
void vnStage() override {
PixelVNScene::vnStage();
this->death = DeathPrefab::create(this);
// this->death->vnCharacter.setOpacity(0);
}
void onSceneEnded() {
auto scene = new SubSceneRendererScene<Scene_2>(this->game);
auto assets = game->scene->getRequiredAssets();
game->assetManager.queueSwap(assets, this->getRequiredAssets());
game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets()
);
game->assetManager.syncLoad();
scene->stage();
this->game->sceneCutover(scene);
}
IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelPauseEvent(vnManager, 0.1f);
auto start = new VisualNovelPauseEvent(vnManager, 1.0f);
start
->then(new VisualNovelTextboxEvent(vnManager, nullptr, "scene.1.1"))
@ -40,7 +47,9 @@ namespace Dawn {
}
std::vector<Asset*> getRequiredAssets() override {
auto man = &this->game->assetManager;
std::vector<Asset*> assets = PixelVNScene::getRequiredAssets();
vectorAppend(&assets, DeathPrefab::getRequiredAssets(man));
return assets;
}
};

View File

@ -16,8 +16,9 @@ namespace Dawn {
void onSceneEnded() {
auto scene = new SubSceneRendererScene<Scene_11>(this->game);
auto assets = game->scene->getRequiredAssets();
game->assetManager.queueSwap(assets, this->getRequiredAssets());
game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets()
);
game->assetManager.syncLoad();
scene->stage();
this->game->sceneCutover(scene);

View File

@ -16,8 +16,9 @@ namespace Dawn {
void onSceneEnded() {
auto scene = new SubSceneRendererScene<Scene_12>(this->game);
auto assets = game->scene->getRequiredAssets();
game->assetManager.queueSwap(assets, this->getRequiredAssets());
game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets()
);
game->assetManager.syncLoad();
scene->stage();
this->game->sceneCutover(scene);

View File

@ -6,6 +6,7 @@
#pragma once
#include "PokerVNScene.hpp"
#include "prefabs/characters/PennyPrefab.hpp"
#include "scenes/Scene_13.hpp"
namespace Dawn {
class Scene_12 : public PokerVNScene {
@ -25,12 +26,13 @@ namespace Dawn {
}
void onSceneEnded() {
// auto scene = new SubSceneRendererScene<Scene_13>(this->game);
// auto assets = game->scene->getRequiredAssets();
// game->assetManager.queueSwap(assets, this->getRequiredAssets());
// game->assetManager.syncLoad();
// scene->stage();
// this->game->sceneCutover(scene);
auto scene = new SubSceneRendererScene<Scene_13>(this->game);
game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets()
);
game->assetManager.syncLoad();
scene->stage();
this->game->sceneCutover(scene);
}
std::vector<PokerPlayer *> getPokerPlayers() override {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,8 +16,9 @@ namespace Dawn {
void onSceneEnded() {
auto scene = new SubSceneRendererScene<Scene_3>(this->game);
auto assets = game->scene->getRequiredAssets();
game->assetManager.queueSwap(assets, this->getRequiredAssets());
game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets()
);
game->assetManager.syncLoad();
scene->stage();
this->game->sceneCutover(scene);

View File

@ -16,8 +16,9 @@ namespace Dawn {
void onSceneEnded() {
auto scene = new SubSceneRendererScene<Scene_4>(this->game);
auto assets = game->scene->getRequiredAssets();
game->assetManager.queueSwap(assets, this->getRequiredAssets());
game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets()
);
game->assetManager.syncLoad();
scene->stage();
this->game->sceneCutover(scene);

View File

@ -27,8 +27,9 @@ namespace Dawn {
void onSceneEnded() {
auto scene = new SubSceneRendererScene<Scene_5>(this->game);
auto assets = game->scene->getRequiredAssets();
game->assetManager.queueSwap(assets, this->getRequiredAssets());
game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets()
);
game->assetManager.syncLoad();
scene->stage();
this->game->sceneCutover(scene);

View File

@ -16,8 +16,9 @@ namespace Dawn {
void onSceneEnded() {
auto scene = new SubSceneRendererScene<Scene_6>(this->game);
auto assets = game->scene->getRequiredAssets();
game->assetManager.queueSwap(assets, this->getRequiredAssets());
game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets()
);
game->assetManager.syncLoad();
scene->stage();
this->game->sceneCutover(scene);

View File

@ -16,8 +16,9 @@ namespace Dawn {
void onSceneEnded() {
auto scene = new SubSceneRendererScene<Scene_7>(this->game);
auto assets = game->scene->getRequiredAssets();
game->assetManager.queueSwap(assets, this->getRequiredAssets());
game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets()
);
game->assetManager.syncLoad();
scene->stage();
this->game->sceneCutover(scene);

View File

@ -16,8 +16,9 @@ namespace Dawn {
void onSceneEnded() {
auto scene = new SubSceneRendererScene<Scene_8>(this->game);
auto assets = game->scene->getRequiredAssets();
game->assetManager.queueSwap(assets, this->getRequiredAssets());
game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets()
);
game->assetManager.syncLoad();
scene->stage();
this->game->sceneCutover(scene);

View File

@ -27,8 +27,9 @@ namespace Dawn {
void onSceneEnded() {
auto scene = new SubSceneRendererScene<Scene_9>(this->game);
auto assets = game->scene->getRequiredAssets();
game->assetManager.queueSwap(assets, this->getRequiredAssets());
game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets()
);
game->assetManager.syncLoad();
scene->stage();
this->game->sceneCutover(scene);

View File

@ -16,8 +16,9 @@ namespace Dawn {
void onSceneEnded() {
auto scene = new SubSceneRendererScene<Scene_10>(this->game);
auto assets = game->scene->getRequiredAssets();
game->assetManager.queueSwap(assets, this->getRequiredAssets());
game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets()
);
game->assetManager.syncLoad();
scene->stage();
this->game->sceneCutover(scene);