Starting new VN Structure
This commit is contained in:
38
archive/visualnovel/events/VisualNovelCallbackEvent.hpp
Normal file
38
archive/visualnovel/events/VisualNovelCallbackEvent.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "visualnovel/VisualNovelManager.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
template<class T>
|
||||
class VisualNovelCallbackEvent : public IVisualNovelEvent {
|
||||
protected:
|
||||
T *instance;
|
||||
void (T::*callback)();
|
||||
|
||||
void onStart(IVisualNovelEvent *previous) {
|
||||
|
||||
}
|
||||
|
||||
bool_t onUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void onEnd() {
|
||||
((*this->instance).*(this->callback))();
|
||||
}
|
||||
|
||||
public:
|
||||
VisualNovelCallbackEvent(
|
||||
VisualNovelManager *manager,
|
||||
T *instance,
|
||||
void (T::*callback)()
|
||||
) : IVisualNovelEvent(manager) {
|
||||
this->instance = instance;
|
||||
this->callback = callback;
|
||||
}
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user