#include #include "crepe/api/LoopManager.h" #include #include #include #include using namespace crepe; 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; if(event.key == Keycode::ESCAPE){ } return false; } bool on_key_released(const KeyReleaseEvent & event) override { std::cout << "TestKeyListener: Key Released - Code: " << static_cast(event.key) << std::endl; return false; } }; bool on_key_pressed(const KeyPressEvent & event){ std::cout << "TestKeyListener: Key Pressed - Code: " << static_cast(event.key) << std::endl; if(event.key == Keycode::ESCAPE){ return true; } return false; } int main() { LoopManager gameloop; TestKeyListener key_listener; EventManager::get_instance().subscribe(on_key_pressed); gameloop.start(); return 1; }