| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- /*
- * author: Patrick-Christopher Mattulat
- * 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()
- {
- this->sdlEvent = make_shared<SDL_Event>();
- }
- SdlWindowApiEventManager::~SdlWindowApiEventManager() = default;
- 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
- }
- }
- }
- }
|