2022-10-31 13:51:28 -06:00
|
|
|
package stone
|
|
|
|
|
2022-11-14 21:09:31 -07:00
|
|
|
import "unicode"
|
|
|
|
|
2022-11-14 22:22:01 -07:00
|
|
|
// Button represents a keyboard or mouse button.
|
2022-10-31 13:51:28 -06:00
|
|
|
type Button int
|
|
|
|
|
|
|
|
const (
|
2022-11-13 15:35:37 -07:00
|
|
|
ButtonUnknown Button = 0
|
2022-11-02 13:14:26 -06:00
|
|
|
|
2022-11-13 15:35:37 -07:00
|
|
|
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
|
2022-11-02 13:14:26 -06:00
|
|
|
|
2022-11-13 15:35:37 -07:00
|
|
|
KeyUp Button = 12
|
|
|
|
KeyDown Button = 13
|
|
|
|
KeyLeft Button = 14
|
|
|
|
KeyRight Button = 15
|
|
|
|
KeyPageUp Button = 16
|
|
|
|
KeyPageDown Button = 17
|
|
|
|
KeyHome Button = 18
|
|
|
|
KeyEnd Button = 19
|
2022-11-02 13:14:26 -06:00
|
|
|
|
2022-11-13 15:35:37 -07:00
|
|
|
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
|
2022-11-12 17:02:24 -07:00
|
|
|
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
|
2022-11-13 15:35:37 -07:00
|
|
|
|
2022-11-13 21:47:35 -07:00
|
|
|
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
|
2022-10-31 13:51:28 -06:00
|
|
|
)
|
2022-11-14 21:09:31 -07:00
|
|
|
|
2022-11-14 22:22:01 -07:00
|
|
|
// 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.
|
2022-11-14 21:09:31 -07:00
|
|
|
func (button Button) Printable () (printable bool) {
|
|
|
|
printable = unicode.IsPrint(rune(button))
|
|
|
|
return
|
|
|
|
}
|