From 408eb1fb5932a683a65db79afed6a300e18db5c6 Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Wed, 13 Nov 2024 15:37:11 +0100 Subject: added keycodes --- src/crepe/api/KeyCodes.h | 147 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 src/crepe/api/KeyCodes.h (limited to 'src/crepe/api/KeyCodes.h') diff --git a/src/crepe/api/KeyCodes.h b/src/crepe/api/KeyCodes.h new file mode 100644 index 0000000..53be91b --- /dev/null +++ b/src/crepe/api/KeyCodes.h @@ -0,0 +1,147 @@ +#pragma once + +enum class MouseButton { + None = 0, + Left_Mouse = 1, + Right_Mouse = 2, + Middle_Mouse = 3, + X1_Mouse = 4, + X2_Mouse = 5, + Scroll_Up = 6, + Scroll_Down = 7, +}; + +enum class Keycode : int{ + // From glfw3.h + None = 0, + Space = 32, + Apostrophe = 39, /* ' */ + Comma = 44, /* , */ + Minus = 45, /* - */ + Period = 46, /* . */ + Slash = 47, /* / */ + + D0 = 48, /* 0 */ + D1 = 49, /* 1 */ + D2 = 50, /* 2 */ + D3 = 51, /* 3 */ + D4 = 52, /* 4 */ + D5 = 53, /* 5 */ + D6 = 54, /* 6 */ + D7 = 55, /* 7 */ + D8 = 56, /* 8 */ + D9 = 57, /* 9 */ + + Semicolon = 59, /* ; */ + Equal = 61, /* = */ + + A = 65, + B = 66, + C = 67, + D = 68, + E = 69, + F = 70, + G = 71, + H = 72, + I = 73, + J = 74, + K = 75, + L = 76, + M = 77, + N = 78, + O = 79, + P = 80, + Q = 81, + R = 82, + S = 83, + T = 84, + U = 85, + V = 86, + W = 87, + X = 88, + Y = 89, + Z = 90, + + LeftBracket = 91, /* [ */ + Backslash = 92, /* \ */ + RightBracket = 93, /* ] */ + GraveAccent = 96, /* ` */ + + World1 = 161, /* non-US #1 */ + World2 = 162, /* non-US #2 */ + + /* Function keys */ + Escape = 256, + Enter = 257, + Tab = 258, + Backspace = 259, + Insert = 260, + Delete = 261, + Right = 262, + Left = 263, + Down = 264, + Up = 265, + PageUp = 266, + PageDown = 267, + Home = 268, + End = 269, + CapsLock = 280, + ScrollLock = 281, + NumLock = 282, + PrintScreen = 283, + Pause = 284, + F1 = 290, + F2 = 291, + F3 = 292, + F4 = 293, + F5 = 294, + F6 = 295, + F7 = 296, + F8 = 297, + F9 = 298, + F10 = 299, + F11 = 300, + F12 = 301, + F13 = 302, + F14 = 303, + F15 = 304, + F16 = 305, + F17 = 306, + F18 = 307, + F19 = 308, + F20 = 309, + F21 = 310, + F22 = 311, + F23 = 312, + F24 = 313, + F25 = 314, + + /* Keypad */ + KP0 = 320, + KP1 = 321, + KP2 = 322, + KP3 = 323, + KP4 = 324, + KP5 = 325, + KP6 = 326, + KP7 = 327, + KP8 = 328, + KP9 = 329, + KPDecimal = 330, + KPDivide = 331, + KPMultiply = 332, + KPSubtract = 333, + KPAdd = 334, + KPEnter = 335, + KPEqual = 336, + + LeftShift = 340, + LeftControl = 341, + LeftAlt = 342, + LeftSuper = 343, + RightShift = 344, + RightControl = 345, + RightAlt = 346, + RightSuper = 347, + Menu = 348 +}; -- cgit v1.2.3 From 9ce53b197953e66189febeaa434255b848647993 Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Wed, 13 Nov 2024 15:40:52 +0100 Subject: make format --- src/crepe/api/Event.h | 4 +- src/crepe/api/EventManager.h | 1 - src/crepe/api/KeyCodes.h | 118 +++++++++++++++++++++---------------------- src/example/events.cpp | 16 +++--- 4 files changed, 69 insertions(+), 70 deletions(-) (limited to 'src/crepe/api/KeyCodes.h') diff --git a/src/crepe/api/Event.h b/src/crepe/api/Event.h index 87c6068..cffa5da 100644 --- a/src/crepe/api/Event.h +++ b/src/crepe/api/Event.h @@ -1,8 +1,8 @@ #pragma once -#include +#include "KeyCodes.h" #include #include -#include "KeyCodes.h" +#include class Event { public: diff --git a/src/crepe/api/EventManager.h b/src/crepe/api/EventManager.h index 26539ce..e2665bd 100644 --- a/src/crepe/api/EventManager.h +++ b/src/crepe/api/EventManager.h @@ -254,4 +254,3 @@ void EventManager::unsubscribe(const EventHandler & callback, } } } - diff --git a/src/crepe/api/KeyCodes.h b/src/crepe/api/KeyCodes.h index 53be91b..1cb1a8a 100644 --- a/src/crepe/api/KeyCodes.h +++ b/src/crepe/api/KeyCodes.h @@ -1,25 +1,25 @@ #pragma once enum class MouseButton { - None = 0, - Left_Mouse = 1, - Right_Mouse = 2, - Middle_Mouse = 3, - X1_Mouse = 4, - X2_Mouse = 5, - Scroll_Up = 6, - Scroll_Down = 7, + NONE = 0, + LEFT_MOUSE = 1, + RIGHT_MOUSE = 2, + MIDDLE_MOUSE = 3, + X1_MOUSE = 4, + X2_MOUSE = 5, + SCROLL_UP = 6, + SCROLL_DOWN = 7, }; -enum class Keycode : int{ +enum class Keycode : int { // From glfw3.h - None = 0, - Space = 32, - Apostrophe = 39, /* ' */ - Comma = 44, /* , */ - Minus = 45, /* - */ - Period = 46, /* . */ - Slash = 47, /* / */ + NONE = 0, + SPACE = 32, + APOSTROPHE = 39, /* ' */ + COMMA = 44, /* , */ + MINUS = 45, /* - */ + PERIOD = 46, /* . */ + SLASH = 47, /* / */ D0 = 48, /* 0 */ D1 = 49, /* 1 */ @@ -32,8 +32,8 @@ enum class Keycode : int{ D8 = 56, /* 8 */ D9 = 57, /* 9 */ - Semicolon = 59, /* ; */ - Equal = 61, /* = */ + SEMICOLON = 59, /* ; */ + EQUAL = 61, /* = */ A = 65, B = 66, @@ -62,34 +62,34 @@ enum class Keycode : int{ Y = 89, Z = 90, - LeftBracket = 91, /* [ */ - Backslash = 92, /* \ */ - RightBracket = 93, /* ] */ - GraveAccent = 96, /* ` */ + LEFT_BRACKET = 91, /* [ */ + BACKSLASH = 92, /* \ */ + RIGHT_BRACKET = 93, /* ] */ + GRAVE_ACCENT = 96, /* ` */ - World1 = 161, /* non-US #1 */ - World2 = 162, /* non-US #2 */ + WORLD1 = 161, /* non-US #1 */ + WORLD2 = 162, /* non-US #2 */ /* Function keys */ - Escape = 256, - Enter = 257, - Tab = 258, - Backspace = 259, - Insert = 260, - Delete = 261, - Right = 262, - Left = 263, - Down = 264, - Up = 265, - PageUp = 266, - PageDown = 267, - Home = 268, - End = 269, - CapsLock = 280, - ScrollLock = 281, - NumLock = 282, - PrintScreen = 283, - Pause = 284, + ESCAPE = 256, + ENTER = 257, + TAB = 258, + BACKSPACE = 259, + INSERT = 260, + DELETE = 261, + RIGHT = 262, + LEFT = 263, + DOWN = 264, + UP = 265, + PAGE_UP = 266, + PAGE_DOWN = 267, + HOME = 268, + END = 269, + CAPS_LOCK = 280, + SCROLL_LOCK = 281, + NUM_LOCK = 282, + PRINT_SCREEN = 283, + PAUSE = 284, F1 = 290, F2 = 291, F3 = 292, @@ -127,21 +127,21 @@ enum class Keycode : int{ KP7 = 327, KP8 = 328, KP9 = 329, - KPDecimal = 330, - KPDivide = 331, - KPMultiply = 332, - KPSubtract = 333, - KPAdd = 334, - KPEnter = 335, - KPEqual = 336, + KP_DECIMAL = 330, + KP_DIVIDE = 331, + KP_MULTIPLY = 332, + KP_SUBTRACT = 333, + KP_ADD = 334, + KP_ENTER = 335, + KP_EQUAL = 336, - LeftShift = 340, - LeftControl = 341, - LeftAlt = 342, - LeftSuper = 343, - RightShift = 344, - RightControl = 345, - RightAlt = 346, - RightSuper = 347, - Menu = 348 + LEFT_SHIFT = 340, + LEFT_CONTROL = 341, + LEFT_ALT = 342, + LEFT_SUPER = 343, + RIGHT_SHIFT = 344, + RIGHT_CONTROL = 345, + RIGHT_ALT = 346, + RIGHT_SUPER = 347, + MENU = 348 }; diff --git a/src/example/events.cpp b/src/example/events.cpp index 210c42c..51c9a37 100644 --- a/src/example/events.cpp +++ b/src/example/events.cpp @@ -4,16 +4,16 @@ #include #include +#include +#include #include #include +#include #include #include -#include -#include -#include +#include #include #include -#include using namespace crepe; using namespace std; @@ -54,13 +54,13 @@ class MyScript : public Script, public IKeyListener, public IMouseListener { class TestKeyListener : public IKeyListener { public: bool on_key_pressed(const KeyPressEvent & event) override { - std::cout << "TestKeyListener: Key Pressed - Code: " << static_cast(event.key) - << std::endl; + std::cout << "TestKeyListener: Key Pressed - Code: " + << static_cast(event.key) << std::endl; return true; // Return true if the listener should remain active } bool on_key_released(const KeyReleaseEvent & event) override { - std::cout << "TestKeyListener: Key Released - Code: " << static_cast(event.key) - << std::endl; + std::cout << "TestKeyListener: Key Released - Code: " + << static_cast(event.key) << std::endl; return true; } }; -- cgit v1.2.3 From cab672ce6258aec563e7f0e0549281156c0c8d21 Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Fri, 15 Nov 2024 12:43:38 +0100 Subject: feedback --- src/crepe/api/CMakeLists.txt | 14 ++++ src/crepe/api/Event.h | 13 ++-- src/crepe/api/EventHandler.h | 1 + src/crepe/api/EventManager.cpp | 3 + src/crepe/api/EventManager.h | 142 ++------------------------------------- src/crepe/api/EventManager.hpp | 140 ++++++++++++++++++++++++++++++++++++++ src/crepe/api/IKeyListener.cpp | 4 +- src/crepe/api/IMouseListener.cpp | 10 ++- src/crepe/api/KeyCodes.h | 1 - src/example/events.cpp | 10 ++- 10 files changed, 187 insertions(+), 151 deletions(-) create mode 100644 src/crepe/api/EventManager.hpp (limited to 'src/crepe/api/KeyCodes.h') diff --git a/src/crepe/api/CMakeLists.txt b/src/crepe/api/CMakeLists.txt index 87cbb09..53b3041 100644 --- a/src/crepe/api/CMakeLists.txt +++ b/src/crepe/api/CMakeLists.txt @@ -18,6 +18,12 @@ target_sources(crepe PUBLIC Vector2.cpp Camera.cpp Animator.cpp + EventManager.cpp + EventHandler.cpp + IKeyListener.cpp + IMouseListener.cpp + LoopManager.cpp + LoopTimer.cpp ) target_sources(crepe PUBLIC FILE_SET HEADERS FILES @@ -42,4 +48,12 @@ target_sources(crepe PUBLIC FILE_SET HEADERS FILES SceneManager.hpp Camera.h Animator.h + EventManager.h + EventManager.hpp + EventHandler.h + Event.h + IKeyListener.h + IMouseListener.h + LoopManager.h + LoopTimer.h ) diff --git a/src/crepe/api/Event.h b/src/crepe/api/Event.h index cffa5da..701ecdf 100644 --- a/src/crepe/api/Event.h +++ b/src/crepe/api/Event.h @@ -6,38 +6,37 @@ class Event { public: - bool handled = false; }; class KeyPressEvent : public Event { public: int repeat = 0; - Keycode key = Keycode::None; + Keycode key = Keycode::NONE; }; class KeyReleaseEvent : public Event { public: - Keycode key = Keycode::None; + Keycode key = Keycode::NONE; }; class MousePressEvent : public Event { public: int mouse_x = 0; int mouse_y = 0; - MouseButton button; + MouseButton button = MouseButton::NONE; }; class MouseClickEvent : public Event { public: int mouse_x = 0; int mouse_y = 0; - MouseButton button; + MouseButton button = MouseButton::NONE; }; class MouseReleaseEvent : public Event { public: int mouse_x = 0; int mouse_y = 0; - MouseButton button = MouseButton::None; + MouseButton button = MouseButton::NONE; }; class MouseMoveEvent : public Event { public: @@ -50,7 +49,7 @@ public: }; class TextSubmitEvent : public Event { public: - std::string text; + std::string text = ""; }; class ShutDownEvent : public Event { public: diff --git a/src/crepe/api/EventHandler.h b/src/crepe/api/EventHandler.h index 46c6c7b..0ab90de 100644 --- a/src/crepe/api/EventHandler.h +++ b/src/crepe/api/EventHandler.h @@ -12,6 +12,7 @@ * * \tparam EventType The type of event this handler will handle. */ +// TODO: typedef template using EventHandler = std::function; diff --git a/src/crepe/api/EventManager.cpp b/src/crepe/api/EventManager.cpp index 72cfd74..e881d49 100644 --- a/src/crepe/api/EventManager.cpp +++ b/src/crepe/api/EventManager.cpp @@ -1,5 +1,7 @@ #include "EventManager.h" +using namespace crepe; + EventManager & EventManager::get_instance() { static EventManager instance; return instance; @@ -62,6 +64,7 @@ void EventManager::dispatch_events() { iterator handler_it = handlers.begin(); handler_it != handlers.end(); ++handler_it) { + // remove event from queue since and continue when callback returns true if ((*handler_it)->exec(*event)) { event_it = this->events_queue.erase(event_it); event_handled = true; diff --git a/src/crepe/api/EventManager.h b/src/crepe/api/EventManager.h index e2665bd..38d2e64 100644 --- a/src/crepe/api/EventManager.h +++ b/src/crepe/api/EventManager.h @@ -10,6 +10,8 @@ #include "Event.h" #include "EventHandler.h" + +namespace crepe { /** * \class EventManager * \brief The EventManager class is responsible for managing the subscription, triggering, @@ -115,142 +117,6 @@ private: std::vector>>> subscribers_by_event_id; }; -template -void EventManager::subscribe(EventHandler && callback, int channel) { - std::type_index event_type = typeid(EventType); - std::unique_ptr> handler - = std::make_unique>(callback); - - if (channel) { - std::unordered_map>> & - handlers_map - = this->subscribers_by_event_id[event_type]; - std::unordered_map< - int, std::vector>>::iterator - handlers - = handlers_map.find(channel); - if (handlers != handlers_map.end()) { - handlers->second.emplace_back(std::move(handler)); - } else { - handlers_map[channel].emplace_back(std::move(handler)); - } - } else { - std::vector> & handlers - = this->subscribers[event_type]; - handlers.emplace_back(std::move(handler)); - } -} - -template -void EventManager::queue_event(EventType && event, int channel) { - std::type_index event_type = std::type_index(typeid(EventType)); - - std::unique_ptr event_ptr - = std::make_unique(std::forward(event)); - - std::tuple, int, std::type_index> tuple( - std::move(event_ptr), channel, event_type); - this->events_queue.push_back(std::move(tuple)); -} - -template -void EventManager::trigger_event(const EventType & event, int channel) { - std::type_index event_type = std::type_index(typeid(EventType)); - - if (channel > 0) { - std::unordered_map>> & - handlers_map - = this->subscribers_by_event_id[event_type]; - std::unordered_map< - int, std::vector>>::iterator - handlers_it - = handlers_map.find(channel); - - if (handlers_it != handlers_map.end()) { - std::vector> & handlers - = handlers_it->second; - for (std::vector>::iterator it - = handlers.begin(); - it != handlers.end();) { - // erases callback if callback function returns true - if ((*it)->exec(event)) { - it = handlers.erase(it); - } else { - ++it; - } - } - } - } else { - std::vector> & handlers - = this->subscribers[event_type]; - for (std::vector>::iterator it - = handlers.begin(); - it != handlers.end();) { - // erases callback if callback function returns true - if ((*it)->exec(event)) { - it = handlers.erase(it); - } else { - ++it; - } - } - } -} - -template -void EventManager::unsubscribe(const EventHandler & callback, - int channel) { - std::type_index event_type(typeid(EventType)); - std::string handler_name = callback.target_type().name(); - if (channel) { - std::unordered_map< - std::type_index, - std::unordered_map< - int, std::vector>>>:: - iterator subscriber_list - = this->subscribers_by_event_id.find(event_type); - if (subscriber_list != this->subscribers_by_event_id.end()) { - std::unordered_map< - int, std::vector>> & - handlers_map - = subscriber_list->second; - std::unordered_map< - int, - std::vector>>::iterator - handlers - = handlers_map.find(channel); - if (handlers != handlers_map.end()) { - std::vector> & callbacks - = handlers->second; - for (std::vector< - std::unique_ptr>::iterator it - = callbacks.begin(); - it != callbacks.end(); ++it) { - if ((*it)->get_type() == handler_name) { - it = callbacks.erase(it); - return; - } - } - } - } - } else { - std::unordered_map>>:: - iterator handlers_it - = this->subscribers.find(event_type); - if (handlers_it != this->subscribers.end()) { - std::vector> & handlers - = handlers_it->second; - for (std::vector>::iterator it - = handlers.begin(); - it != handlers.end(); ++it) { - if ((*it)->get_type() == handler_name) { - it = handlers.erase(it); - return; - } - } - } - } -} +} // namespace crepe +#include "EventManager.hpp" diff --git a/src/crepe/api/EventManager.hpp b/src/crepe/api/EventManager.hpp new file mode 100644 index 0000000..b509097 --- /dev/null +++ b/src/crepe/api/EventManager.hpp @@ -0,0 +1,140 @@ +#include "EventManager.h" +namespace crepe { + +template +void EventManager::subscribe(EventHandler && callback, int channel) { + std::type_index event_type = typeid(EventType); + std::unique_ptr> handler + = std::make_unique>(callback); + + if (channel) { + std::unordered_map>> & + handlers_map + = this->subscribers_by_event_id[event_type]; + std::unordered_map< + int, std::vector>>::iterator + handlers + = handlers_map.find(channel); + if (handlers != handlers_map.end()) { + handlers->second.emplace_back(std::move(handler)); + } else { + handlers_map[channel].emplace_back(std::move(handler)); + } + } else { + std::vector> & handlers + = this->subscribers[event_type]; + handlers.emplace_back(std::move(handler)); + } +} + +template +void EventManager::queue_event(EventType && event, int channel) { + std::type_index event_type = std::type_index(typeid(EventType)); + + std::unique_ptr event_ptr + = std::make_unique(std::forward(event)); + + std::tuple, int, std::type_index> tuple( + std::move(event_ptr), channel, event_type); + this->events_queue.push_back(std::move(tuple)); +} + +template +void EventManager::trigger_event(const EventType & event, int channel) { + std::type_index event_type = std::type_index(typeid(EventType)); + + if (channel > 0) { + std::unordered_map>> & + handlers_map + = this->subscribers_by_event_id[event_type]; + std::unordered_map< + int, std::vector>>::iterator + handlers_it + = handlers_map.find(channel); + + if (handlers_it != handlers_map.end()) { + std::vector> & handlers + = handlers_it->second; + for (std::vector>::iterator it + = handlers.begin(); + it != handlers.end();++it) { + // stops when callback returns true + if((*it)->exec(event)){ + break; + } + } + } + } else { + std::vector> & handlers + = this->subscribers[event_type]; + for (std::vector>::iterator it + = handlers.begin(); + it != handlers.end();++it) { + // stops when callback returns true + if((*it)->exec(event)){ + break; + } + } + } +} + +template +void EventManager::unsubscribe(const EventHandler & callback, + int channel) { + std::type_index event_type(typeid(EventType)); + std::string handler_name = callback.target_type().name(); + + if (channel) { + std::unordered_map< + std::type_index, + std::unordered_map< + int, std::vector>>>:: + iterator subscriber_list + = this->subscribers_by_event_id.find(event_type); + if (subscriber_list != this->subscribers_by_event_id.end()) { + std::unordered_map< + int, std::vector>> & + handlers_map + = subscriber_list->second; + std::unordered_map< + int, + std::vector>>::iterator + handlers + = handlers_map.find(channel); + if (handlers != handlers_map.end()) { + std::vector> & callbacks + = handlers->second; + for (std::vector< + std::unique_ptr>::iterator it + = callbacks.begin(); + it != callbacks.end(); ++it) { + if ((*it)->get_type() == handler_name) { + it = callbacks.erase(it); + return; + } + } + } + } + } else { + std::unordered_map>>:: + iterator handlers_it + = this->subscribers.find(event_type); + if (handlers_it != this->subscribers.end()) { + std::vector> & handlers + = handlers_it->second; + for (std::vector>::iterator it + = handlers.begin(); + it != handlers.end(); ++it) { + if ((*it)->get_type() == handler_name) { + it = handlers.erase(it); + return; + } + } + } + } +} + +} diff --git a/src/crepe/api/IKeyListener.cpp b/src/crepe/api/IKeyListener.cpp index eb8f9af..4fd9855 100644 --- a/src/crepe/api/IKeyListener.cpp +++ b/src/crepe/api/IKeyListener.cpp @@ -1,5 +1,7 @@ #include "IKeyListener.h" -#include + +using namespace crepe; + IKeyListener::IKeyListener() { this->channel = channel; this->subscribe_events(); diff --git a/src/crepe/api/IMouseListener.cpp b/src/crepe/api/IMouseListener.cpp index 683632c..489e55b 100644 --- a/src/crepe/api/IMouseListener.cpp +++ b/src/crepe/api/IMouseListener.cpp @@ -1,6 +1,11 @@ #include "IMouseListener.h" + +using namespace crepe; + IMouseListener::IMouseListener(int channel) { this->channel = channel; } + IMouseListener::IMouseListener() { this->subscribe_events(); } + IMouseListener::~IMouseListener() { this->unsubscribe_events(); } void IMouseListener::subscribe_events() { @@ -26,7 +31,7 @@ void IMouseListener::subscribe_events() { EventManager::get_instance().subscribe( std::move(this->mouse_move_handler), this->channel); } - +// TODO: reference voor singleton void IMouseListener::unsubscribe_events() { EventManager::get_instance().unsubscribe( this->mouse_click_handler, this->channel); @@ -37,18 +42,21 @@ void IMouseListener::unsubscribe_events() { EventManager::get_instance().unsubscribe( this->mouse_move_handler, this->channel); } + void IMouseListener::activate_mouse() { if (this->active) { return; } this->subscribe_events(); } + void IMouseListener::deactivate_mouse() { if (!this->active) { return; } this->unsubscribe_events(); } + void IMouseListener::set_channel(int channel) { this->unsubscribe_events(); this->channel = channel; diff --git a/src/crepe/api/KeyCodes.h b/src/crepe/api/KeyCodes.h index 1cb1a8a..e5a91fc 100644 --- a/src/crepe/api/KeyCodes.h +++ b/src/crepe/api/KeyCodes.h @@ -12,7 +12,6 @@ enum class MouseButton { }; enum class Keycode : int { - // From glfw3.h NONE = 0, SPACE = 32, APOSTROPHE = 39, /* ' */ diff --git a/src/example/events.cpp b/src/example/events.cpp index 51c9a37..9c59bb7 100644 --- a/src/example/events.cpp +++ b/src/example/events.cpp @@ -70,7 +70,7 @@ int main() { key_press.key = Keycode::A; key_press.repeat = 0; MouseClickEvent click_event; - click_event.button = MouseButton::Left_Mouse; + click_event.button = MouseButton::LEFT_MOUSE; click_event.mouse_x = 100; click_event.mouse_y = 200; // queue events to test queue @@ -89,8 +89,12 @@ int main() { // Trigger the events while `testListener` is in scope EventManager::get_instance().trigger_event(key_press, 1); - EventManager::get_instance().trigger_event(click_event, - 1); + // EventManager::get_instance().trigger_event(MouseClickEvent{ + // .button = MouseButton::LEFT_MOUSE, + // .mouse_y = 100, + // .mouse_x = 100, + + // },1); } // custom lambda event handler EventHandler event_handler = [](const KeyPressEvent & e) { -- cgit v1.2.3