Little documentation update

This commit is contained in:
2022-12-14 06:27:10 -08:00
parent 850f4c227d
commit 6404f35b1c
17 changed files with 332 additions and 105 deletions

View File

@ -20,6 +20,7 @@ add_subdirectory(game)
add_subdirectory(prefabs)
add_subdirectory(ui)
add_subdirectory(visualnovel)
add_subdirectory(scenes)
# Assets
tool_texture(texture_test texture_test.png)

View File

@ -25,27 +25,24 @@ namespace Dawn {
auto textureAsset = scene->game->assetManager.get<TextureAsset>("texture_penny");
auto tilesetAsset = scene->game->assetManager.get<TilesetAsset>("tileset_penny");
// auto meshRenderer = item->addComponent<MeshRenderer>();
// auto material = item->addComponent<Material>();
// auto meshHost = item->addComponent<MeshHost>();
// auto tiledSprite = item->addComponent<TiledSprite>();
// auto animation = item->addComponent<AnimationController>();
auto meshRenderer = item->addComponent<MeshRenderer>();
auto material = item->addComponent<Material>();
auto meshHost = item->addComponent<MeshHost>();
auto tiledSprite = item->addComponent<TiledSprite>();
auto animation = item->addComponent<AnimationController>();
auto pokerPlayer = item->addComponent<PokerPlayer>();
return item;
// auto param = material->getShader()->getParameterByName("u_Text");
// material->textureValues[param] = &textureAsset->texture;
auto param = material->getShader()->getParameterByName("u_Text");
material->textureValues[param] = &textureAsset->texture;
// tiledSprite->setTileset(&tilesetAsset->tileset);
// tiledSprite->setSize(glm::vec2(tilesetAsset->tileset.divX, tilesetAsset->tileset.divY));
tiledSprite->setTilesetAndSize(&tilesetAsset->tileset);
// 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;
// return item;
return item;
}
};
}

View File

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

View File

@ -0,0 +1,57 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "SimpleVNScene.hpp"
using namespace Dawn;
SimpleVNScene::SimpleVNScene(DawnGame *game) : Scene(game) {
}
std::vector<Asset*> SimpleVNScene::getRequiredAssets() {
auto assMan = &this->game->assetManager;
std::vector<Asset*> assets;
vectorAppend(&assets, &PokerGameTextbox::getAssets(assMan));
vectorAppend(&assets, &PokerPlayerDisplay::getAssets(assMan));
vectorAppend(&assets, &VNPenny::getAssets(assMan));
return assets;
}
void SimpleVNScene::stage() {
// Camera
this->camera = Camera::create(this);
this->camera->transform->lookAtPixelPerfect(
glm::vec3(0, 0, 0),
glm::vec3(0, 0, 0),
1.0f,
camera->fov
);
// UI
this->canvas = UICanvas::createCanvas(this);
this->textbox = PokerGameTextbox::create(canvas);
this->background = SimpleVisualNovelBackground::create(this);
// VN Manager
auto vnManagerItem = this->createSceneItem();
this->vnManager = vnManagerItem->addComponent<VisualNovelManager>();
// Stage VN Items
this->vnStage();
// Fader (Drawn over the top of everything else)
this->vnFader = VisualNovelFader::create(canvas);
// Begin VN.
this->vnManager->setEvent(this->getVNEvent());
}
void SimpleVNScene::vnStage() {
}

View File

@ -0,0 +1,48 @@
// Copyright (c) 2022 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 "util/array.hpp"
#include "scene/components/Components.hpp"
#include "ui/PokerGameTextbox.hpp"
#include "visualnovel/VisualNovelManager.hpp"
#include "visualnovel/events/VisualNovelTextboxEvent.hpp"
#include "visualnovel/events/VisualNovelPauseEvent.hpp"
#include "visualnovel/events/VisualNovelFadeEvent.hpp"
#include "visualnovel/events/VisualNovelChangeSimpleBackgroundEvent.hpp"
#include "poker/PokerGame.hpp"
#include "visualnovel/events/PokerBetLoopEvent.hpp"
#include "visualnovel/events/PokerInitialEvent.hpp"
#include "ui/PokerPlayerDisplay.hpp"
#include "prefabs/VNPenny.hpp"
namespace Dawn {
class SimpleVNScene : public Scene {
protected:
Camera *camera = nullptr;
UICanvas *canvas = nullptr;
VisualNovelTextbox *textbox = nullptr;
SimpleVisualNovelBackground *background = nullptr;
VisualNovelFader *vnFader = nullptr;
VisualNovelManager *vnManager = nullptr;
virtual void vnStage();
virtual IVisualNovelEvent * getVNEvent() = 0;
public:
/**
* Constructs a new Simple VN Scene. Custom class that implements the most
* common VN Things.
*
* @param game
*/
SimpleVNScene(DawnGame *game);
std::vector<Asset*> getRequiredAssets() override;
void stage() override;
};
}

