InputSdl.h 792 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright (C) 2009-2021, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <AnKi/Input.h>
  7. #include <AnKi/Input/KeyCode.h>
  8. #include <SDL_keycode.h>
  9. #include <unordered_map>
  10. namespace anki
  11. {
  12. /// SDL input implementation
  13. class InputSdl : public Input
  14. {
  15. public:
  16. std::unordered_map<SDL_Keycode, KeyCode, std::hash<SDL_Keycode>, std::equal_to<SDL_Keycode>,
  17. HeapAllocator<std::pair<const SDL_Keycode, KeyCode>>>
  18. m_sdlToAnki;
  19. InputSdl(HeapAllocator<std::pair<const SDL_Keycode, KeyCode>> alloc)
  20. : m_sdlToAnki(10, std::hash<SDL_Keycode>(), std::equal_to<SDL_Keycode>(), alloc)
  21. {
  22. }
  23. Error init();
  24. Error handleEventsInternal();
  25. };
  26. } // end namespace anki