input.go no longer depends on glfw

This commit is contained in:
Sasha Koshka 2022-11-02 15:14:26 -04:00
parent fea20558ac
commit ce6a108d27

273
input.go
View File

@ -1,146 +1,143 @@
package stone
// FIXME: do not require import of glfw. this may require linking it, and also
// including the glfw go lib in the binary. horrible. we need to copy the key
// codes here ourselves.
import "github.com/go-gl/glfw/v3.3/glfw"
// These should be identical to the glfw keys
type Button int
const (
MouseButton1 Button = Button(glfw.MouseButton1)
MouseButton2 Button = Button(glfw.MouseButton2)
MouseButton3 Button = Button(glfw.MouseButton3)
MouseButton4 Button = Button(glfw.MouseButton4)
MouseButton5 Button = Button(glfw.MouseButton5)
MouseButton6 Button = Button(glfw.MouseButton6)
MouseButton7 Button = Button(glfw.MouseButton7)
MouseButton8 Button = Button(glfw.MouseButton8)
MouseButtonLast Button = Button(glfw.MouseButtonLast)
MouseButtonLeft Button = Button(glfw.MouseButtonLeft)
MouseButtonRight Button = Button(glfw.MouseButtonRight)
MouseButtonMiddle Button = Button(glfw.MouseButtonMiddle)
KeyUnknown Button = -1
KeyUnknown Button = Button(glfw.KeyUnknown)
KeySpace Button = Button(glfw.KeySpace)
KeyApostrophe Button = Button(glfw.KeyApostrophe)
KeyComma Button = Button(glfw.KeyComma)
KeyMinus Button = Button(glfw.KeyMinus)
KeyPeriod Button = Button(glfw.KeyPeriod)
KeySlash Button = Button(glfw.KeySlash)
Key0 Button = Button(glfw.Key0)
Key1 Button = Button(glfw.Key1)
Key2 Button = Button(glfw.Key2)
Key3 Button = Button(glfw.Key3)
Key4 Button = Button(glfw.Key4)
Key5 Button = Button(glfw.Key5)
Key6 Button = Button(glfw.Key6)
Key7 Button = Button(glfw.Key7)
Key8 Button = Button(glfw.Key8)
Key9 Button = Button(glfw.Key9)
KeySemicolon Button = Button(glfw.KeySemicolon)
KeyEqual Button = Button(glfw.KeyEqual)
KeyA Button = Button(glfw.KeyA)
KeyB Button = Button(glfw.KeyB)
KeyC Button = Button(glfw.KeyC)
KeyD Button = Button(glfw.KeyD)
KeyE Button = Button(glfw.KeyE)
KeyF Button = Button(glfw.KeyF)
KeyG Button = Button(glfw.KeyG)
KeyH Button = Button(glfw.KeyH)
KeyI Button = Button(glfw.KeyI)
KeyJ Button = Button(glfw.KeyJ)
KeyK Button = Button(glfw.KeyK)
KeyL Button = Button(glfw.KeyL)
KeyM Button = Button(glfw.KeyM)
KeyN Button = Button(glfw.KeyN)
KeyO Button = Button(glfw.KeyO)
KeyP Button = Button(glfw.KeyP)
KeyQ Button = Button(glfw.KeyQ)
KeyR Button = Button(glfw.KeyR)
KeyS Button = Button(glfw.KeyS)
KeyT Button = Button(glfw.KeyT)
KeyU Button = Button(glfw.KeyU)
KeyV Button = Button(glfw.KeyV)
KeyW Button = Button(glfw.KeyW)
KeyX Button = Button(glfw.KeyX)
KeyY Button = Button(glfw.KeyY)
KeyZ Button = Button(glfw.KeyZ)
KeyLeftBracket Button = Button(glfw.KeyLeftBracket)
KeyBackslash Button = Button(glfw.KeyBackslash)
KeyRightBracket Button = Button(glfw.KeyRightBracket)
KeyGraveAccent Button = Button(glfw.KeyGraveAccent)
KeyWorld1 Button = Button(glfw.KeyWorld1)
KeyWorld2 Button = Button(glfw.KeyWorld2)
KeyEscape Button = Button(glfw.KeyEscape)
KeyEnter Button = Button(glfw.KeyEnter)
KeyTab Button = Button(glfw.KeyTab)
KeyBackspace Button = Button(glfw.KeyBackspace)
KeyInsert Button = Button(glfw.KeyInsert)
KeyDelete Button = Button(glfw.KeyDelete)
KeyRight Button = Button(glfw.KeyRight)
KeyLeft Button = Button(glfw.KeyLeft)
KeyDown Button = Button(glfw.KeyDown)
KeyUp Button = Button(glfw.KeyUp)
KeyPageUp Button = Button(glfw.KeyPageUp)
KeyPageDown Button = Button(glfw.KeyPageDown)
KeyHome Button = Button(glfw.KeyHome)
KeyEnd Button = Button(glfw.KeyEnd)
KeyCapsLock Button = Button(glfw.KeyCapsLock)
KeyScrollLock Button = Button(glfw.KeyScrollLock)
KeyNumLock Button = Button(glfw.KeyNumLock)
KeyPrintScreen Button = Button(glfw.KeyPrintScreen)
KeyPause Button = Button(glfw.KeyPause)
KeyF1 Button = Button(glfw.KeyF1)
KeyF2 Button = Button(glfw.KeyF2)
KeyF3 Button = Button(glfw.KeyF3)
KeyF4 Button = Button(glfw.KeyF4)
KeyF5 Button = Button(glfw.KeyF5)
KeyF6 Button = Button(glfw.KeyF6)
KeyF7 Button = Button(glfw.KeyF7)
KeyF8 Button = Button(glfw.KeyF8)
KeyF9 Button = Button(glfw.KeyF9)
KeyF10 Button = Button(glfw.KeyF10)
KeyF11 Button = Button(glfw.KeyF11)
KeyF12 Button = Button(glfw.KeyF12)
KeyF13 Button = Button(glfw.KeyF13)
KeyF14 Button = Button(glfw.KeyF14)
KeyF15 Button = Button(glfw.KeyF15)
KeyF16 Button = Button(glfw.KeyF16)
KeyF17 Button = Button(glfw.KeyF17)
KeyF18 Button = Button(glfw.KeyF18)
KeyF19 Button = Button(glfw.KeyF19)
KeyF20 Button = Button(glfw.KeyF20)
KeyF21 Button = Button(glfw.KeyF21)
KeyF22 Button = Button(glfw.KeyF22)
KeyF23 Button = Button(glfw.KeyF23)
KeyF24 Button = Button(glfw.KeyF24)
KeyF25 Button = Button(glfw.KeyF25)
KeyKP0 Button = Button(glfw.KeyKP0)
KeyKP1 Button = Button(glfw.KeyKP1)
KeyKP2 Button = Button(glfw.KeyKP2)
KeyKP3 Button = Button(glfw.KeyKP3)
KeyKP4 Button = Button(glfw.KeyKP4)
KeyKP5 Button = Button(glfw.KeyKP5)
KeyKP6 Button = Button(glfw.KeyKP6)
KeyKP7 Button = Button(glfw.KeyKP7)
KeyKP8 Button = Button(glfw.KeyKP8)
KeyKP9 Button = Button(glfw.KeyKP9)
KeyKPDecimal Button = Button(glfw.KeyKPDecimal)
KeyKPDivide Button = Button(glfw.KeyKPDivide)
KeyKPMultiply Button = Button(glfw.KeyKPMultiply)
KeyKPSubtract Button = Button(glfw.KeyKPSubtract)
KeyKPAdd Button = Button(glfw.KeyKPAdd)
KeyKPEnter Button = Button(glfw.KeyKPEnter)
KeyKPEqual Button = Button(glfw.KeyKPEqual)
KeyLeftShift Button = Button(glfw.KeyLeftShift)
KeyLeftControl Button = Button(glfw.KeyLeftControl)
KeyLeftAlt Button = Button(glfw.KeyLeftAlt)
KeyLeftSuper Button = Button(glfw.KeyLeftSuper)
KeyRightShift Button = Button(glfw.KeyRightShift)
KeyRightControl Button = Button(glfw.KeyRightControl)
KeyRightAlt Button = Button(glfw.KeyRightAlt)
KeyRightSuper Button = Button(glfw.KeyRightSuper)
KeyMenu Button = Button(glfw.KeyMenu)
KeyLast Button = Button(glfw.KeyLast)
KeySpace Button = 162
KeyApostrophe Button = 161
KeyComma Button = 96
KeyMinus Button = 93
KeyPeriod Button = 92
KeySlash Button = 91
Key0 Button = 90
Key1 Button = 89
Key2 Button = 88
Key3 Button = 87
Key4 Button = 86
Key5 Button = 85
Key6 Button = 84
Key7 Button = 83
Key8 Button = 82
Key9 Button = 81
KeySemicolon Button = 80
KeyEqual Button = 79
KeyA Button = 78
KeyB Button = 77
KeyC Button = 76
KeyD Button = 75
KeyE Button = 74
KeyF Button = 73
KeyG Button = 72
KeyH Button = 71
KeyI Button = 70
KeyJ Button = 69
KeyK Button = 68
KeyL Button = 67
KeyM Button = 66
KeyN Button = 65
KeyO Button = 61
KeyP Button = 59
KeyQ Button = 57
KeyR Button = 56
KeyS Button = 55
KeyT Button = 54
KeyU Button = 53
KeyV Button = 52
KeyW Button = 51
KeyX Button = 50
KeyY Button = 49
KeyZ Button = 48
KeyLeftBracket Button = 47
KeyBackslash Button = 46
KeyRightBracket Button = 45
KeyGraveAccent Button = 44
KeyWorld1 Button = 39
KeyWorld2 Button = 32
KeyEscape Button = 348
KeyEnter Button = 347
KeyTab Button = 346
KeyBackspace Button = 345
KeyInsert Button = 344
KeyDelete Button = 343
KeyRight Button = 342
KeyLeft Button = 341
KeyDown Button = 340
KeyUp Button = 336
KeyPageUp Button = 335
KeyPageDown Button = 334
KeyHome Button = 333
KeyEnd Button = 332
KeyCapsLock Button = 331
KeyScrollLock Button = 330
KeyNumLock Button = 329
KeyPrintScreen Button = 328
KeyPause Button = 327
KeyF1 Button = 326
KeyF2 Button = 325
KeyF3 Button = 324
KeyF4 Button = 323
KeyF5 Button = 322
KeyF6 Button = 321
KeyF7 Button = 320
KeyF8 Button = 314
KeyF9 Button = 313
KeyF10 Button = 312
KeyF11 Button = 311
KeyF12 Button = 310
KeyF13 Button = 309
KeyF14 Button = 308
KeyF15 Button = 307
KeyF16 Button = 306
KeyF17 Button = 305
KeyF18 Button = 304
KeyF19 Button = 303
KeyF20 Button = 302
KeyF21 Button = 301
KeyF22 Button = 300
KeyF23 Button = 299
KeyF24 Button = 298
KeyF25 Button = 297
KeyKP0 Button = 296
KeyKP1 Button = 295
KeyKP2 Button = 294
KeyKP3 Button = 293
KeyKP4 Button = 292
KeyKP5 Button = 291
KeyKP6 Button = 290
KeyKP7 Button = 284
KeyKP8 Button = 283
KeyKP9 Button = 282
KeyKPDecimal Button = 281
KeyKPDivide Button = 280
KeyKPMultiply Button = 269
KeyKPSubtract Button = 268
KeyKPAdd Button = 267
KeyKPEnter Button = 266
KeyKPEqual Button = 265
KeyLeftShift Button = 264
KeyLeftControl Button = 263
KeyLeftAlt Button = 262
KeyLeftSuper Button = 261
KeyRightShift Button = 260
KeyRightControl Button = 259
KeyRightAlt Button = 258
KeyRightSuper Button = 257
KeyMenu Button = 256
MouseButton1 Button = 0
MouseButton2 Button = 1
MouseButton3 Button = 2
MouseButton4 Button = 3
MouseButton5 Button = 4
MouseButton6 Button = 5
MouseButton7 Button = 6
MouseButton8 Button = 7
MouseButtonLeft Button = MouseButton1
MouseButtonRight Button = MouseButton2
MouseButtonMiddle Button = MouseButton3
)