mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/ui: refactoring
This commit is contained in:
parent
a7135ce10b
commit
50f66963b0
@ -663,11 +663,6 @@ import (
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/glfw"
|
||||
)
|
||||
|
||||
var glfwKeyToUIKey = map[glfw.Key]Key{
|
||||
{{range $dname, $gname := .UIKeyNameToGLFWKeyName}}glfw.Key{{$gname}}: Key{{$dname}},
|
||||
{{end}}
|
||||
}
|
||||
|
||||
var uiKeyToGLFWKey = map[Key]glfw.Key{
|
||||
{{range $dname, $gname := .UIKeyNameToGLFWKeyName}}Key{{$dname}}: glfw.Key{{$gname}},
|
||||
{{end}}
|
||||
|
@ -29,7 +29,7 @@ func (i *Input) updateKeys(window *glfw.Window) {
|
||||
if i.keyPressed == nil {
|
||||
i.keyPressed = map[glfw.Key]bool{}
|
||||
}
|
||||
for gk := range glfwKeyToUIKey {
|
||||
for _, gk := range uiKeyToGLFWKey {
|
||||
i.keyPressed[gk] = window.GetKey(gk) == glfw.Press
|
||||
}
|
||||
}
|
||||
|
@ -23,114 +23,6 @@ import (
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/glfw"
|
||||
)
|
||||
|
||||
var glfwKeyToUIKey = map[glfw.Key]Key{
|
||||
glfw.KeyA: KeyA,
|
||||
glfw.KeyLeftAlt: KeyAltLeft,
|
||||
glfw.KeyRightAlt: KeyAltRight,
|
||||
glfw.KeyDown: KeyArrowDown,
|
||||
glfw.KeyLeft: KeyArrowLeft,
|
||||
glfw.KeyRight: KeyArrowRight,
|
||||
glfw.KeyUp: KeyArrowUp,
|
||||
glfw.KeyB: KeyB,
|
||||
glfw.KeyGraveAccent: KeyBackquote,
|
||||
glfw.KeyBackslash: KeyBackslash,
|
||||
glfw.KeyBackspace: KeyBackspace,
|
||||
glfw.KeyLeftBracket: KeyBracketLeft,
|
||||
glfw.KeyRightBracket: KeyBracketRight,
|
||||
glfw.KeyC: KeyC,
|
||||
glfw.KeyCapsLock: KeyCapsLock,
|
||||
glfw.KeyComma: KeyComma,
|
||||
glfw.KeyMenu: KeyContextMenu,
|
||||
glfw.KeyLeftControl: KeyControlLeft,
|
||||
glfw.KeyRightControl: KeyControlRight,
|
||||
glfw.KeyD: KeyD,
|
||||
glfw.KeyDelete: KeyDelete,
|
||||
glfw.Key0: KeyDigit0,
|
||||
glfw.Key1: KeyDigit1,
|
||||
glfw.Key2: KeyDigit2,
|
||||
glfw.Key3: KeyDigit3,
|
||||
glfw.Key4: KeyDigit4,
|
||||
glfw.Key5: KeyDigit5,
|
||||
glfw.Key6: KeyDigit6,
|
||||
glfw.Key7: KeyDigit7,
|
||||
glfw.Key8: KeyDigit8,
|
||||
glfw.Key9: KeyDigit9,
|
||||
glfw.KeyE: KeyE,
|
||||
glfw.KeyEnd: KeyEnd,
|
||||
glfw.KeyEnter: KeyEnter,
|
||||
glfw.KeyEqual: KeyEqual,
|
||||
glfw.KeyEscape: KeyEscape,
|
||||
glfw.KeyF: KeyF,
|
||||
glfw.KeyF1: KeyF1,
|
||||
glfw.KeyF10: KeyF10,
|
||||
glfw.KeyF11: KeyF11,
|
||||
glfw.KeyF12: KeyF12,
|
||||
glfw.KeyF2: KeyF2,
|
||||
glfw.KeyF3: KeyF3,
|
||||
glfw.KeyF4: KeyF4,
|
||||
glfw.KeyF5: KeyF5,
|
||||
glfw.KeyF6: KeyF6,
|
||||
glfw.KeyF7: KeyF7,
|
||||
glfw.KeyF8: KeyF8,
|
||||
glfw.KeyF9: KeyF9,
|
||||
glfw.KeyG: KeyG,
|
||||
glfw.KeyH: KeyH,
|
||||
glfw.KeyHome: KeyHome,
|
||||
glfw.KeyI: KeyI,
|
||||
glfw.KeyInsert: KeyInsert,
|
||||
glfw.KeyJ: KeyJ,
|
||||
glfw.KeyK: KeyK,
|
||||
glfw.KeyL: KeyL,
|
||||
glfw.KeyM: KeyM,
|
||||
glfw.KeyLeftSuper: KeyMetaLeft,
|
||||
glfw.KeyRightSuper: KeyMetaRight,
|
||||
glfw.KeyMinus: KeyMinus,
|
||||
glfw.KeyN: KeyN,
|
||||
glfw.KeyNumLock: KeyNumLock,
|
||||
glfw.KeyKP0: KeyNumpad0,
|
||||
glfw.KeyKP1: KeyNumpad1,
|
||||
glfw.KeyKP2: KeyNumpad2,
|
||||
glfw.KeyKP3: KeyNumpad3,
|
||||
glfw.KeyKP4: KeyNumpad4,
|
||||
glfw.KeyKP5: KeyNumpad5,
|
||||
glfw.KeyKP6: KeyNumpad6,
|
||||
glfw.KeyKP7: KeyNumpad7,
|
||||
glfw.KeyKP8: KeyNumpad8,
|
||||
glfw.KeyKP9: KeyNumpad9,
|
||||
glfw.KeyKPAdd: KeyNumpadAdd,
|
||||
glfw.KeyKPDecimal: KeyNumpadDecimal,
|
||||
glfw.KeyKPDivide: KeyNumpadDivide,
|
||||
glfw.KeyKPEnter: KeyNumpadEnter,
|
||||
glfw.KeyKPEqual: KeyNumpadEqual,
|
||||
glfw.KeyKPMultiply: KeyNumpadMultiply,
|
||||
glfw.KeyKPSubtract: KeyNumpadSubtract,
|
||||
glfw.KeyO: KeyO,
|
||||
glfw.KeyP: KeyP,
|
||||
glfw.KeyPageDown: KeyPageDown,
|
||||
glfw.KeyPageUp: KeyPageUp,
|
||||
glfw.KeyPause: KeyPause,
|
||||
glfw.KeyPeriod: KeyPeriod,
|
||||
glfw.KeyPrintScreen: KeyPrintScreen,
|
||||
glfw.KeyQ: KeyQ,
|
||||
glfw.KeyApostrophe: KeyQuote,
|
||||
glfw.KeyR: KeyR,
|
||||
glfw.KeyS: KeyS,
|
||||
glfw.KeyScrollLock: KeyScrollLock,
|
||||
glfw.KeySemicolon: KeySemicolon,
|
||||
glfw.KeyLeftShift: KeyShiftLeft,
|
||||
glfw.KeyRightShift: KeyShiftRight,
|
||||
glfw.KeySlash: KeySlash,
|
||||
glfw.KeySpace: KeySpace,
|
||||
glfw.KeyT: KeyT,
|
||||
glfw.KeyTab: KeyTab,
|
||||
glfw.KeyU: KeyU,
|
||||
glfw.KeyV: KeyV,
|
||||
glfw.KeyW: KeyW,
|
||||
glfw.KeyX: KeyX,
|
||||
glfw.KeyY: KeyY,
|
||||
glfw.KeyZ: KeyZ,
|
||||
}
|
||||
|
||||
var uiKeyToGLFWKey = map[Key]glfw.Key{
|
||||
KeyA: glfw.KeyA,
|
||||
KeyAltLeft: glfw.KeyLeftAlt,
|
||||
|
Loading…
Reference in New Issue
Block a user