keycodes.monkey2 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. Namespace mojo.input
  2. #rem monkeydoc Key codes.
  3. By default, key codes refer to 'virtual' keys. For example, `Key.W` refers to the key with 'W' printed on it. However, this key may not be
  4. in the same physical location on all users' keyboards, due to OS language and keyboard settings.
  5. To deal with this, mojo also provides support for 'raw' keys. A raw key code is simply a virtual key code 'or'ed with the special key code
  6. `Key.Raw`.
  7. A raw key represents the physical location of a key on US keyboards. For example, `Key.Q|Key.Raw` indicates the key at the top left of the
  8. 'qwerty' (or 'azerty' etc) keys regardless of the current OS settings.
  9. `Key.Raw` is to be used with the [[KeyboardDevice]] Class only. For example `Keyboard.KeyPressed(Key.A|Key.Raw)`.
  10. | Key
  11. |:---
  12. | A
  13. | B
  14. | C
  15. | D
  16. | E
  17. | F
  18. | G
  19. | H
  20. | I
  21. | J
  22. | K
  23. | L
  24. | M
  25. | N
  26. | O
  27. | P
  28. | Q
  29. | R
  30. | S
  31. | T
  32. | U
  33. | V
  34. | W
  35. | X
  36. | Y
  37. | Z
  38. | Key0
  39. | Key1
  40. | Key2
  41. | Key3
  42. | Key4
  43. | Key5
  44. | Key6
  45. | Key7
  46. | Key8
  47. | Key9
  48. | Enter
  49. | Escape
  50. | Backspace
  51. | Tab
  52. | Space
  53. | Minus
  54. | Equals
  55. | LeftBracket
  56. | RightBracket
  57. | Backslash
  58. | Semicolon
  59. | Apostrophe
  60. | Grave
  61. | Comma
  62. | Period
  63. | Slash
  64. | CapsLock
  65. | F1
  66. | F2
  67. | F3
  68. | F4
  69. | F5
  70. | F6
  71. | F7
  72. | F8
  73. | F9
  74. | F10
  75. | F11
  76. | F12
  77. | PrintScreen
  78. | ScrollLock
  79. | Pause
  80. | Insert
  81. | Home
  82. | PageUp
  83. | KeyDelete
  84. | KeyEnd
  85. | PageDown
  86. | Right
  87. | Left
  88. | Down
  89. | Up
  90. | LeftControl
  91. | LeftShift
  92. | LeftAlt
  93. | LeftGui
  94. | RightControl
  95. | RightShift
  96. | RightAlt
  97. | RightGui
  98. | Mode
  99. | AudioNext
  100. | AudioPrev
  101. | AudioStop
  102. | AudioPlay
  103. | AudioMute
  104. | MediaSelect
  105. | WWW
  106. | Mail
  107. | Calculator
  108. | Computer
  109. | ACSearch
  110. | ACHome
  111. | ACBack
  112. | ACForward
  113. | ACStop
  114. | ACRefresh
  115. | ACBookmarks
  116. | BrightnessDown
  117. | BrightnessUp
  118. | DisplaySwitch
  119. | IllumToggle
  120. | IllumDown
  121. | IllumUp
  122. | Eject
  123. | Sleep
  124. #end
  125. Enum Key
  126. 'https://wiki.libsdl.org/SDLKeycodeLookup
  127. None=0
  128. Backspace=8,Tab
  129. Enter=13
  130. Escape=27
  131. Space=32
  132. Apostrophe=39
  133. Comma=44,Minus,Period,Slash
  134. Key0=48,Key1,Key2,Key3,Key4,Key5,Key6,Key7,Key8,Key9
  135. Semicolon=59
  136. Equals=61
  137. LeftBracket=91,Backslash,RightBracket
  138. Backquote=96
  139. A=97,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
  140. KeyDelete=127
  141. CapsLock=185,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12
  142. PrintScreen,ScrollLock,Pause,Insert,Home,PageUp,nop,KeyEnd,PageDown
  143. Right,Left,Down,Up
  144. KeypadNumLock,KeypadDivide,KeypadMultiply,KeypadMinus,KeypadPlus,KeypadEnter
  145. Keypad1,Keypad2,Keypad3,Keypad4,Keypad5,Keypad6,Keypad7,Keypad8,Keypad9,Keypad0
  146. KeypadPeriod
  147. LeftControl=$e0+$80,LeftShift,LeftAlt,LeftGui,RightControl,RightShift,RightAlt,RightGui
  148. Mode=$101+$80,AudioNext,AudioPrev,AudioStop,AudioPlay,AudioMute,MediaSelect,WWW,Mail,Calculator,Computer
  149. ACSearch,ACHome,ACBack,ACForward,ACStop,ACRefresh,ACBookmarks
  150. BrightnessDown,BrightnessUp,DisplaySwitch,IllumToggle,IllumDown,IllumUp,Eject,Sleep
  151. Max
  152. Raw=$10000
  153. End
  154. #rem monkeydoc Modifier masks.
  155. | Modifier | Description
  156. |:--------------|:-----------
  157. | LeftShift | Left shift key.
  158. | RightShift | Right shift key.
  159. | LeftControl | Left control key.
  160. | RightControl | Right control key.
  161. | LeftAlt | Left alt key.
  162. | RightAlt | Right alt key.
  163. | LeftGui | Left gui key.
  164. | RightGui | Right gui key.
  165. | NumLock | Num lock key.
  166. | CapsLock | Caps lock key.
  167. | Shift | LeftShit | RightShift mask.
  168. | Control | LeftControl | RightControl mask.
  169. | Alt | LeftAlt | RightAlt mask.
  170. | Gui | LeftGui | RightGui mask.
  171. | LeftMenu | LeftGui on Mac target, LeftControl on other targets.
  172. | RightMenu | RightGui on Mac target, RightControl on other targets.
  173. | Menu | Gui on Mac target, Control on other targets.
  174. #end
  175. Enum Modifier
  176. None= $0000
  177. LeftShift= $0001
  178. RightShift= $0002
  179. LeftControl= $0040
  180. RightControl= $0080
  181. LeftAlt= $0100
  182. RightAlt= $0200
  183. LeftGui= $0400
  184. RightGui= $0800
  185. NumLock= $1000
  186. CapsLock= $2000
  187. Ignore= $4000
  188. Shift= LeftShift|RightShift
  189. Control= LeftControl|RightControl
  190. Alt= LeftAlt|RightAlt
  191. Gui= LeftGui|RightGui
  192. #if __HOSTOS__="macos"
  193. LeftMenu= LeftGui
  194. RightMenu= RightGui
  195. Menu= Gui
  196. #else
  197. LeftMenu= LeftControl
  198. RightMenu= RightControl
  199. Menu= Control
  200. #endif
  201. End