Starting new VN Structure

This commit is contained in:
2023-04-18 09:55:11 -07:00
parent 26efdfe314
commit 1c21c15261
77 changed files with 929 additions and 27 deletions

View File

@ -0,0 +1,60 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "scene/SceneItemComponent.hpp"
namespace Dawn {
class VNEvent;
class VNManager : public SceneItemComponent {
protected:
std::vector<VNEvent*> events;
VNEvent *currentEvent = nullptr;
public:
/**
* Constructs a visual novel manager, scene item component.
*
* @param item Item that the VN manager belongs to.
*/
VNManager(SceneItem *item);
/**
* Creats an event for you to decide how to queue.
*/
template<class T>
T * createEvent() {
auto event = new T();
event->init(this);
this->events.push_back(event);
return event;
}
/**
* Sets the currently active visual novel event. This is assumed to be
* the only way to handle events (no multiples currently).
*
* @param event Event to set.
*/
void setEvent(VNEvent *event);
void nextEvent();
// template <class T>
// T * setEvent(T *event) {
// auto oldCurrent = this->currentEvent;
// this->currentEvent = event;
// if(this->hasInitialized && event != nullptr) event->start(oldCurrent);
// delete oldCurrent;
// return event;
// }
void onStart() override;
void onDispose() override;
friend class VNEvent;
};
}