WebKeyboardSDL.cpp 853 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <SDL/include/SDL_keycode.h>
  2. #include "WebKeyboardSDL.h"
  3. namespace Atomic
  4. {
  5. int GetNativeKeyFromSDLScanCode(int scancode)
  6. {
  7. #ifdef ATOMIC_PLATFORM_OSX
  8. // see scancodes_darwin.h in the SDL sources
  9. if (scancode == SDL_SCANCODE_RETURN)
  10. return 36;
  11. if (scancode == SDL_SCANCODE_LEFT)
  12. return 123;
  13. if (scancode == SDL_SCANCODE_RIGHT)
  14. return 124;
  15. if (scancode == SDL_SCANCODE_DOWN)
  16. return 125;
  17. if (scancode == SDL_SCANCODE_UP)
  18. return 126;
  19. if (scancode == SDL_SCANCODE_DELETE)
  20. return 117;
  21. if (scancode == SDL_SCANCODE_BACKSPACE)
  22. return 51;
  23. if (scancode == SDL_SCANCODE_RGUI)
  24. return 54;
  25. if (scancode == SDL_SCANCODE_LGUI)
  26. return 55;
  27. if (scancode == SDL_SCANCODE_Z)
  28. return 6;
  29. return -1;
  30. #else
  31. return -1;
  32. #endif
  33. }
  34. }