-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeycodes.go
161 lines (151 loc) · 2.39 KB
/
keycodes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// The contents of this file is free and unencumbered software released into
// the public domain. Refer to <http://unlicense.org/> for more information.
package keycodes
// note: similar keys have different key codes, like Enter and
// Keypad Enter
// cross-platform key codes, compatible with SDL 2 and USB HID speccy
// https://hg.libsdl.org/SDL/file/default/include/SDL_scancode.h
// http://www.usb.org/developers/hidpage/Hut1_12v2.pdf (page 53)
// key for codes 0 - 3 are not present on keyboards, they are:
// 0 - Reserved (no event)
// 1 - ErrorRollOver
// 2 - POSTFail
// 3 - ErrorUndefined
const (
KeyA uint16 = 4 + iota
KeyB
KeyC
KeyD
KeyE
KeyF
KeyG
KeyH
KeyI
KeyJ
KeyK
KeyL
KeyM
KeyN
KeyO
KeyP
KeyQ
KeyR
KeyS
KeyT
KeyU
KeyV
KeyW
KeyX
KeyY
KeyZ
)
const (
Key1 uint16 = 30 + iota
Key2
Key3
Key4
Key5
Key6
Key7
Key8
Key9
Key0
)
const (
// choice is to use Enter name instead of Return
// and the key code is different from Keypad Enter
KeyEnter uint16 = 40 + iota
KeyEscape
KeyBackspace
KeyTab
KeySpace
// keypad minus has different key code
KeyMinus
KeyEquals
KeyLeftBracket
KeyRightBracket
KeyBackslash
)
// key code number 50 is skipped, because it is unclear
// where is the key, and what is its name and function
const (
// different name from SDL2 for brevity
KeyColon uint16 = 51 + iota
KeyApostrophe
// KeyTilde is an alias
KeyGrave
KeyCommad
// KeyDot is an alias, keypad period is a different
KeyPeriod
Slash
CapsLock
)
const KeyTilde = KeyGrave
const KeyDot = KeyPeriod
const (
KeyF1 uint16 = 58 + iota
KeyF2
KeyF3
KeyF4
KeyF5
KeyF6
KeyF7
KeyF8
KeyF9
KeyF10
KeyF11
KeyF12
)
const (
KeyPrintScreen uint16 = 70 + iota
KeyScrollLock
KeyPause
KeyInsert
KeyHome
KeyPageUp
KeyDelete
KeyEnd
KeyPageDown
KeyRight
KeyLeft
KeyDown
KeyUp
)
const (
KeyNumLock uint16 = 83 + iota
KeyKpDivide
KeyKpMultiply
KeyKpMinus
KeyKpPlus
KeyKpEnter
KeyKp1
KeyKp2
KeyKp3
KeyKp4
KeyKp5
KeyKp6
KeyKp7
KeyKp8
KeyKp9
KeyKp0
// KeyKpDot is an alias
KeyKpPeriod
)
const KeyKpDot = KeyKpPeriod
// key code 100 is skipped, because I can not find the key
// key code 101 is not present on Mac
// key codes 102-223 are not present on PC
const (
KeyLCtrl uint16 = 224 + iota
KeyLShift
KeyLAlt
// KeyLWin is an alias
KeyLGUI
KeyRCtrl
KeyRShift
KeyRAlt
// KeyRWin is an alias
KeyRGUI
)
const KeyLWin = KeyLGUI
const KeyRWin = KeyRGUI