First attempt to play audio
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@ -77,4 +77,7 @@ yarn.lock
|
||||
*.log
|
||||
assets/borrowed
|
||||
|
||||
.~lock*
|
||||
.~lock*
|
||||
|
||||
.vscode*
|
||||
.VSCode*
|
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -10,3 +10,9 @@
|
||||
[submodule "lib/SDL"]
|
||||
path = lib/SDL
|
||||
url = https://github.com/libsdl-org/SDL.git
|
||||
[submodule "lib/openal-soft"]
|
||||
path = lib/openal-soft
|
||||
url = https://github.com/kcat/openal-soft
|
||||
[submodule "lib/AudioFile"]
|
||||
path = lib/AudioFile
|
||||
url = https://github.com/adamstark/AudioFile.git
|
||||
|
@ -6,7 +6,7 @@
|
||||
# Check for build target, or default
|
||||
if(NOT DEFINED DAWN_BUILD_TARGET)
|
||||
if(WIN32)
|
||||
set(DAWN_BUILD_TARGET "target-pokergame-win32-sdl2")
|
||||
set(DAWN_BUILD_TARGET "target-pokergame-win32-glfw")
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
set(DAWN_BUILD_TARGET "target-pokergame-linux64-glfw")
|
||||
endif()
|
||||
|
1
lib/AudioFile
Submodule
1
lib/AudioFile
Submodule
Submodule lib/AudioFile added at 004065d01e
@ -3,18 +3,26 @@
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# GLAD
|
||||
add_subdirectory(glad)
|
||||
|
||||
# GLFW
|
||||
add_subdirectory(glfw)
|
||||
if(DAWN_TARGET_GLFW)
|
||||
add_subdirectory(glad)
|
||||
add_subdirectory(glfw)
|
||||
endif()
|
||||
|
||||
# SDL
|
||||
if(DAWN_TARGET_SDL2)
|
||||
add_subdirectory(glad)
|
||||
add_subdirectory(SDL)
|
||||
endif()
|
||||
|
||||
# GLM
|
||||
add_subdirectory(glm)
|
||||
|
||||
# SDL
|
||||
add_subdirectory(SDL)
|
||||
|
||||
# STB
|
||||
add_library(stb INTERFACE)
|
||||
target_include_directories(stb INTERFACE stb)
|
||||
target_include_directories(stb INTERFACE stb)
|
||||
|
||||
# OpenAL
|
||||
set(LIBTYPE "STATIC")
|
||||
add_subdirectory(openal-soft)
|
||||
add_subdirectory(AudioFile)
|
1
lib/openal-soft
Submodule
1
lib/openal-soft
Submodule
Submodule lib/openal-soft added at c0cbe602ce
@ -14,9 +14,7 @@ PokerPlayer::PokerPlayer(SceneItem *item) : SceneItemComponent(item) {
|
||||
|
||||
void PokerPlayer::onStart() {
|
||||
SceneItemComponent::onStart();
|
||||
|
||||
this->pokerGame = this->getScene()->findComponent<PokerGame>();
|
||||
assertNotNull(this->pokerGame);
|
||||
}
|
||||
|
||||
void PokerPlayer::addChips(int32_t chips) {
|
||||
|
60
src/dawn/scene/components/display/ShaderInterface.hpp
Normal file
60
src/dawn/scene/components/display/ShaderInterface.hpp
Normal file
@ -0,0 +1,60 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "scene/components/display/Material.hpp"
|
||||
#include "scene/SceneItem.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
template<class T>
|
||||
class ShaderInterface : public SceneItemComponent {
|
||||
public:
|
||||
/**
|
||||
* ShaderInterface to provide a common interface language for all shaders
|
||||
* that can be referenced by scene components.
|
||||
*
|
||||
* @param i SceneItem this Shader interface belongs to.
|
||||
*/
|
||||
ShaderInterface(SceneItem *i) : SceneItemComponent(i) {}
|
||||
|
||||
/**
|
||||
* Sets the shader for this shader interface to use. Will also update the
|
||||
* underlying material for you.
|
||||
*
|
||||
* @param shader Shader to use for this interface.
|
||||
*/
|
||||
void setShader(T *shader) {
|
||||
assertNotNull(shader);
|
||||
this->getMaterial()->setShader(shader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shader, assuming that the material has the correct shader.
|
||||
*
|
||||
* @return Pointer to the shader.
|
||||
*/
|
||||
T * getShader() {
|
||||
auto material = dynamic_cast<T*>(this->getMaterial()->getShader());
|
||||
return material;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the material attached to this scene item.
|
||||
*
|
||||
* @return The attached material.
|
||||
*/
|
||||
Material * getMaterial() {
|
||||
auto mat = this->item->getComponent<Material>();
|
||||
assertNotNull(mat);
|
||||
return mat;
|
||||
}
|
||||
|
||||
std::vector<SceneItemComponent*> getDependencies() override {
|
||||
return std::vector<SceneItemComponent*>{
|
||||
this->item->getComponent<Material>()
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
@ -10,5 +10,5 @@ using namespace Dawn;
|
||||
VisualNovelCharacter::VisualNovelCharacter(SceneItem *item) :
|
||||
SceneItemComponent(item)
|
||||
{
|
||||
|
||||
|
||||
}
|
@ -8,6 +8,8 @@
|
||||
|
||||
namespace Dawn {
|
||||
class VisualNovelCharacter : public SceneItemComponent {
|
||||
protected:
|
||||
|
||||
public:
|
||||
std::string nameKey = "character.unknown";
|
||||
|
||||
|
@ -8,6 +8,8 @@ target_link_libraries(${DAWN_TARGET_NAME}
|
||||
PUBLIC
|
||||
glfw
|
||||
glad
|
||||
OpenAL
|
||||
AudioFile
|
||||
)
|
||||
|
||||
# Includes
|
||||
|
@ -10,6 +10,10 @@
|
||||
#include "dawnopengl.hpp"
|
||||
#include "display/BackBufferRenderTarget.hpp"
|
||||
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#include "AudioFile.h"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
// Static declaration of the host, needed due to GLFW events being C-like
|
||||
@ -22,6 +26,92 @@ DawnHost::DawnHost() {
|
||||
}
|
||||
|
||||
int32_t DawnHost::init(DawnGame *game) {
|
||||
AudioFile<double> audioFile;
|
||||
audioFile.load ("C:\\sample.wav");
|
||||
audioFile.printSummary();
|
||||
|
||||
ALCdevice* device = alcOpenDevice(nullptr);
|
||||
if(!device) assertUnreachable();
|
||||
|
||||
ALCcontext *context;
|
||||
context = alcCreateContext(device, NULL);
|
||||
if(!alcMakeContextCurrent(context)) assertUnreachable();
|
||||
|
||||
ALfloat listenerOri[] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f };
|
||||
alListener3f(AL_POSITION, 0, 0, 1.0f);
|
||||
alListener3f(AL_VELOCITY, 0, 0, 0);
|
||||
alListenerfv(AL_ORIENTATION, listenerOri);
|
||||
|
||||
ALuint source;
|
||||
alGenSources((ALuint)1, &source);
|
||||
alSourcef(source, AL_PITCH, 1);
|
||||
alSourcef(source, AL_GAIN, 1);
|
||||
alSource3f(source, AL_POSITION, 0, 0, 0);
|
||||
alSource3f(source, AL_VELOCITY, 0, 0, 0);
|
||||
alSourcei(source, AL_LOOPING, AL_FALSE);
|
||||
|
||||
ALuint buffer;
|
||||
alGenBuffers((ALuint)1, &buffer);
|
||||
|
||||
ALenum format;
|
||||
switch(audioFile.getBitDepth()) {
|
||||
case 16:
|
||||
switch(audioFile.getNumChannels()) {
|
||||
case 2:
|
||||
format = AL_FORMAT_STEREO16;
|
||||
break;
|
||||
case 1:
|
||||
format = AL_FORMAT_MONO16;
|
||||
break;
|
||||
default:
|
||||
assertUnreachable();
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
switch(audioFile.getNumChannels()) {
|
||||
case 2:
|
||||
format = AL_FORMAT_STEREO8;
|
||||
break;
|
||||
case 1:
|
||||
format = AL_FORMAT_MONO8;
|
||||
break;
|
||||
default:
|
||||
assertUnreachable();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
assertUnreachable();
|
||||
}
|
||||
|
||||
std::vector<uint8_t> data;
|
||||
for (int i = 0; i < audioFile.getNumSamplesPerChannel(); i++) {
|
||||
for(int y = 0; y < audioFile.getNumChannels(); y++) {
|
||||
double sample = audioFile.samples[y][i];
|
||||
sample = mathClamp(sample, -1., 1.);
|
||||
auto q = static_cast<int16_t> (sample * 32767.);
|
||||
|
||||
uint8_t bytes[2];
|
||||
bytes[0] = (q >> 8) & 0xFF;
|
||||
bytes[1] = q & 0xFF;
|
||||
data.push_back(bytes[1]);
|
||||
data.push_back(bytes[0]);
|
||||
}
|
||||
}
|
||||
alBufferData(buffer, format, &data[0], data.size(), audioFile.getSampleRate());
|
||||
|
||||
ALint source_state;
|
||||
alSourcei(source, AL_BUFFER, buffer);
|
||||
alSourcePlay(source);
|
||||
alGetSourcei(source, AL_SOURCE_STATE, &source_state);
|
||||
while (source_state == AL_PLAYING) {
|
||||
alGetSourcei(source, AL_SOURCE_STATE, &source_state);
|
||||
}
|
||||
|
||||
return DAWN_HOST_INIT_RESULT_SUCCESS;
|
||||
|
||||
|
||||
// Update values
|
||||
this->game = game;
|
||||
DAWN_HOST = this;
|
||||
|
@ -23,4 +23,5 @@ target_include_directories(${DAWN_TARGET_NAME}
|
||||
)
|
||||
|
||||
# Subdirs
|
||||
add_subdirectory(display)
|
||||
add_subdirectory(display)
|
||||
add_subdirectory(scene)
|
@ -36,8 +36,10 @@ void Texture::setSize(int32_t width, int32_t height) {
|
||||
// Setup our preferred texture params, later this will be configurable.
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
// Initialize the texture to blank
|
||||
glTexImage2D(
|
||||
|
7
src/dawnopengl/scene/CMakeLists.txt
Normal file
7
src/dawnopengl/scene/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
# Copyright (c) 2023 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Subdirs
|
||||
add_subdirectory(components)
|
7
src/dawnopengl/scene/components/CMakeLists.txt
Normal file
7
src/dawnopengl/scene/components/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
# Copyright (c) 2023 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Subdirs
|
||||
add_subdirectory(display)
|
7
src/dawnopengl/scene/components/display/CMakeLists.txt
Normal file
7
src/dawnopengl/scene/components/display/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
# Copyright (c) 2023 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Subdirs
|
||||
add_subdirectory(shader)
|
@ -0,0 +1,10 @@
|
||||
# Copyright (c) 2023 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DAWN_TARGET_NAME}
|
||||
PRIVATE
|
||||
SimpleTexturedShaderInterface.cpp
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "SimpleTexturedShaderInterface.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
SimpleTexturedShaderInterface::SimpleTexturedShaderInterface(SceneItem *i) :
|
||||
ShaderInterface<SimpleTexturedShader>(i)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void SimpleTexturedShaderInterface::setTexture(Texture *texture) {
|
||||
this->getMaterial()->textureValues[this->getShader()->paramTexture] = texture;
|
||||
}
|
||||
|
||||
void SimpleTexturedShaderInterface::setColor(struct Color color) {
|
||||
this->getMaterial()->colorValues[this->getShader()->paramColor] = color;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "scene/components/display/ShaderInterface.hpp"
|
||||
#include "display/shader/SimpleTexturedShader.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class SimpleTexturedShaderInterface :
|
||||
public ShaderInterface<SimpleTexturedShader>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* SimpleTexturedShader scene item component interface.
|
||||
*
|
||||
* @param i Scene Item this interface belongs to.
|
||||
*/
|
||||
SimpleTexturedShaderInterface(SceneItem *i);
|
||||
|
||||
/**
|
||||
* Sets the primary colour texture to be used by the shader.
|
||||
*
|
||||
* @param texture Texture to use.
|
||||
*/
|
||||
void setTexture(Texture *texture);
|
||||
|
||||
/**
|
||||
* Sets the multiplicitive color to be used by the shader.
|
||||
*
|
||||
* @param color Color to be used.
|
||||
*/
|
||||
void setColor(struct Color color);
|
||||
};
|
||||
}
|
@ -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
|
||||
)
|
@ -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;
|
||||
}
|
||||
|
52
src/dawnpokergame/prefabs/characters/DeathPrefab.hpp
Normal file
52
src/dawnpokergame/prefabs/characters/DeathPrefab.hpp
Normal 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));
|
||||
}
|
||||
};
|
||||
}
|
@ -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;
|
||||
}
|
||||
};
|
||||
}
|
@ -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,
|
||||
|
@ -9,7 +9,7 @@ using namespace Dawn;
|
||||
|
||||
PixelVNScene::PixelVNScene(DawnGame *game) :
|
||||
SimpleVNScene(game),
|
||||
renderTarget(320, 180)
|
||||
renderTarget(1280, 720)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
47
src/dawnpokergame/scenes/Scene_13.hpp
Normal file
47
src/dawnpokergame/scenes/Scene_13.hpp
Normal 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;
|
||||
}
|
||||
};
|
||||
}
|
47
src/dawnpokergame/scenes/Scene_14.hpp
Normal file
47
src/dawnpokergame/scenes/Scene_14.hpp
Normal 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;
|
||||
}
|
||||
};
|
||||
}
|
47
src/dawnpokergame/scenes/Scene_15.hpp
Normal file
47
src/dawnpokergame/scenes/Scene_15.hpp
Normal 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;
|
||||
}
|
||||
};
|
||||
}
|
47
src/dawnpokergame/scenes/Scene_16.hpp
Normal file
47
src/dawnpokergame/scenes/Scene_16.hpp
Normal 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;
|
||||
}
|
||||
};
|
||||
}
|
68
src/dawnpokergame/scenes/Scene_17.hpp
Normal file
68
src/dawnpokergame/scenes/Scene_17.hpp
Normal 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;
|
||||
}
|
||||
};
|
||||
}
|
39
src/dawnpokergame/scenes/Scene_18.hpp
Normal file
39
src/dawnpokergame/scenes/Scene_18.hpp
Normal 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;
|
||||
}
|
||||
};
|
||||
}
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user