Files
Dawn/src/dawn/games/vn/components/VNManager.hpp

54 lines
1.2 KiB
C++

// 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);
/**
* Ends the current event, and moves to the next one.
*/
void nextEvent();
void onStart() override;
void onDispose() override;
friend class VNEvent;
};
}