Dawn/src/dawn/games/vn/events/VNTextEvent.hpp
2023-05-21 15:11:51 -07:00

32 lines
822 B
C++

// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "VNEvent.hpp"
#include "scene/Scene.hpp"
#include "games/vn/components/VNTextboxScroller.hpp"
namespace Dawn {
class VNTextEvent : public VNEvent {
public:
std::string text;
protected:
VNTextboxScroller *scroller = nullptr;
void onStart() override {
scroller = this->getScene()->findComponent<VNTextboxScroller>();
assertNotNull(scroller);
scroller->label->text = text;
useEvent([&](inputbind_t bind){
if(bind != INPUT_BIND_ACCEPT) return;
if(!scroller->readyToClose) return;
this->next();
}, this->getScene()->game->inputManager.eventBindPressed);
}
};
}