Various changes
This commit is contained in:
@ -8,6 +8,7 @@ target_sources(${DAWN_TARGET_NAME}
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
RenderPipeline.cpp
|
RenderPipeline.cpp
|
||||||
Transform.cpp
|
Transform.cpp
|
||||||
|
Tileset.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# Subdirs
|
# Subdirs
|
||||||
|
78
src/dawn/display/Tileset.cpp
Normal file
78
src/dawn/display/Tileset.cpp
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
// Copyright (c) 2023 Dominic Masters
|
||||||
|
//
|
||||||
|
// This software is released under the MIT License.
|
||||||
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
#include "Tileset.hpp"
|
||||||
|
|
||||||
|
using namespace Dawn;
|
||||||
|
|
||||||
|
struct Tile Tileset::getTile(int32_t tile) {
|
||||||
|
assertTrue(tile >= 0);
|
||||||
|
assertTrue(tile < this->tiles.size());
|
||||||
|
return this->tiles[tile];
|
||||||
|
}
|
||||||
|
|
||||||
|
TilesetGrid::TilesetGrid() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TilesetGrid::TilesetGrid(
|
||||||
|
int32_t columns,
|
||||||
|
int32_t rows,
|
||||||
|
int32_t w,
|
||||||
|
int32_t h,
|
||||||
|
int32_t gapX,
|
||||||
|
int32_t gapY,
|
||||||
|
int32_t borderX,
|
||||||
|
int32_t borderY
|
||||||
|
) {
|
||||||
|
assertTrue(columns >= 1);
|
||||||
|
assertTrue(rows >= 1);
|
||||||
|
assertTrue(w >= 1);
|
||||||
|
assertTrue(h >= 1);
|
||||||
|
assertTrue(gapX >= 0);
|
||||||
|
assertTrue(gapY >= 0);
|
||||||
|
assertTrue(borderX >= 0);
|
||||||
|
assertTrue(borderY >= 0);
|
||||||
|
assertTrue(w >= (columns + (gapX * columns) + borderX + borderX));
|
||||||
|
assertTrue(h >= (rows + (gapY * rows) + borderY + borderY));
|
||||||
|
|
||||||
|
this->rows = rows;
|
||||||
|
this->columns = columns;
|
||||||
|
|
||||||
|
// Calculate division sizes (pixels)
|
||||||
|
this->divX = (w - (borderX * 2) - (gapX * (columns - 1))) / columns;
|
||||||
|
this->divY = (h - (borderY * 2) - (gapY * (rows - 1))) / rows;
|
||||||
|
|
||||||
|
// Calculate the division sizes (units)
|
||||||
|
float_t tdivX = (float_t)this->divX / (float_t)w;
|
||||||
|
float_t tdivY = (float_t)this->divY / (float_t)h;
|
||||||
|
|
||||||
|
for(int32_t y = 0; y < rows; y++) {
|
||||||
|
for(int32_t x = 0; x < columns; x++) {
|
||||||
|
struct Tile tile;
|
||||||
|
tile.uv0.x = (borderX + ((float_t)this->divX * x) + (gapX * x)) / w;
|
||||||
|
tile.uv1.x = tile.uv0.x + tdivX;
|
||||||
|
|
||||||
|
tile.uv0.y = (borderY + ((float_t)this->divY * y) + (gapY * y)) / h;
|
||||||
|
tile.uv1.y = tile.uv0.y + tdivY;
|
||||||
|
this->tiles.push_back(tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float_t TilesetGrid::getTileWidth() {
|
||||||
|
return this->divX;
|
||||||
|
}
|
||||||
|
|
||||||
|
float_t TilesetGrid::getTileHeight() {
|
||||||
|
return this->divY;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Tile TilesetGrid::getTileFromGrid(int32_t column, int32_t row) {
|
||||||
|
assertTrue(row > 0 && row < this->rows);
|
||||||
|
assertTrue(column > 0 && column < this->columns);
|
||||||
|
return this->getTile(row + (column * this->rows));
|
||||||
|
}
|
@ -5,23 +5,25 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "dawnlibs.hpp"
|
#include "dawnlibs.hpp"
|
||||||
|
#include "assert/assert.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
struct Tile {
|
struct Tile {
|
||||||
public:
|
glm::vec2 uv0;
|
||||||
glm::vec2 uv0;
|
glm::vec2 uv1;
|
||||||
glm::vec2 uv1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Tileset {
|
struct Tileset {
|
||||||
public:
|
public:
|
||||||
std::vector<struct Tile> tiles;
|
std::vector<struct Tile> tiles;
|
||||||
|
|
||||||
struct Tile getTile(int32_t tile) {
|
/**
|
||||||
assertTrue(tile >= 0);
|
* Returns the tile at the given tile index.
|
||||||
assertTrue(tile < this->tiles.size());
|
*
|
||||||
return this->tiles[tile];
|
* @param tile Tile index to get.
|
||||||
}
|
* @return Tile at that index.
|
||||||
|
*/
|
||||||
|
struct Tile getTile(int32_t tile);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TilesetGrid : public Tileset{
|
struct TilesetGrid : public Tileset{
|
||||||
@ -31,10 +33,23 @@ namespace Dawn {
|
|||||||
int32_t divX;
|
int32_t divX;
|
||||||
int32_t divY;
|
int32_t divY;
|
||||||
|
|
||||||
TilesetGrid() {
|
/**
|
||||||
|
* Constructs a new Tileset Grid.
|
||||||
}
|
*/
|
||||||
|
TilesetGrid();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new Tileset Grid.
|
||||||
|
*
|
||||||
|
* @param columns How many columns in the grid of tiles.
|
||||||
|
* @param rows How many rows in the grid of tiles.
|
||||||
|
* @param w Width of the grid.
|
||||||
|
* @param h Height of te grid.
|
||||||
|
* @param gapX Gap / Gutter between tiles.
|
||||||
|
* @param gapY Gap / Gutter between tiles.
|
||||||
|
* @param borderX Border at the edge of the grid before the first tiles.
|
||||||
|
* @param borderY Border at the edge of the grid before the first tiles.
|
||||||
|
*/
|
||||||
TilesetGrid(
|
TilesetGrid(
|
||||||
int32_t columns,
|
int32_t columns,
|
||||||
int32_t rows,
|
int32_t rows,
|
||||||
@ -44,46 +59,29 @@ namespace Dawn {
|
|||||||
int32_t gapY,
|
int32_t gapY,
|
||||||
int32_t borderX,
|
int32_t borderX,
|
||||||
int32_t borderY
|
int32_t borderY
|
||||||
) {
|
);
|
||||||
assertTrue(columns >= 1);
|
|
||||||
assertTrue(rows >= 1);
|
|
||||||
assertTrue(w >= 1);
|
|
||||||
assertTrue(h >= 1);
|
|
||||||
assertTrue(gapX >= 0);
|
|
||||||
assertTrue(gapY >= 0);
|
|
||||||
assertTrue(borderX >= 0);
|
|
||||||
assertTrue(borderY >= 0);
|
|
||||||
assertTrue(w >= (columns + (gapX * columns) + borderX + borderX));
|
|
||||||
assertTrue(h >= (rows + (gapY * rows) + borderY + borderY));
|
|
||||||
|
|
||||||
this->rows = rows;
|
/**
|
||||||
this->columns = columns;
|
* Returns the width of an individual tile.
|
||||||
|
*
|
||||||
|
* @return The tile width.
|
||||||
|
*/
|
||||||
|
float_t getTileWidth();
|
||||||
|
|
||||||
// Calculate division sizes (pixels)
|
/**
|
||||||
this->divX = (w - (borderX * 2) - (gapX * (columns - 1))) / columns;
|
* Returns the height of an individual tile.
|
||||||
this->divY = (h - (borderY * 2) - (gapY * (rows - 1))) / rows;
|
*
|
||||||
|
* @return The tile height.
|
||||||
|
*/
|
||||||
|
float_t getTileHeight();
|
||||||
|
|
||||||
// Calculate the division sizes (units)
|
/**
|
||||||
float_t tdivX = (float_t)this->divX / (float_t)w;
|
* Returns the tile at a given grid position.
|
||||||
float_t tdivY = (float_t)this->divY / (float_t)h;
|
*
|
||||||
|
* @param column Column (0 indexed) to get the tile of.
|
||||||
for(int32_t y = 0; y < rows; y++) {
|
* @param row Row (0 indexed) to get the tile of.
|
||||||
for(int32_t x = 0; x < columns; x++) {
|
* @return Tile at this grid position.
|
||||||
struct Tile tile;
|
*/
|
||||||
tile.uv0.x = (borderX + ((float_t)this->divX * x) + (gapX * x)) / w;
|
struct Tile getTileFromGrid(int32_t column, int32_t row);
|
||||||
tile.uv1.x = tile.uv0.x + tdivX;
|
|
||||||
|
|
||||||
tile.uv0.y = (borderY + ((float_t)this->divY * y) + (gapY * y)) / h;
|
|
||||||
tile.uv1.y = tile.uv0.y + tdivY;
|
|
||||||
this->tiles.push_back(tile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Tile getTileFromGrid(int32_t row, int32_t column) {
|
|
||||||
assertTrue(row > 0 && row < this->rows);
|
|
||||||
assertTrue(column > 0 && column < this->columns);
|
|
||||||
return this->getTile(row + (column * this->rows));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -8,6 +8,12 @@
|
|||||||
#include "assert/assert.hpp"
|
#include "assert/assert.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
|
/**
|
||||||
|
* Append a list on to another list.
|
||||||
|
*
|
||||||
|
* @param list Pointer to list that is being appended to.
|
||||||
|
* @param append Pointer to list that will be appended.
|
||||||
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void vectorAppend(std::vector<T> *list, std::vector<T> *append) {
|
void vectorAppend(std::vector<T> *list, std::vector<T> *append) {
|
||||||
assertNotNull(list);
|
assertNotNull(list);
|
||||||
@ -20,6 +26,12 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append a list on to another list.
|
||||||
|
*
|
||||||
|
* @param list Pointer to list that is being appended to.
|
||||||
|
* @param append List that will be appended.
|
||||||
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void vectorAppend(std::vector<T> *list, std::vector<T> append) {
|
void vectorAppend(std::vector<T> *list, std::vector<T> append) {
|
||||||
assertNotNull(list);
|
assertNotNull(list);
|
||||||
|
@ -25,11 +25,9 @@ void SimpleVNScene::stage() {
|
|||||||
|
|
||||||
// Camera
|
// Camera
|
||||||
this->camera = Camera::create(this);
|
this->camera = Camera::create(this);
|
||||||
this->camera->transform->lookAtPixelPerfect(
|
this->camera->transform->lookAt(
|
||||||
glm::vec3(0, 0, 0),
|
glm::vec3(0, 0, 3),
|
||||||
glm::vec3(0, 0, 0),
|
glm::vec3(0, 0, 0)
|
||||||
this->camera->getRenderTarget()->getHeight(),
|
|
||||||
camera->fov
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this->background = SimpleVisualNovelBackground::create(this);
|
this->background = SimpleVisualNovelBackground::create(this);
|
||||||
|
@ -22,6 +22,7 @@ target_include_directories(${DAWN_TARGET_NAME}
|
|||||||
add_subdirectory(game)
|
add_subdirectory(game)
|
||||||
add_subdirectory(ui)
|
add_subdirectory(ui)
|
||||||
add_subdirectory(visualnovel)
|
add_subdirectory(visualnovel)
|
||||||
|
add_subdirectory(prefabs)
|
||||||
add_subdirectory(save)
|
add_subdirectory(save)
|
||||||
add_subdirectory(scenes)
|
add_subdirectory(scenes)
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ tool_texture(texture_test texture_test.png)
|
|||||||
tool_language(language_en ${DIR_GAME_ASSETS}/locale/en.csv)
|
tool_language(language_en ${DIR_GAME_ASSETS}/locale/en.csv)
|
||||||
|
|
||||||
tool_tileset(tileset_death texture_death ${DIR_GAME_ASSETS}/characters/death/sheet.png 1 3)
|
tool_tileset(tileset_death texture_death ${DIR_GAME_ASSETS}/characters/death/sheet.png 1 3)
|
||||||
|
tool_tileset(tileset_penny texture_penny ${DIR_GAME_ASSETS}/characters/penny/sheet.png 1 3)
|
||||||
|
|
||||||
tool_truetype(truetype_alice ${DIR_GAME_ASSETS}/font/Alice-Regular.ttf truetype_alice 2048 2048 120)
|
tool_truetype(truetype_alice ${DIR_GAME_ASSETS}/font/Alice-Regular.ttf truetype_alice 2048 2048 120)
|
||||||
|
|
||||||
@ -41,6 +43,7 @@ add_dependencies(${DAWN_TARGET_NAME}
|
|||||||
language_en
|
language_en
|
||||||
|
|
||||||
tileset_death
|
tileset_death
|
||||||
|
tileset_penny
|
||||||
|
|
||||||
truetype_alice
|
truetype_alice
|
||||||
|
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#include "DawnGame.hpp"
|
#include "DawnGame.hpp"
|
||||||
#include "scenes/SubSceneRendererScene.hpp"
|
|
||||||
#include "scenes/Scene_1.hpp"
|
#include "scenes/Scene_1.hpp"
|
||||||
#include "scenes/TestUIScene.hpp"
|
|
||||||
|
|
||||||
using namespace Dawn;
|
using namespace Dawn;
|
||||||
|
|
||||||
@ -26,7 +24,7 @@ int32_t DawnGame::init() {
|
|||||||
this->renderManager.init();
|
this->renderManager.init();
|
||||||
this->audioManager.init();
|
this->audioManager.init();
|
||||||
|
|
||||||
this->scene = new TestUIScene(this);
|
this->scene = new Scene_1(this);
|
||||||
|
|
||||||
return DAWN_GAME_INIT_RESULT_SUCCESS;
|
return DAWN_GAME_INIT_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
6
src/dawnpokergame/prefabs/CMakeLists.txt
Normal file
6
src/dawnpokergame/prefabs/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Copyright (c) 2022 Dominic Masters
|
||||||
|
#
|
||||||
|
# This software is released under the MIT License.
|
||||||
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
add_subdirectory(characters)
|
11
src/dawnpokergame/prefabs/characters/CMakeLists.txt
Normal file
11
src/dawnpokergame/prefabs/characters/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Copyright (c) 2023 Dominic Masters
|
||||||
|
#
|
||||||
|
# This software is released under the MIT License.
|
||||||
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
# Sources
|
||||||
|
target_sources(${DAWN_TARGET_NAME}
|
||||||
|
PRIVATE
|
||||||
|
CharacterPrefab.cpp
|
||||||
|
DeathPrefab.cpp
|
||||||
|
)
|
8
src/dawnpokergame/prefabs/characters/CharacterPrefab.cpp
Normal file
8
src/dawnpokergame/prefabs/characters/CharacterPrefab.cpp
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Copyright (c) 2023 Dominic Masters
|
||||||
|
//
|
||||||
|
// This software is released under the MIT License.
|
||||||
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
#include "CharacterPrefab.hpp"
|
||||||
|
|
||||||
|
using namespace Dawn;
|
82
src/dawnpokergame/prefabs/characters/CharacterPrefab.hpp
Normal file
82
src/dawnpokergame/prefabs/characters/CharacterPrefab.hpp
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
// Copyright (c) 2023 Dominic Masters
|
||||||
|
//
|
||||||
|
// This software is released under the MIT License.
|
||||||
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "prefab/SceneItemPrefab.hpp"
|
||||||
|
#include "scene/Scene.hpp"
|
||||||
|
#include "scene/components/display/MeshRenderer.hpp"
|
||||||
|
#include "scene/components/display/AnimationController.hpp"
|
||||||
|
#include "scene/components/display/MeshHost.hpp"
|
||||||
|
#include "scene/components/display/material/SimpleTexturedMaterial.hpp"
|
||||||
|
#include "scene/components/audio/AudioSource.hpp"
|
||||||
|
#include "visualnovel/components/VisualNovelCharacter.hpp"
|
||||||
|
|
||||||
|
namespace Dawn {
|
||||||
|
template<class T>
|
||||||
|
class CharacterPrefab : public SceneItemPrefab<T> {
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* Character Prefab will request you to initialize your characters'
|
||||||
|
* emotions here, including loading assets,
|
||||||
|
*
|
||||||
|
* @return struct VisualNovelCharacterEmotion
|
||||||
|
*/
|
||||||
|
virtual struct VisualNovelCharacterEmotion defineAndGetInitialEmotion(
|
||||||
|
AssetManager *assMan
|
||||||
|
) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
static std::vector<Asset*> prefabAssets(AssetManager *assMan) {
|
||||||
|
return std::vector<Asset*>{
|
||||||
|
assMan->get<TextureAsset>(T::getCharacterTexture()),
|
||||||
|
assMan->get<TilesetAsset>(T::getCharacterTileset())
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Instance
|
||||||
|
VisualNovelCharacter *vnCharacter;
|
||||||
|
AnimationController *animation;
|
||||||
|
TextureAsset *characterTexture;
|
||||||
|
TilesetAsset *characterTileset;
|
||||||
|
MeshRenderer *meshRenderer;
|
||||||
|
MeshHost *meshHost;
|
||||||
|
SimpleTexturedMaterial *material;
|
||||||
|
TiledSprite *tiledSprite;
|
||||||
|
AudioSource *audioSource;
|
||||||
|
|
||||||
|
CharacterPrefab(Scene *s, sceneitemid_t i) : SceneItemPrefab(s, i) {}
|
||||||
|
|
||||||
|
void prefabInit(AssetManager *man) override {
|
||||||
|
characterTexture = man->get<TextureAsset>(T::getCharacterTexture());
|
||||||
|
characterTileset = man->get<TilesetAsset>(T::getCharacterTileset());
|
||||||
|
|
||||||
|
// Emotions
|
||||||
|
auto emotion = this->defineAndGetInitialEmotion(man);
|
||||||
|
|
||||||
|
// Components
|
||||||
|
meshRenderer = this->addComponent<MeshRenderer>();
|
||||||
|
meshHost = this->addComponent<MeshHost>();
|
||||||
|
|
||||||
|
material = this->addComponent<SimpleTexturedMaterial>();
|
||||||
|
material->texture = &characterTexture->texture;
|
||||||
|
|
||||||
|
vnCharacter = this->addComponent<VisualNovelCharacter>();
|
||||||
|
vnCharacter->nameKey = T::getLanguagePrefix() + ".name";
|
||||||
|
|
||||||
|
animation = this->addComponent<AnimationController>();
|
||||||
|
|
||||||
|
tiledSprite = this->addComponent<TiledSprite>();
|
||||||
|
tiledSprite->setTileset(&characterTileset->tileset);
|
||||||
|
float_t ratio = characterTileset->tileset.getTileWidth() / characterTileset->tileset.getTileHeight();
|
||||||
|
tiledSprite->setSize(glm::vec2(ratio, 1.0f));
|
||||||
|
tiledSprite->setTile(emotion.tile);
|
||||||
|
|
||||||
|
audioSource = this->addComponent<AudioSource>();
|
||||||
|
|
||||||
|
this->transform.setLocalPosition(glm::vec3(0, 0, 0));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
32
src/dawnpokergame/prefabs/characters/DeathPrefab.cpp
Normal file
32
src/dawnpokergame/prefabs/characters/DeathPrefab.cpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (c) 2023 Dominic Masters
|
||||||
|
//
|
||||||
|
// This software is released under the MIT License.
|
||||||
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
#include "DeathPrefab.hpp"
|
||||||
|
|
||||||
|
using namespace Dawn;
|
||||||
|
|
||||||
|
std::string DeathPrefab::getCharacterTexture() {
|
||||||
|
return "texture_penny";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string DeathPrefab::getCharacterTileset() {
|
||||||
|
return "tileset_penny";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string DeathPrefab::getLanguagePrefix() {
|
||||||
|
return "character.death";
|
||||||
|
}
|
||||||
|
|
||||||
|
struct VisualNovelCharacterEmotion DeathPrefab::defineAndGetInitialEmotion(
|
||||||
|
AssetManager *man
|
||||||
|
) {
|
||||||
|
this->emotionHappy.tile = 0;
|
||||||
|
|
||||||
|
this->emotionConcerned.tile = 1;
|
||||||
|
|
||||||
|
this->emotionSurprised.tile = 2;
|
||||||
|
|
||||||
|
return this->emotionHappy;
|
||||||
|
}
|
@ -4,61 +4,25 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "prefab/SceneItemPrefab.hpp"
|
#include "prefabs/characters/CharacterPrefab.hpp"
|
||||||
#include "asset/AssetManager.hpp"
|
|
||||||
#include "poker/PokerPlayer.hpp"
|
|
||||||
#include "scene/components/Components.hpp"
|
|
||||||
#include "visualnovel/components/VisualNovelCharacter.hpp"
|
|
||||||
#include "display/animation/TiledSpriteAnimation.hpp"
|
|
||||||
#include "scene/components/display/material/SimpleTexturedMaterial.hpp"
|
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
class DeathPrefab : public SceneItemPrefab<DeathPrefab> {
|
class DeathPrefab : public CharacterPrefab<DeathPrefab> {
|
||||||
|
protected:
|
||||||
|
|
||||||
|
struct VisualNovelCharacterEmotion defineAndGetInitialEmotion(
|
||||||
|
AssetManager *man
|
||||||
|
) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VisualNovelCharacter *vnCharacter;
|
static std::string getCharacterTexture();
|
||||||
AnimationController *animation;
|
static std::string getCharacterTileset();
|
||||||
|
static std::string getLanguagePrefix();
|
||||||
|
|
||||||
|
struct VisualNovelCharacterEmotion emotionHappy;
|
||||||
|
struct VisualNovelCharacterEmotion emotionConcerned;
|
||||||
|
struct VisualNovelCharacterEmotion emotionSurprised;
|
||||||
|
|
||||||
struct VisualNovelCharacterEmotion emotionDefault;
|
DeathPrefab(Scene *s, sceneitemid_t i) : CharacterPrefab(s,i) {}
|
||||||
|
|
||||||
static std::vector<Asset*> prefabAssets(AssetManager *assMan) {
|
|
||||||
return std::vector<Asset*>{
|
|
||||||
assMan->get<TextureAsset>("texture_death"),
|
|
||||||
assMan->get<TilesetAsset>("tileset_death"),
|
|
||||||
assMan->get<AudioAsset>("audio_test")
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
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 audioAsset = man->get<AudioAsset>("audio_test");
|
|
||||||
|
|
||||||
// Emotions
|
|
||||||
this->emotionDefault.talkSound = audioAsset;
|
|
||||||
|
|
||||||
auto meshRenderer = this->addComponent<MeshRenderer>();
|
|
||||||
auto meshHost = this->addComponent<MeshHost>();
|
|
||||||
|
|
||||||
auto material = this->addComponent<SimpleTexturedMaterial>();
|
|
||||||
material->texture = &textureAsset->texture;
|
|
||||||
|
|
||||||
vnCharacter = this->addComponent<VisualNovelCharacter>();
|
|
||||||
vnCharacter->nameKey = "character.death.name";
|
|
||||||
|
|
||||||
animation = this->addComponent<AnimationController>();
|
|
||||||
|
|
||||||
auto tiledSprite = this->addComponent<TiledSprite>();
|
|
||||||
tiledSprite->setTilesetAndSize(&tilesetAsset->tileset);
|
|
||||||
tiledSprite->setTile(0);
|
|
||||||
|
|
||||||
this->addComponent<AudioSource>();
|
|
||||||
|
|
||||||
this->transform.setLocalPosition(glm::vec3(0, 0, 0));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -19,19 +19,32 @@ namespace Dawn {
|
|||||||
PokerPlayer *pokerPlayer;
|
PokerPlayer *pokerPlayer;
|
||||||
SimpleTexturedMaterial *material;
|
SimpleTexturedMaterial *material;
|
||||||
|
|
||||||
|
struct VisualNovelCharacterEmotion emotionHappy;
|
||||||
|
struct VisualNovelCharacterEmotion emotionSurprised;
|
||||||
|
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_death"),
|
assMan->get<TextureAsset>("texture_penny"),
|
||||||
assMan->get<TilesetAsset>("tileset_death")
|
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 {
|
||||||
auto textureAsset = man->get<TextureAsset>("texture_death");
|
// Assets
|
||||||
auto tilesetAsset = man->get<TilesetAsset>("tileset_death");
|
auto textureAsset = man->get<TextureAsset>("texture_penny");
|
||||||
|
auto tilesetAsset = man->get<TilesetAsset>("tileset_penny");
|
||||||
|
|
||||||
|
// Emotions
|
||||||
|
this->emotionHappy.tile = 0;
|
||||||
|
|
||||||
|
this->emotionSurprised.tile = 1;
|
||||||
|
|
||||||
|
this->emotionConcerned.tile = 2;
|
||||||
|
|
||||||
|
// Components
|
||||||
auto meshRenderer = this->addComponent<MeshRenderer>();
|
auto meshRenderer = this->addComponent<MeshRenderer>();
|
||||||
auto meshHost = this->addComponent<MeshHost>();
|
auto meshHost = this->addComponent<MeshHost>();
|
||||||
|
|
||||||
@ -50,11 +63,6 @@ namespace Dawn {
|
|||||||
tiledSprite->setTile(0);
|
tiledSprite->setTile(0);
|
||||||
|
|
||||||
this->transform.setLocalPosition(glm::vec3(0, 0, 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;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -6,7 +6,5 @@
|
|||||||
# Sources
|
# Sources
|
||||||
target_sources(${DAWN_TARGET_NAME}
|
target_sources(${DAWN_TARGET_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
PixelVNScene.cpp
|
|
||||||
PokerVNScene.cpp
|
PokerVNScene.cpp
|
||||||
TestUIScene.cpp
|
|
||||||
)
|
)
|
@ -1,28 +0,0 @@
|
|||||||
// Copyright (c) 2023 Dominic Masters
|
|
||||||
//
|
|
||||||
// This software is released under the MIT License.
|
|
||||||
// https://opensource.org/licenses/MIT
|
|
||||||
|
|
||||||
#include "PixelVNScene.hpp"
|
|
||||||
|
|
||||||
using namespace Dawn;
|
|
||||||
|
|
||||||
PixelVNScene::PixelVNScene(DawnGame *game) :
|
|
||||||
SimpleVNScene(game),
|
|
||||||
renderTarget(1280, 720)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<Asset*> PixelVNScene::getRequiredAssets() {
|
|
||||||
auto assMan = &this->game->assetManager;
|
|
||||||
std::vector<Asset*> assets;
|
|
||||||
vectorAppend(&assets, SimpleVNScene::getRequiredAssets());
|
|
||||||
return assets;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PixelVNScene::vnStage() {
|
|
||||||
this->renderTarget.setClearColor(COLOR_RED);
|
|
||||||
// this->camera->setRenderTarget(&this->renderTarget);
|
|
||||||
auto pixelPerfectCamera = this->camera->item->addComponent<PixelPerfectCamera>();
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
// Copyright (c) 2023 Dominic Masters
|
|
||||||
//
|
|
||||||
// This software is released under the MIT License.
|
|
||||||
// https://opensource.org/licenses/MIT
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "visualnovel/scene/SimpleVNScene.hpp"
|
|
||||||
#include "display/TextureRenderTarget.hpp"
|
|
||||||
#include "game/DawnGame.hpp"
|
|
||||||
|
|
||||||
namespace Dawn {
|
|
||||||
class PixelVNScene : public SimpleVNScene {
|
|
||||||
protected:
|
|
||||||
void vnStage() override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
TextureRenderTarget renderTarget;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a simple Poker Visual Novel Scene. Simplifies some of the less
|
|
||||||
* interesting parts of a poker VN game.
|
|
||||||
*
|
|
||||||
* @param game Game that this poker scene belongs to.
|
|
||||||
*/
|
|
||||||
PixelVNScene(DawnGame *game);
|
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override;
|
|
||||||
};
|
|
||||||
}
|
|
@ -7,20 +7,20 @@
|
|||||||
|
|
||||||
using namespace Dawn;
|
using namespace Dawn;
|
||||||
|
|
||||||
PokerVNScene::PokerVNScene(DawnGame *game) : PixelVNScene(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, PixelVNScene::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() {
|
||||||
PixelVNScene::vnStage();
|
|
||||||
auto pokerGameItem = this->createSceneItem();
|
auto pokerGameItem = this->createSceneItem();
|
||||||
this->pokerGame = pokerGameItem->addComponent<PokerGame>();
|
this->pokerGame = pokerGameItem->addComponent<PokerGame>();
|
||||||
|
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "scenes/PixelVNScene.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 PixelVNScene {
|
class PokerVNScene : public SimpleVNScene {
|
||||||
protected:
|
protected:
|
||||||
void vnStage() override;
|
void vnStage() override;
|
||||||
std::vector<Asset*> getRequiredAssets() override;
|
std::vector<Asset*> getRequiredAssets() override;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "scenes/PixelVNScene.hpp"
|
#include "visualnovel/scene/SimpleVNScene.hpp"
|
||||||
#include "scenes/Scene_2.hpp"
|
#include "scenes/Scene_2.hpp"
|
||||||
#include "prefabs/characters/DeathPrefab.hpp"
|
#include "prefabs/characters/DeathPrefab.hpp"
|
||||||
#include "visualnovel/events/characters/VisualNovelFadeCharacterEvent.hpp"
|
#include "visualnovel/events/characters/VisualNovelFadeCharacterEvent.hpp"
|
||||||
@ -12,18 +12,17 @@
|
|||||||
#include "visualnovel/events/timing/VisualNovelBatchEvent.hpp"
|
#include "visualnovel/events/timing/VisualNovelBatchEvent.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
class Scene_1 : public PixelVNScene {
|
class Scene_1 : public SimpleVNScene {
|
||||||
protected:
|
protected:
|
||||||
DeathPrefab *death;
|
DeathPrefab *death;
|
||||||
|
|
||||||
void vnStage() override {
|
void vnStage() override {
|
||||||
PixelVNScene::vnStage();
|
|
||||||
|
|
||||||
this->death = DeathPrefab::create(this);
|
this->death = DeathPrefab::create(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<Scene_2>(this->game);
|
auto scene = new Scene_2(this->game);
|
||||||
game->assetManager.queueSwap(
|
game->assetManager.queueSwap(
|
||||||
scene->getRequiredAssets(), this->getRequiredAssets()
|
scene->getRequiredAssets(), this->getRequiredAssets()
|
||||||
);
|
);
|
||||||
@ -33,13 +32,13 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Scene_1(DawnGame *game) : PixelVNScene(game) {
|
Scene_1(DawnGame *game) : SimpleVNScene(game) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override {
|
std::vector<Asset*> getRequiredAssets() override {
|
||||||
auto man = &this->game->assetManager;
|
auto man = &this->game->assetManager;
|
||||||
std::vector<Asset*> assets = PixelVNScene::getRequiredAssets();
|
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
|
||||||
vectorAppend(&assets, DeathPrefab::getRequiredAssets(man));
|
vectorAppend(&assets, DeathPrefab::getRequiredAssets(man));
|
||||||
assets.push_back(man->get<AudioAsset>("audio_test"));
|
assets.push_back(man->get<AudioAsset>("audio_test"));
|
||||||
return assets;
|
return assets;
|
||||||
@ -48,7 +47,7 @@ namespace Dawn {
|
|||||||
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, this->death->vnCharacter, this->death->emotionDefault, "scene.1.1"))
|
->then(new VisualNovelTextboxEvent(vnManager, this->death->vnCharacter, this->death->emotionHappy, "scene.1.1"))
|
||||||
// ->then(new VisualNovelCallbackEvent<Scene_1>(vnManager, this, &Scene_1::onSceneEnded))
|
// ->then(new VisualNovelCallbackEvent<Scene_1>(vnManager, this, &Scene_1::onSceneEnded))
|
||||||
;
|
;
|
||||||
return start;
|
return start;
|
||||||
|
@ -4,18 +4,18 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "scenes/PixelVNScene.hpp"
|
#include "visualnovel/scene/SimpleVNScene.hpp"
|
||||||
#include "scenes/Scene_11.hpp"
|
#include "scenes/Scene_11.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
class Scene_10 : public PixelVNScene {
|
class Scene_10 : public SimpleVNScene {
|
||||||
protected:
|
protected:
|
||||||
void vnStage() override {
|
void vnStage() override {
|
||||||
PixelVNScene::vnStage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
@ -25,11 +25,11 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Scene_10(DawnGame *game) : PixelVNScene(game) {
|
Scene_10(DawnGame *game) : SimpleVNScene(game) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override {
|
std::vector<Asset*> getRequiredAssets() override {
|
||||||
std::vector<Asset*> assets = PixelVNScene::getRequiredAssets();
|
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
|
||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,18 +4,18 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "scenes/PixelVNScene.hpp"
|
#include "visualnovel/scene/SimpleVNScene.hpp"
|
||||||
#include "scenes/Scene_12.hpp"
|
#include "scenes/Scene_12.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
class Scene_11 : public PixelVNScene {
|
class Scene_11 : public SimpleVNScene {
|
||||||
protected:
|
protected:
|
||||||
void vnStage() override {
|
void vnStage() override {
|
||||||
PixelVNScene::vnStage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
@ -25,11 +25,11 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Scene_11(DawnGame *game) : PixelVNScene(game) {
|
Scene_11(DawnGame *game) : SimpleVNScene(game) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override {
|
std::vector<Asset*> getRequiredAssets() override {
|
||||||
std::vector<Asset*> assets = PixelVNScene::getRequiredAssets();
|
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
|
||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
|
@ -4,18 +4,18 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "scenes/PixelVNScene.hpp"
|
#include "visualnovel/scene/SimpleVNScene.hpp"
|
||||||
#include "scenes/Scene_14.hpp"
|
#include "scenes/Scene_14.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
class Scene_13 : public PixelVNScene {
|
class Scene_13 : public SimpleVNScene {
|
||||||
protected:
|
protected:
|
||||||
void vnStage() override {
|
void vnStage() override {
|
||||||
PixelVNScene::vnStage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
@ -25,11 +25,11 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Scene_13(DawnGame *game) : PixelVNScene(game) {
|
Scene_13(DawnGame *game) : SimpleVNScene(game) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override {
|
std::vector<Asset*> getRequiredAssets() override {
|
||||||
std::vector<Asset*> assets = PixelVNScene::getRequiredAssets();
|
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
|
||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,18 +4,18 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "scenes/PixelVNScene.hpp"
|
#include "visualnovel/scene/SimpleVNScene.hpp"
|
||||||
#include "scenes/Scene_15.hpp"
|
#include "scenes/Scene_15.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
class Scene_14 : public PixelVNScene {
|
class Scene_14 : public SimpleVNScene {
|
||||||
protected:
|
protected:
|
||||||
void vnStage() override {
|
void vnStage() override {
|
||||||
PixelVNScene::vnStage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
@ -25,11 +25,11 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Scene_14(DawnGame *game) : PixelVNScene(game) {
|
Scene_14(DawnGame *game) : SimpleVNScene(game) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override {
|
std::vector<Asset*> getRequiredAssets() override {
|
||||||
std::vector<Asset*> assets = PixelVNScene::getRequiredAssets();
|
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
|
||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,18 +4,18 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "scenes/PixelVNScene.hpp"
|
#include "visualnovel/scene/SimpleVNScene.hpp"
|
||||||
#include "scenes/Scene_16.hpp"
|
#include "scenes/Scene_16.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
class Scene_15 : public PixelVNScene {
|
class Scene_15 : public SimpleVNScene {
|
||||||
protected:
|
protected:
|
||||||
void vnStage() override {
|
void vnStage() override {
|
||||||
PixelVNScene::vnStage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
@ -25,11 +25,11 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Scene_15(DawnGame *game) : PixelVNScene(game) {
|
Scene_15(DawnGame *game) : SimpleVNScene(game) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override {
|
std::vector<Asset*> getRequiredAssets() override {
|
||||||
std::vector<Asset*> assets = PixelVNScene::getRequiredAssets();
|
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
|
||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,18 +4,18 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "scenes/PixelVNScene.hpp"
|
#include "visualnovel/scene/SimpleVNScene.hpp"
|
||||||
#include "scenes/Scene_17.hpp"
|
#include "scenes/Scene_17.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
class Scene_16 : public PixelVNScene {
|
class Scene_16 : public SimpleVNScene {
|
||||||
protected:
|
protected:
|
||||||
void vnStage() override {
|
void vnStage() override {
|
||||||
PixelVNScene::vnStage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
@ -24,11 +24,11 @@ namespace Dawn {
|
|||||||
this->game->sceneCutover(scene);
|
this->game->sceneCutover(scene);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
Scene_16(DawnGame *game) : PixelVNScene(game) {
|
Scene_16(DawnGame *game) : SimpleVNScene(game) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override {
|
std::vector<Asset*> getRequiredAssets() override {
|
||||||
std::vector<Asset*> assets = PixelVNScene::getRequiredAssets();
|
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
|
||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
|
@ -4,24 +4,24 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "scenes/PixelVNScene.hpp"
|
#include "visualnovel/scene/SimpleVNScene.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
class Scene_18 : public PixelVNScene {
|
class Scene_18 : public SimpleVNScene {
|
||||||
protected:
|
protected:
|
||||||
void vnStage() override {
|
void vnStage() override {
|
||||||
PixelVNScene::vnStage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Scene_18(DawnGame *game) : PixelVNScene(game) {
|
Scene_18(DawnGame *game) : SimpleVNScene(game) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override {
|
std::vector<Asset*> getRequiredAssets() override {
|
||||||
std::vector<Asset*> assets = PixelVNScene::getRequiredAssets();
|
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
|
||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,18 +4,18 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "scenes/PixelVNScene.hpp"
|
#include "visualnovel/scene/SimpleVNScene.hpp"
|
||||||
#include "scenes/Scene_3.hpp"
|
#include "scenes/Scene_3.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
class Scene_2 : public PixelVNScene {
|
class Scene_2 : public SimpleVNScene {
|
||||||
protected:
|
protected:
|
||||||
void vnStage() override {
|
void vnStage() override {
|
||||||
PixelVNScene::vnStage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
@ -25,12 +25,12 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Scene_2(DawnGame *game) : PixelVNScene(game) {
|
Scene_2(DawnGame *game) : SimpleVNScene(game) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override {
|
std::vector<Asset*> getRequiredAssets() override {
|
||||||
std::vector<Asset*> assets = PixelVNScene::getRequiredAssets();
|
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
|
||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,18 +4,18 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "scenes/PixelVNScene.hpp"
|
#include "visualnovel/scene/SimpleVNScene.hpp"
|
||||||
#include "scenes/Scene_4.hpp"
|
#include "scenes/Scene_4.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
class Scene_3 : public PixelVNScene {
|
class Scene_3 : public SimpleVNScene {
|
||||||
protected:
|
protected:
|
||||||
void vnStage() override {
|
void vnStage() override {
|
||||||
PixelVNScene::vnStage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
@ -25,12 +25,12 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Scene_3(DawnGame *game) : PixelVNScene(game) {
|
Scene_3(DawnGame *game) : SimpleVNScene(game) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override {
|
std::vector<Asset*> getRequiredAssets() override {
|
||||||
std::vector<Asset*> assets = PixelVNScene::getRequiredAssets();
|
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
|
||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
|
@ -4,18 +4,18 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "scenes/PixelVNScene.hpp"
|
#include "visualnovel/scene/SimpleVNScene.hpp"
|
||||||
#include "scenes/Scene_6.hpp"
|
#include "scenes/Scene_6.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
class Scene_5 : public PixelVNScene {
|
class Scene_5 : public SimpleVNScene {
|
||||||
protected:
|
protected:
|
||||||
void vnStage() override {
|
void vnStage() override {
|
||||||
PixelVNScene::vnStage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
@ -25,12 +25,12 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Scene_5(DawnGame *game) : PixelVNScene(game) {
|
Scene_5(DawnGame *game) : SimpleVNScene(game) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override {
|
std::vector<Asset*> getRequiredAssets() override {
|
||||||
std::vector<Asset*> assets = PixelVNScene::getRequiredAssets();
|
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
|
||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,18 +4,18 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "scenes/PixelVNScene.hpp"
|
#include "visualnovel/scene/SimpleVNScene.hpp"
|
||||||
#include "scenes/Scene_7.hpp"
|
#include "scenes/Scene_7.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
class Scene_6 : public PixelVNScene {
|
class Scene_6 : public SimpleVNScene {
|
||||||
protected:
|
protected:
|
||||||
void vnStage() override {
|
void vnStage() override {
|
||||||
PixelVNScene::vnStage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
@ -25,12 +25,12 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Scene_6(DawnGame *game) : PixelVNScene(game) {
|
Scene_6(DawnGame *game) : SimpleVNScene(game) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override {
|
std::vector<Asset*> getRequiredAssets() override {
|
||||||
std::vector<Asset*> assets = PixelVNScene::getRequiredAssets();
|
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
|
||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,18 +4,18 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "scenes/PixelVNScene.hpp"
|
#include "visualnovel/scene/SimpleVNScene.hpp"
|
||||||
#include "scenes/Scene_8.hpp"
|
#include "scenes/Scene_8.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
class Scene_7 : public PixelVNScene {
|
class Scene_7 : public SimpleVNScene {
|
||||||
protected:
|
protected:
|
||||||
void vnStage() override {
|
void vnStage() override {
|
||||||
PixelVNScene::vnStage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
@ -25,11 +25,11 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Scene_7(DawnGame *game) : PixelVNScene(game) {
|
Scene_7(DawnGame *game) : SimpleVNScene(game) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override {
|
std::vector<Asset*> getRequiredAssets() override {
|
||||||
std::vector<Asset*> assets = PixelVNScene::getRequiredAssets();
|
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
|
||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
|
@ -4,18 +4,18 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "scenes/PixelVNScene.hpp"
|
#include "visualnovel/scene/SimpleVNScene.hpp"
|
||||||
#include "scenes/Scene_10.hpp"
|
#include "scenes/Scene_10.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
class Scene_9 : public PixelVNScene {
|
class Scene_9 : public SimpleVNScene {
|
||||||
protected:
|
protected:
|
||||||
void vnStage() override {
|
void vnStage() override {
|
||||||
PixelVNScene::vnStage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSceneEnded() {
|
void onSceneEnded() {
|
||||||
auto scene = new SubSceneRendererScene<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()
|
||||||
);
|
);
|
||||||
@ -25,11 +25,11 @@ namespace Dawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Scene_9(DawnGame *game) : PixelVNScene(game) {
|
Scene_9(DawnGame *game) : SimpleVNScene(game) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override {
|
std::vector<Asset*> getRequiredAssets() override {
|
||||||
std::vector<Asset*> assets = PixelVNScene::getRequiredAssets();
|
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
|
||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,54 +0,0 @@
|
|||||||
// Copyright (c) 2023 Dominic Masters
|
|
||||||
//
|
|
||||||
// This software is released under the MIT License.
|
|
||||||
// https://opensource.org/licenses/MIT
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "scene/Scene.hpp"
|
|
||||||
#include "game/DawnGame.hpp"
|
|
||||||
#include "scene/components/display/material/SimpleTexturedMaterial.hpp"
|
|
||||||
|
|
||||||
namespace Dawn {
|
|
||||||
template<class T>
|
|
||||||
class SubSceneRendererScene : public Scene {
|
|
||||||
public:
|
|
||||||
Camera *camera;
|
|
||||||
SceneItem *sceneItem;
|
|
||||||
T subScene;
|
|
||||||
|
|
||||||
SubSceneRendererScene(DawnGame *game) : Scene(game), subScene(game) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<Asset*> getRequiredAssets() override {
|
|
||||||
return this->subScene.getRequiredAssets();
|
|
||||||
}
|
|
||||||
|
|
||||||
void stage() override {
|
|
||||||
// Stage subscene
|
|
||||||
this->subScene.stage();
|
|
||||||
|
|
||||||
// Create camera to render.
|
|
||||||
this->camera = Camera::create(this);
|
|
||||||
this->camera->getRenderTarget()->setClearColor(COLOR_BLACK);
|
|
||||||
|
|
||||||
// Add render quad.
|
|
||||||
this->sceneItem = this->createSceneItem();
|
|
||||||
auto host = this->sceneItem->addComponent<MeshHost>();
|
|
||||||
auto renderer = this->sceneItem->addComponent<MeshRenderer>();
|
|
||||||
|
|
||||||
auto material = this->sceneItem->addComponent<SimpleTexturedMaterial>();
|
|
||||||
material->texture = this->subScene.renderTarget.getTexture();
|
|
||||||
|
|
||||||
auto renderTargetQuad = this->sceneItem->addComponent<SimpleRenderTargetQuad>();
|
|
||||||
renderTargetQuad->setRenderTarget(&this->subScene.renderTarget);
|
|
||||||
|
|
||||||
auto subSceneController = this->sceneItem->addComponent<SubSceneController>();
|
|
||||||
subSceneController->setSubScene(&this->subScene);
|
|
||||||
|
|
||||||
auto subSceneCameraAlign = this->sceneItem->addComponent<SubSceneCameraAlign>();
|
|
||||||
subSceneCameraAlign->setRenderTarget(&this->subScene.renderTarget);
|
|
||||||
subSceneCameraAlign->setCamera(this->camera);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
// Copyright (c) 2023 Dominic Masters
|
|
||||||
//
|
|
||||||
// This software is released under the MIT License.
|
|
||||||
// https://opensource.org/licenses/MIT
|
|
||||||
|
|
||||||
#include "TestUIScene.hpp"
|
|
||||||
|
|
||||||
using namespace Dawn;
|
|
||||||
|
|
||||||
TestUIScene::TestUIScene(DawnGame *game) : Scene(game) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<Asset*> TestUIScene::getRequiredAssets() {
|
|
||||||
std::vector<Asset*> assets;
|
|
||||||
AssetManager *man = &this->game->assetManager;
|
|
||||||
assets.push_back(man->get<TrueTypeAsset>("truetype_alice"));
|
|
||||||
assets.push_back(man->get<TextureAsset>("texture_test"));
|
|
||||||
return assets;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestUIScene::stage() {
|
|
||||||
AssetManager *man = &this->game->assetManager;
|
|
||||||
|
|
||||||
// Camera
|
|
||||||
this->camera = Camera::create(this);
|
|
||||||
this->camera->transform->lookAt(glm::vec3(3, 3, 3), glm::vec3(0, 0, 0));
|
|
||||||
|
|
||||||
auto testCube = SimpleSpinningCubePrefab::create(this);
|
|
||||||
|
|
||||||
// UI
|
|
||||||
this->canvas = UICanvas::create(this);
|
|
||||||
|
|
||||||
// auto text = man->get<TextureAsset>("texture_test");
|
|
||||||
// auto border = this->canvas->addElement<UIBorder>();
|
|
||||||
// border->texture = &text->texture;
|
|
||||||
// border->setBorderSize(glm::vec2(4, 4));
|
|
||||||
// border->setTransform(
|
|
||||||
// UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH,
|
|
||||||
// glm::vec4(0, 0, 0, 0),
|
|
||||||
// 0.0f
|
|
||||||
// );
|
|
||||||
|
|
||||||
auto assetFont = man->get<TrueTypeAsset>("truetype_alice");
|
|
||||||
|
|
||||||
auto grid = this->canvas->addElement<UIGrid>();
|
|
||||||
grid->setTransform(UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH, glm::vec4(0, 0, 0, 0), 0);
|
|
||||||
grid->setGridSize(4, 4, 8, 8);
|
|
||||||
|
|
||||||
auto menu = new UIMenu(this->canvas, grid->getColumns(), grid->getRows());
|
|
||||||
|
|
||||||
for(int32_t x = 0; x < grid->getColumns(); x++) {
|
|
||||||
for(int32_t y = 0; y < grid->getRows(); y++) {
|
|
||||||
auto label = this->canvas->addElement<UILabel>();
|
|
||||||
label->setFont(&assetFont->font);
|
|
||||||
label->setText("test.1");
|
|
||||||
label->setFontSize(24);
|
|
||||||
grid->addToGrid(label, x, y, UI_COMPONENT_ALIGN_MIDDLE, UI_COMPONENT_ALIGN_MIDDLE);
|
|
||||||
|
|
||||||
auto menuItem = new TestMenuItem;
|
|
||||||
menuItem->label = label;
|
|
||||||
menu->setItem(x, y, menuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
menu->setPosition(0, 0);
|
|
||||||
this->canvas->setCurrentMenu(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->canvas->setCurrentMenu(menu);
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
// Copyright (c) 2023 Dominic Masters
|
|
||||||
//
|
|
||||||
// This software is released under the MIT License.
|
|
||||||
// https://opensource.org/licenses/MIT
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "scene/Scene.hpp"
|
|
||||||
#include "game/DawnGame.hpp"
|
|
||||||
#include "scene/components/ui/UICanvas.hpp"
|
|
||||||
#include "ui/UILabel.hpp"
|
|
||||||
#include "ui/UIBorder.hpp"
|
|
||||||
#include "ui/UIGrid.hpp"
|
|
||||||
#include "ui/UISprite.hpp"
|
|
||||||
#include "prefabs/SimpleSpinningCubePrefab.hpp"
|
|
||||||
#include "ui/UIMenu.hpp"
|
|
||||||
|
|
||||||
namespace Dawn {
|
|
||||||
class TestMenuItem : public UIMenuItem {
|
|
||||||
public:
|
|
||||||
UILabel *label;
|
|
||||||
void onItemSelected() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void onItemOver() {
|
|
||||||
this->label->setText("test.2");
|
|
||||||
}
|
|
||||||
|
|
||||||
void onItemOff() {
|
|
||||||
this->label->setText("test.1");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool_t canBeOvered() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool_t canBeSelected() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class TestUIScene : public Scene {
|
|
||||||
private:
|
|
||||||
Camera *camera = nullptr;
|
|
||||||
UICanvas *canvas = nullptr;
|
|
||||||
|
|
||||||
public:
|
|
||||||
TestUIScene(DawnGame *game);
|
|
||||||
std::vector<Asset*> getRequiredAssets() override;
|
|
||||||
void stage() override;
|
|
||||||
};
|
|
||||||
}
|
|
Reference in New Issue
Block a user