|
|
@@ -3,13 +3,41 @@
|
|
|
* e-mail: webmaster@lynarstudios.com
|
|
|
*/
|
|
|
|
|
|
+#include <interface/IKeyboard.hpp>
|
|
|
+#include <window/SdlKeyEventManager.hpp>
|
|
|
#include <window/SdlWindowApiEventManager.hpp>
|
|
|
|
|
|
+using ls::atlantis::interfaces::IKeyboard;
|
|
|
+using ls::atlantis::window::SdlKeyEventManager;
|
|
|
using ls::atlantis::window::SdlWindowApiEventManager;
|
|
|
+using ::std::make_shared;
|
|
|
+using ::std::shared_ptr;
|
|
|
|
|
|
-SdlWindowApiEventManager::SdlWindowApiEventManager() = default;
|
|
|
+SdlWindowApiEventManager::SdlWindowApiEventManager()
|
|
|
+{
|
|
|
+ this->sdlEvent = make_shared<SDL_Event>();
|
|
|
+}
|
|
|
|
|
|
SdlWindowApiEventManager::~SdlWindowApiEventManager() = default;
|
|
|
|
|
|
-void SdlWindowApiEventManager::manage()
|
|
|
-{}
|
|
|
+void SdlWindowApiEventManager::manage(const shared_ptr<IKeyboard> &_keyboard)
|
|
|
+{
|
|
|
+ while (SDL_PollEvent(this->sdlEvent.get()))
|
|
|
+ {
|
|
|
+ switch (this->sdlEvent->type)
|
|
|
+ {
|
|
|
+ case SDL_EVENT_KEY_DOWN:
|
|
|
+ {
|
|
|
+ SdlKeyEventManager::manageKeyDownEvent(_keyboard, this->sdlEvent);
|
|
|
+ } break;
|
|
|
+ case SDL_EVENT_KEY_UP:
|
|
|
+ {
|
|
|
+ SdlKeyEventManager::manageKeyUpEvent(_keyboard, this->sdlEvent);
|
|
|
+ } break;
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ // other use cases not supported, yet
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|