First attempt to play audio

This commit is contained in:
2023-01-17 00:11:22 -08:00
parent 15a34bd70b
commit 9fc4d2e4e2
54 changed files with 820 additions and 83 deletions

5
.gitignore vendored
View File

@ -77,4 +77,7 @@ yarn.lock
*.log
assets/borrowed
.~lock*
.~lock*
.vscode*
.VSCode*

6
.gitmodules vendored
View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

View File

@ -0,0 +1,93 @@
Copyright 2011 The Alice Project Authors (https://github.com/cyrealtype/Alice)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@ -1,5 +1,6 @@
undefined,UNDEFINED
hello.world,Hello World!
character.death.name,"Santa Muerte"
character.penny.name,Penny
scene.1.1,"This is the scene to explain that you're dead, lmao"
scene.2.1,"This scene has you waking in the new world"
@ -12,4 +13,10 @@ scene.8.1,"Orc Battle"
scene.9.1,"Immediately Post Orc Battle"
scene.10.1,"Morning after orc battle and some foreshadowing"
scene.11.1,"Pre battle with theif"
scene.12.1,"Battle with theif"
scene.12.1,"Battle with theif"
scene.13.1,"After battle with theif, things cool off a bit."
scene.14.1,"Harem times maybe"
scene.15.1,"Harem times interrupted by some chaos"
scene.16.1,"I'm putting chaos here but this scene is probably redundant."
scene.17.1,"Chaos battle"
scene.18.1,"Post Chaos Battle, things are still gloomy"
1 undefined UNDEFINED
2 hello.world Hello World!
3 character.death.name Santa Muerte
4 character.penny.name Penny
5 scene.1.1 This is the scene to explain that you're dead, lmao
6 scene.2.1 This scene has you waking in the new world
13 scene.9.1 Immediately Post Orc Battle
14 scene.10.1 Morning after orc battle and some foreshadowing
15 scene.11.1 Pre battle with theif
16 scene.12.1 Battle with theif
17 scene.13.1 After battle with theif, things cool off a bit.
18 scene.14.1 Harem times maybe
19 scene.15.1 Harem times interrupted by some chaos
20 scene.16.1 I'm putting chaos here but this scene is probably redundant.
21 scene.17.1 Chaos battle
22 scene.18.1 Post Chaos Battle, things are still gloomy

View File

@ -0,0 +1,21 @@
undefined,UNDEFINED
hello.world,Hello World!
character.penny.name,Penny
scene.1.1,"日本語パスコん"
scene.2.1,"This scene has you waking in the new world"
scene.3.1,"This is the scene to prep you for the first game"
scene.4.1,"First Poker Game with friendlies"
scene.5.1,"After first game, wind up maybe shop instructions or something"
scene.6.1,"Talk with death probably, check in on you, etc."
scene.7.1,"Pre-Orc Battle"
scene.8.1,"Orc Battle"
scene.9.1,"Immediately Post Orc Battle"
scene.10.1,"Morning after orc battle and some foreshadowing"
scene.11.1,"Pre battle with theif"
scene.12.1,"Battle with theif"
scene.13.1,"After battle with theif, things cool off a bit."
scene.14.1,"Harem times maybe"
scene.15.1,"Harem times interrupted by some chaos"
scene.16.1,"I'm putting chaos here but this scene is probably redundant."
scene.17.1,"Chaos battle"
scene.18.1,"Post Chaos Battle, things are still gloomy"
1 undefined UNDEFINED
2 hello.world Hello World!
3 character.penny.name Penny
4 scene.1.1 日本語パスコん
5 scene.2.1 This scene has you waking in the new world
6 scene.3.1 This is the scene to prep you for the first game
7 scene.4.1 First Poker Game with friendlies
8 scene.5.1 After first game, wind up maybe shop instructions or something
9 scene.6.1 Talk with death probably, check in on you, etc.
10 scene.7.1 Pre-Orc Battle
11 scene.8.1 Orc Battle
12 scene.9.1 Immediately Post Orc Battle
13 scene.10.1 Morning after orc battle and some foreshadowing
14 scene.11.1 Pre battle with theif
15 scene.12.1 Battle with theif
16 scene.13.1 After battle with theif, things cool off a bit.
17 scene.14.1 Harem times maybe
18 scene.15.1 Harem times interrupted by some chaos
19 scene.16.1 I'm putting chaos here but this scene is probably redundant.
20 scene.17.1 Chaos battle
21 scene.18.1 Post Chaos Battle, things are still gloomy

View File

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

Submodule lib/AudioFile added at 004065d01e

View File

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

Submodule lib/openal-soft added at c0cbe602ce

View File

@ -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) {

View 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>()
};
}
};
}

View File

@ -10,5 +10,5 @@ using namespace Dawn;
VisualNovelCharacter::VisualNovelCharacter(SceneItem *item) :
SceneItemComponent(item)
{
}

View File

@ -8,6 +8,8 @@
namespace Dawn {
class VisualNovelCharacter : public SceneItemComponent {
protected:
public:
std::string nameKey = "character.unknown";

View File

@ -8,6 +8,8 @@ target_link_libraries(${DAWN_TARGET_NAME}
PUBLIC
glfw
glad
OpenAL
AudioFile
)
# Includes

View File

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

View File

@ -23,4 +23,5 @@ target_include_directories(${DAWN_TARGET_NAME}
)
# Subdirs
add_subdirectory(display)
add_subdirectory(display)
add_subdirectory(scene)

View File

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

View 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)

View 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)

View 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)

View File

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

View File

@ -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;
}

View File

@ -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);
};
}

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);