83 lines
2.1 KiB
Go
83 lines
2.1 KiB
Go
package stone
|
|
|
|
import "unicode"
|
|
|
|
// Button represents a keyboard or mouse button.
|
|
type Button int
|
|
|
|
const (
|
|
ButtonUnknown Button = 0
|
|
|
|
KeyInsert Button = 1
|
|
KeyMenu Button = 2
|
|
KeyPrintScreen Button = 3
|
|
KeyPause Button = 4
|
|
KeyCapsLock Button = 5
|
|
KeyScrollLock Button = 6
|
|
KeyNumLock Button = 7
|
|
KeyBackspace Button = 8
|
|
KeyTab Button = 9
|
|
KeyEnter Button = 10
|
|
KeyEscape Button = 11
|
|
|
|
KeyUp Button = 12
|
|
KeyDown Button = 13
|
|
KeyLeft Button = 14
|
|
KeyRight Button = 15
|
|
KeyPageUp Button = 16
|
|
KeyPageDown Button = 17
|
|
KeyHome Button = 18
|
|
KeyEnd Button = 19
|
|
|
|
KeyLeftShift Button = 20
|
|
KeyRightShift Button = 21
|
|
KeyLeftControl Button = 22
|
|
KeyRightControl Button = 23
|
|
KeyLeftAlt Button = 24
|
|
KeyRightAlt Button = 25
|
|
KeyLeftSuper Button = 26
|
|
KeyRightSuper Button = 27
|
|
|
|
KeyDelete Button = 127
|
|
|
|
MouseButton1 Button = 128
|
|
MouseButton2 Button = 129
|
|
MouseButton3 Button = 130
|
|
MouseButton4 Button = 131
|
|
MouseButton5 Button = 132
|
|
MouseButton6 Button = 133
|
|
MouseButton7 Button = 134
|
|
MouseButton8 Button = 135
|
|
MouseButton9 Button = 136
|
|
MouseButtonLeft Button = MouseButton1
|
|
MouseButtonMiddle Button = MouseButton2
|
|
MouseButtonRight Button = MouseButton3
|
|
MouseButtonScrollUp Button = MouseButton4
|
|
MouseButtonScrollDown Button = MouseButton5
|
|
MouseButtonScrollLeft Button = MouseButton6
|
|
MouseButtonScrollRight Button = MouseButton7
|
|
MouseButtonBack Button = MouseButton8
|
|
MouseButtonForward Button = MouseButton9
|
|
|
|
KeyF1 Button = 144
|
|
KeyF2 Button = 145
|
|
KeyF3 Button = 146
|
|
KeyF4 Button = 147
|
|
KeyF5 Button = 148
|
|
KeyF6 Button = 149
|
|
KeyF7 Button = 150
|
|
KeyF8 Button = 151
|
|
KeyF9 Button = 152
|
|
KeyF10 Button = 153
|
|
KeyF11 Button = 154
|
|
KeyF12 Button = 155
|
|
)
|
|
|
|
// Printable returns whether or not the character could show up on screen. If
|
|
// this function returns true, the button can be cast to a rune and used as
|
|
// such.
|
|
func (button Button) Printable () (printable bool) {
|
|
printable = unicode.IsPrint(rune(button))
|
|
return
|
|
}
|