-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeycode.go
More file actions
47 lines (38 loc) · 902 Bytes
/
keycode.go
File metadata and controls
47 lines (38 loc) · 902 Bytes
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
package main
// Key represents a unified key code across platforms
type Key int
const (
KeyUnknown Key = iota
// Toggle key
KeyToggle // CapsLock
// Movement keys (WASD)
KeyMoveUp // W
KeyMoveDown // S
KeyMoveLeft // A
KeyMoveRight // D
// Diagonal movement
KeyDiagUpLeft // Q
KeyDiagUpRight // E
KeyDiagDownLeft // Z
KeyDiagDownRight // X
// Actions
KeyLeftClick // Space
KeyRightClick // Left Ctrl
KeyMiddleClick // Left Shift
KeyScrollUp // R
KeyScrollDown // F
)
// KeyEventType represents the type of keyboard event
type KeyEventType int
const (
KeyDown KeyEventType = iota
KeyUp
FlagsChanged // For modifier keys
)
// KeyEvent represents a keyboard event from the platform hook
type KeyEvent struct {
Keycode Key
EventType KeyEventType
RawCode int64 // Platform-specific raw keycode
Flags uint64 // Platform-specific modifier flags
}