std_keyboard.h 932 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef NULLSOFT_WASABI_STD_KEYBOARD_H
  2. #define NULLSOFT_WASABI_STD_KEYBOARD_H
  3. #ifdef _WIN32
  4. #include <windows.h>
  5. enum
  6. {
  7. STDKEY_SHIFT = VK_SHIFT,
  8. STDKEY_ALT = VK_MENU,
  9. STDKEY_CONTROL = VK_CONTROL,
  10. STDKEY_UP = VK_UP,
  11. STDKEY_DOWN = VK_DOWN,
  12. STDKEY_LEFT = VK_LEFT,
  13. STDKEY_RIGHT = VK_RIGHT,
  14. STDKEY_HOME = VK_HOME,
  15. STDKEY_END = VK_END,
  16. };
  17. #elif defined(__APPLE__)
  18. #include <Carbon/Carbon.h>
  19. enum
  20. {
  21. STDKEY_SHIFT = shiftKey,
  22. STDKEY_ALT = cmdKey, // yes, I know the option call has "alt" written on it, but Mac programs use Apple key like windows Alt key
  23. STDKEY_CONTROL = controlKey,
  24. STDKEY_UP = kUpArrowCharCode,
  25. STDKEY_DOWN = kDownArrowCharCode,
  26. STDKEY_LEFT = kLeftArrowCharCode,
  27. STDKEY_RIGHT = kRightArrowCharCode,
  28. STDKEY_HOME = kHomeCharCode,
  29. STDKEY_END = kEndCharCode,
  30. };
  31. #else
  32. #error port me
  33. #endif
  34. namespace Std
  35. {
  36. int keyDown(int code);
  37. bool keyModifier(int code);
  38. }
  39. #endif