diff --git a/examples/hello_module/main.cpp b/examples/hello_module/main.cpp index e2d91e0..33cbefe 100644 --- a/examples/hello_module/main.cpp +++ b/examples/hello_module/main.cpp @@ -1,8 +1,5 @@ #include "hello_module.h" -#include -#include -#include -#include +#include using namespace extra2d; @@ -17,6 +14,15 @@ public: void onEnter() override { Scene::onEnter(); + addListener(EventType::KeyPressed, [](Event &e) { + auto &keyEvent = std::get(e.data); + + if (keyEvent.keyCode == static_cast(Key::Escape)) { + e.handled = true; + E2D_LOG_INFO("ESC !!!exit"); + Application::get().quit(); + } + }); E2D_LOG_INFO("HelloScene entered"); setBackgroundColor(Color(0.1f, 0.1f, 0.2f, 1.0f));