View File

@ -4,60 +4,13 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "scene/Scene.hpp"
#include "game/DawnGame.hpp"
#include "util/array.hpp"
#include "scene/components/Components.hpp"
#include "ui/PokerGameTextbox.hpp"
#include "visualnovel/VisualNovelManager.hpp"
#include "visualnovel/events/VisualNovelTextboxEvent.hpp"
#include "visualnovel/events/VisualNovelPauseEvent.hpp"
#include "visualnovel/events/VisualNovelFadeEvent.hpp"
#include "visualnovel/events/VisualNovelChangeSimpleBackgroundEvent.hpp"
#include "poker/PokerGame.hpp"
#include "visualnovel/events/PokerBetLoopEvent.hpp"
#include "visualnovel/events/PokerInitialEvent.hpp"
#include "ui/PokerPlayerDisplay.hpp"
#include "prefabs/VNPenny.hpp"
#include "SimpleVNScene.hpp"
namespace Dawn {
class TestScene : public Scene {
public:
TestScene(DawnGame *game) : Scene(game) {
}
std::vector<Asset*> getRequiredAssets() override {
auto assMan = &this->game->assetManager;
std::vector<Asset*> assets;
vectorAppend(&assets, &PokerGameTextbox::getAssets(assMan));
vectorAppend(&assets, &PokerPlayerDisplay::getAssets(assMan));
vectorAppend(&assets, &VNPenny::getAssets(assMan));
assets.push_back(assMan->get<TextureAsset>("texture_tavern_night"));
return assets;
}
void stage() override {
// Camera
auto camera = Camera::create(this);
camera->transform->lookAtPixelPerfect(
glm::vec3(0, 0, 0),
glm::vec3(0, 0, 0),
1.0f,
camera->fov
);
// UI
auto canvas = UICanvas::createCanvas(this);
auto textbox = PokerGameTextbox::create(canvas);
auto background = SimpleVisualNovelBackground::create(this);
// VN Manager
auto vnManagerItem = this->createSceneItem();
auto vnManager = vnManagerItem->addComponent<VisualNovelManager>();
class TestScene : public SimpleVNScene {
protected:
void vnStage() override {
SimpleVNScene::vnStage();
// Poker Test
auto pokerGameItem = this->createSceneItem();
@ -71,14 +24,17 @@ namespace Dawn {
uiPlayer->setPlayer(player->getComponent<PokerPlayer>());
}
auto vnFader = VisualNovelFader::create(canvas);
}
IVisualNovelEvent * getVNEvent() override {
auto texture = this->game->assetManager.get<TextureAsset>("texture_tavern_night");
auto betting = vnManager
->setEvent(new VisualNovelChangeSimpleBackgroundEvent(
vnManager, &texture->texture
))
auto start = new VisualNovelChangeSimpleBackgroundEvent(
vnManager, &texture->texture
);
start
->then(new VisualNovelPauseEvent(vnManager, 1.0f))
->then(new VisualNovelFadeEvent(
vnManager, COLOR_BLACK, false, &easeOutCubic, 1.0f
@ -88,6 +44,21 @@ namespace Dawn {
->then(new VisualNovelTextboxEvent(vnManager, "Game Started"))
->then(new PokerInitialEvent(vnManager))
;
return start;
}
public:
TestScene(DawnGame *game) : SimpleVNScene(game) {
}
std::vector<Asset*> getRequiredAssets() override {
auto assMan = &this->game->assetManager;
std::vector<Asset*> assets;
vectorAppend(&assets, &SimpleVNScene::getRequiredAssets());
assets.push_back(assMan->get<TextureAsset>("texture_tavern_night"));
return assets;
}
};
}