1 #ifndef VTESTBED_GUI_IMGUIAPPLICATIONMONAD_HH 2 #define VTESTBED_GUI_IMGUIAPPLICATIONMONAD_HH 6 #include <Magnum/GL/DefaultFramebuffer.h> 7 #include <vtestbed/gui/MagnumImgui/MagnumImGui.h> 8 #include <vtestbed/gui/imgui.hh> 9 #include <vtestbed/gui/types.hh> 24 using typename Base::Arguments;
25 using typename Base::Configuration;
33 Base{args, conf} { this->initImGui(); }
35 template <
class ... Args>
38 Base(std::forward<Args>(args)...) { this->initImGui(); }
42 inline void initImGui() { this->Base::initImGui(this->imgui()); }
45 drawEvent()
override {
46 using namespace Magnum;
47 GL::defaultFramebuffer.clear(
48 GL::FramebufferClear::Color|GL::FramebufferClear::Depth
50 this->imgui().newFrame(
52 GL::defaultFramebuffer.viewport().size()
54 this->Base::drawEvent();
55 this->imgui().drawFrame();
61 keyPressEvent(KeyEvent& event)
override {
62 if (this->imgui().keyPressEvent(event)) {
65 this->Base::keyPressEvent(event);
69 keyReleaseEvent(KeyEvent& event)
override {
70 if (this->imgui().keyReleaseEvent(event)) {
73 this->Base::keyReleaseEvent(event);
77 mousePressEvent(MouseEvent& event)
override {
78 if (this->imgui().mousePressEvent(event)) {
81 this->Base::mousePressEvent(event);
85 mouseReleaseEvent(MouseEvent& event)
override {
86 if (this->imgui().mouseReleaseEvent(event)) {
89 this->Base::mouseReleaseEvent(event);
93 mouseMoveEvent(MouseMoveEvent& event)
override {
94 if (this->imgui().mouseMoveEvent(event)) {
97 this->Base::mouseMoveEvent(event);
101 mouseScrollEvent(MouseScrollEvent& event)
override {
102 if (this->imgui().mouseScrollEvent(event)) {
105 this->Base::mouseScrollEvent(event);
109 textInputEvent(TextInputEvent& event)
override {
110 if (this->imgui().textInputEvent(event)) {
113 this->Base::textInputEvent(event);
116 inline MagnumImGui& imgui() {
return this->_imgui; }
117 inline const MagnumImGui& imgui()
const {
return this->_imgui; }
125 #endif // vim:filetype=cpp