key_codes.odin 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. // +build windows
  2. package sys_windows
  3. // https://docs.microsoft.com/en-us/windows/win32/inputdev/about-keyboard-input
  4. KF_EXTENDED :: 0x0100
  5. KF_DLGMODE :: 0x0800
  6. KF_MENUMODE :: 0x1000
  7. KF_ALTDOWN :: 0x2000
  8. KF_REPEAT :: 0x4000
  9. KF_UP :: 0x8000
  10. // https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
  11. // Virtual Keys, Standard Set
  12. VK_LBUTTON :: 0x01
  13. VK_RBUTTON :: 0x02
  14. VK_CANCEL :: 0x03
  15. VK_MBUTTON :: 0x04 // NOT contiguous with L & RBUTTON
  16. VK_XBUTTON1 :: 0x05 // NOT contiguous with L & RBUTTON
  17. VK_XBUTTON2 :: 0x06 // NOT contiguous with L & RBUTTON
  18. // 0x07 : reserved
  19. VK_BACK :: 0x08
  20. VK_TAB :: 0x09
  21. // 0x0A - 0x0B : reserved
  22. VK_CLEAR :: 0x0C
  23. VK_RETURN :: 0x0D
  24. // 0x0E - 0x0F : unassigned
  25. VK_SHIFT :: 0x10
  26. VK_CONTROL :: 0x11
  27. VK_MENU :: 0x12
  28. VK_PAUSE :: 0x13
  29. VK_CAPITAL :: 0x14
  30. VK_KANA :: 0x15
  31. VK_HANGEUL :: 0x15 // old name - should be here for compatibility
  32. VK_HANGUL :: 0x15
  33. VK_IME_ON :: 0x16
  34. VK_JUNJA :: 0x17
  35. VK_FINAL :: 0x18
  36. VK_HANJA :: 0x19
  37. VK_KANJI :: 0x19
  38. VK_IME_OFF :: 0x1A
  39. VK_ESCAPE :: 0x1B
  40. VK_CONVERT :: 0x1C
  41. VK_NONCONVERT :: 0x1D
  42. VK_ACCEPT :: 0x1E
  43. VK_MODECHANGE :: 0x1F
  44. VK_SPACE :: 0x20
  45. VK_PRIOR :: 0x21
  46. VK_NEXT :: 0x22
  47. VK_END :: 0x23
  48. VK_HOME :: 0x24
  49. VK_LEFT :: 0x25
  50. VK_UP :: 0x26
  51. VK_RIGHT :: 0x27
  52. VK_DOWN :: 0x28
  53. VK_SELECT :: 0x29
  54. VK_PRINT :: 0x2A
  55. VK_EXECUTE :: 0x2B
  56. VK_SNAPSHOT :: 0x2C
  57. VK_INSERT :: 0x2D
  58. VK_DELETE :: 0x2E
  59. VK_HELP :: 0x2F
  60. VK_0 :: '0'
  61. VK_1 :: '1'
  62. VK_2 :: '2'
  63. VK_3 :: '3'
  64. VK_4 :: '4'
  65. VK_5 :: '5'
  66. VK_6 :: '6'
  67. VK_7 :: '7'
  68. VK_8 :: '8'
  69. VK_9 :: '9'
  70. // 0x3A - 0x40 : unassigned
  71. VK_A :: 'A'
  72. VK_B :: 'B'
  73. VK_C :: 'C'
  74. VK_D :: 'D'
  75. VK_E :: 'E'
  76. VK_F :: 'F'
  77. VK_G :: 'G'
  78. VK_H :: 'H'
  79. VK_I :: 'I'
  80. VK_J :: 'J'
  81. VK_K :: 'K'
  82. VK_L :: 'L'
  83. VK_M :: 'M'
  84. VK_N :: 'N'
  85. VK_O :: 'O'
  86. VK_P :: 'P'
  87. VK_Q :: 'Q'
  88. VK_R :: 'R'
  89. VK_S :: 'S'
  90. VK_T :: 'T'
  91. VK_U :: 'U'
  92. VK_V :: 'V'
  93. VK_W :: 'W'
  94. VK_X :: 'X'
  95. VK_Y :: 'Y'
  96. VK_Z :: 'Z'
  97. VK_LWIN :: 0x5B
  98. VK_RWIN :: 0x5C
  99. VK_APPS :: 0x5D
  100. // 0x5E : reserved
  101. VK_SLEEP :: 0x5F
  102. VK_NUMPAD0 :: 0x60
  103. VK_NUMPAD1 :: 0x61
  104. VK_NUMPAD2 :: 0x62
  105. VK_NUMPAD3 :: 0x63
  106. VK_NUMPAD4 :: 0x64
  107. VK_NUMPAD5 :: 0x65
  108. VK_NUMPAD6 :: 0x66
  109. VK_NUMPAD7 :: 0x67
  110. VK_NUMPAD8 :: 0x68
  111. VK_NUMPAD9 :: 0x69
  112. VK_MULTIPLY :: 0x6A
  113. VK_ADD :: 0x6B
  114. VK_SEPARATOR :: 0x6C
  115. VK_SUBTRACT :: 0x6D
  116. VK_DECIMAL :: 0x6E
  117. VK_DIVIDE :: 0x6F
  118. VK_F1 :: 0x70
  119. VK_F2 :: 0x71
  120. VK_F3 :: 0x72
  121. VK_F4 :: 0x73
  122. VK_F5 :: 0x74
  123. VK_F6 :: 0x75
  124. VK_F7 :: 0x76
  125. VK_F8 :: 0x77
  126. VK_F9 :: 0x78
  127. VK_F10 :: 0x79
  128. VK_F11 :: 0x7A
  129. VK_F12 :: 0x7B
  130. VK_F13 :: 0x7C
  131. VK_F14 :: 0x7D
  132. VK_F15 :: 0x7E
  133. VK_F16 :: 0x7F
  134. VK_F17 :: 0x80
  135. VK_F18 :: 0x81
  136. VK_F19 :: 0x82
  137. VK_F20 :: 0x83
  138. VK_F21 :: 0x84
  139. VK_F22 :: 0x85
  140. VK_F23 :: 0x86
  141. VK_F24 :: 0x87
  142. // 0x88 - 0x8F : reserved
  143. VK_NUMLOCK :: 0x90
  144. VK_SCROLL :: 0x91
  145. // NEC PC-9800 kbd definitions
  146. VK_OEM_NEC_EQUAL :: 0x92 // '=' key on numpad
  147. // Fujitsu/OASYS kbd definitions
  148. VK_OEM_FJ_JISHO :: 0x92 // 'Dictionary' key
  149. VK_OEM_FJ_MASSHOU :: 0x93 // 'Unregister word' key
  150. VK_OEM_FJ_TOUROKU :: 0x94 // 'Register word' key
  151. VK_OEM_FJ_LOYA :: 0x95 // 'Left OYAYUBI' key
  152. VK_OEM_FJ_ROYA :: 0x96 // 'Right OYAYUBI' key
  153. // 0x97 - 0x9F : unassigned
  154. // VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys.
  155. // Used only as parameters to GetAsyncKeyState() and GetKeyState().
  156. // No other API or message will distinguish left and right keys in this way.
  157. VK_LSHIFT :: 0xA0
  158. VK_RSHIFT :: 0xA1
  159. VK_LCONTROL :: 0xA2
  160. VK_RCONTROL :: 0xA3
  161. VK_LMENU :: 0xA4
  162. VK_RMENU :: 0xA5
  163. VK_BROWSER_BACK :: 0xA6
  164. VK_BROWSER_FORWARD :: 0xA7
  165. VK_BROWSER_REFRESH :: 0xA8
  166. VK_BROWSER_STOP :: 0xA9
  167. VK_BROWSER_SEARCH :: 0xAA
  168. VK_BROWSER_FAVORITES :: 0xAB
  169. VK_BROWSER_HOME :: 0xAC
  170. VK_VOLUME_MUTE :: 0xAD
  171. VK_VOLUME_DOWN :: 0xAE
  172. VK_VOLUME_UP :: 0xAF
  173. VK_MEDIA_NEXT_TRACK :: 0xB0
  174. VK_MEDIA_PREV_TRACK :: 0xB1
  175. VK_MEDIA_STOP :: 0xB2
  176. VK_MEDIA_PLAY_PAUSE :: 0xB3
  177. VK_LAUNCH_MAIL :: 0xB4
  178. VK_LAUNCH_MEDIA_SELECT :: 0xB5
  179. VK_LAUNCH_APP1 :: 0xB6
  180. VK_LAUNCH_APP2 :: 0xB7
  181. // 0xB8 - 0xB9 : reserved
  182. VK_OEM_1 :: 0xBA // ';:' for US
  183. VK_OEM_PLUS :: 0xBB // '+' any country
  184. VK_OEM_COMMA :: 0xBC // ',' any country
  185. VK_OEM_MINUS :: 0xBD // '-' any country
  186. VK_OEM_PERIOD :: 0xBE // '.' any country
  187. VK_OEM_2 :: 0xBF // '/?' for US
  188. VK_OEM_3 :: 0xC0 // '`~' for US
  189. // 0xC1 - 0xDA : reserved
  190. VK_OEM_4 :: 0xDB // '[{' for US
  191. VK_OEM_5 :: 0xDC // '\|' for US
  192. VK_OEM_6 :: 0xDD // ']}' for US
  193. VK_OEM_7 :: 0xDE // ''"' for US
  194. VK_OEM_8 :: 0xDF
  195. // 0xE0 : reserved
  196. // Various extended or enhanced keyboards
  197. VK_OEM_AX :: 0xE1 // 'AX' key on Japanese AX kbd
  198. VK_OEM_102 :: 0xE2 // "<>" or "\|" on RT 102-key kbd.
  199. VK_ICO_HELP :: 0xE3 // Help key on ICO
  200. VK_ICO_00 :: 0xE4 // 00 key on ICO
  201. VK_PROCESSKEY :: 0xE5
  202. VK_ICO_CLEAR :: 0xE6
  203. VK_PACKET :: 0xE7
  204. // 0xE8 : unassigned
  205. // Nokia/Ericsson definitions
  206. VK_OEM_RESET :: 0xE9
  207. VK_OEM_JUMP :: 0xEA
  208. VK_OEM_PA1 :: 0xEB
  209. VK_OEM_PA2 :: 0xEC
  210. VK_OEM_PA3 :: 0xED
  211. VK_OEM_WSCTRL :: 0xEE
  212. VK_OEM_CUSEL :: 0xEF
  213. VK_OEM_ATTN :: 0xF0
  214. VK_OEM_FINISH :: 0xF1
  215. VK_OEM_COPY :: 0xF2
  216. VK_OEM_AUTO :: 0xF3
  217. VK_OEM_ENLW :: 0xF4
  218. VK_OEM_BACKTAB :: 0xF5
  219. VK_ATTN :: 0xF6
  220. VK_CRSEL :: 0xF7
  221. VK_EXSEL :: 0xF8
  222. VK_EREOF :: 0xF9
  223. VK_PLAY :: 0xFA
  224. VK_ZOOM :: 0xFB
  225. VK_NONAME :: 0xFC
  226. VK_PA1 :: 0xFD
  227. VK_OEM_CLEAR :: 0xFE
  228. // 0xFF : reserved