Starting new VN Structure
This commit is contained in:
60
src/dawn/games/vn/components/VNManager.hpp
Normal file
60
src/dawn/games/vn/components/VNManager.hpp
Normal 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;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user