InputSdl.h 792 B

1234567891011121314151617181920212223242526272829303132
  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. /// SDL input implementation
  12. class InputSdl : public Input
  13. {
  14. public:
  15. std::unordered_map<SDL_Keycode, KeyCode, std::hash<SDL_Keycode>, std::equal_to<SDL_Keycode>,
  16. HeapAllocator<std::pair<const SDL_Keycode, KeyCode>>>
  17. m_sdlToAnki;
  18. InputSdl(HeapAllocator<std::pair<const SDL_Keycode, KeyCode>> alloc)
  19. : m_sdlToAnki(10, std::hash<SDL_Keycode>(), std::equal_to<SDL_Keycode>(), alloc)
  20. {
  21. }
  22. Error init();
  23. Error handleEventsInternal();
  24. };
  25. } // end namespace anki