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

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