Started work on prefabs.

This commit is contained in:
2022-12-19 22:41:16 -08:00
parent 53ebbf0699
commit d619e33763
24 changed files with 403 additions and 15 deletions

View File

@ -0,0 +1,31 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "SimpleVNScene.hpp"
namespace Dawn {
class Scene_1_1 : public SimpleVNScene {
protected:
void vnStage() override {
SimpleVNScene::vnStage();
}
std::vector<Asset*> getRequiredAssets() override {
auto assMan = &this->game->assetManager;
std::vector<Asset*> assets;
vectorAppend(&assets, &SimpleVNScene::getRequiredAssets());
return assets;
}
IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelTextboxEvent(vnManager,nullptr,"scene.1.1");
return start;
}
public:
Scene_1_1(DawnGame *game) : SimpleVNScene(game) {}
};
}

View File

@ -1,51 +0,0 @@
// 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;
return PokerGameTextbox::getAssets(assMan);
}
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

@ -1,43 +0,0 @@
// 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"
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

@ -41,7 +41,7 @@ namespace Dawn {
);
start
->then(new VisualNovelTextboxEvent(vnManager, penny->getComponent<VisualNovelCharacter>(), "undefined"))
->then(new VisualNovelTextboxEvent(vnManager, penny->getComponent<VisualNovelCharacter>(), "scene.1.1"))
// ->then(new PokerNewGameEvent(vnManager))
->then(new VisualNovelTextboxEvent(vnManager, penny->getComponent<VisualNovelCharacter>(), "undefined"))
// ->then(new PokerInitialEvent(vnManager))