Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keycode: fix NumPad codes #768

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 124 additions & 89 deletions Keycode.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package giu

import "C"
import (
"log"

Expand All @@ -13,95 +14,112 @@ type Key imgui.Key
// but re-arranged to map to 7-bit ASCII for printable keys (function keys are
// put in the 256+ range).
const (
KeyNone Key = Key(imgui.KeyNone)
KeySpace Key = Key(imgui.KeySpace)
KeyApostrophe Key = Key(imgui.KeyApostrophe)
KeyComma Key = Key(imgui.KeyComma)
KeyMinus Key = Key(imgui.KeyMinus)
KeyPeriod Key = Key(imgui.KeyPeriod)
KeySlash Key = Key(imgui.KeySlash)
Key0 Key = Key(imgui.Key0)
Key1 Key = Key(imgui.Key1)
Key2 Key = Key(imgui.Key2)
Key3 Key = Key(imgui.Key3)
Key4 Key = Key(imgui.Key4)
Key5 Key = Key(imgui.Key5)
Key6 Key = Key(imgui.Key6)
Key7 Key = Key(imgui.Key7)
Key8 Key = Key(imgui.Key8)
Key9 Key = Key(imgui.Key9)
KeySemicolon Key = Key(imgui.KeySemicolon)
KeyEqual Key = Key(imgui.KeyEqual)
KeyA Key = Key(imgui.KeyA)
KeyB Key = Key(imgui.KeyB)
KeyC Key = Key(imgui.KeyC)
KeyD Key = Key(imgui.KeyD)
KeyE Key = Key(imgui.KeyE)
KeyF Key = Key(imgui.KeyF)
KeyG Key = Key(imgui.KeyG)
KeyH Key = Key(imgui.KeyH)
KeyI Key = Key(imgui.KeyI)
KeyJ Key = Key(imgui.KeyJ)
KeyK Key = Key(imgui.KeyK)
KeyL Key = Key(imgui.KeyL)
KeyM Key = Key(imgui.KeyM)
KeyN Key = Key(imgui.KeyN)
KeyO Key = Key(imgui.KeyO)
KeyP Key = Key(imgui.KeyP)
KeyQ Key = Key(imgui.KeyQ)
KeyR Key = Key(imgui.KeyR)
KeyS Key = Key(imgui.KeyS)
KeyT Key = Key(imgui.KeyT)
KeyU Key = Key(imgui.KeyU)
KeyV Key = Key(imgui.KeyV)
KeyW Key = Key(imgui.KeyW)
KeyX Key = Key(imgui.KeyX)
KeyY Key = Key(imgui.KeyY)
KeyZ Key = Key(imgui.KeyZ)
KeyLeftBracket Key = Key(imgui.KeyLeftBracket)
KeyBackslash Key = Key(imgui.KeyBackslash)
KeyRightBracket Key = Key(imgui.KeyRightBracket)
KeyGraveAccent Key = Key(imgui.KeyGraveAccent)
KeyEscape Key = Key(imgui.KeyEscape)
KeyEnter Key = Key(imgui.KeyEnter)
KeyTab Key = Key(imgui.KeyTab)
KeyBackspace Key = Key(imgui.KeyBackspace)
KeyInsert = Key(imgui.KeyInsert)
KeyDelete = Key(imgui.KeyDelete)
KeyRight = Key(imgui.KeyRightArrow)
KeyLeft = Key(imgui.KeyLeftArrow)
KeyDown = Key(imgui.KeyDownArrow)
KeyUp = Key(imgui.KeyUpArrow)
KeyPageUp = Key(imgui.KeyPageUp)
KeyPageDown = Key(imgui.KeyPageDown)
KeyHome = Key(imgui.KeyHome)
KeyEnd = Key(imgui.KeyEnd)
KeyCapsLock = Key(imgui.KeyCapsLock)
KeyScrollLock = Key(imgui.KeyScrollLock)
KeyNumLock = Key(imgui.KeyNumLock)
KeyPrintScreen = Key(imgui.KeyPrintScreen)
KeyPause = Key(imgui.KeyPause)
KeyF1 = Key(imgui.KeyF1)
KeyF2 = Key(imgui.KeyF2)
KeyF3 = Key(imgui.KeyF3)
KeyF4 = Key(imgui.KeyF4)
KeyF5 = Key(imgui.KeyF5)
KeyF6 = Key(imgui.KeyF6)
KeyF7 = Key(imgui.KeyF7)
KeyF8 = Key(imgui.KeyF8)
KeyF9 = Key(imgui.KeyF9)
KeyF10 = Key(imgui.KeyF10)
KeyF11 = Key(imgui.KeyF11)
KeyF12 = Key(imgui.KeyF12)
KeyLeftShift = Key(imgui.KeyLeftShift)
KeyLeftControl = Key(imgui.KeyLeftCtrl)
KeyLeftAlt = Key(imgui.KeyLeftAlt)
KeyLeftSuper = Key(imgui.KeyLeftSuper)
KeyRightShift = Key(imgui.KeyRightShift)
KeyRightControl = Key(imgui.KeyRightCtrl)
KeyRightAlt = Key(imgui.KeyRightAlt)
KeyRightSuper = Key(imgui.KeyRightSuper)
KeyMenu = Key(imgui.KeyMenu)
KeyNone = Key(imgui.KeyNone)
KeySpace = Key(imgui.KeySpace)
KeyApostrophe = Key(imgui.KeyApostrophe)
KeyComma = Key(imgui.KeyComma)
KeyMinus = Key(imgui.KeyMinus)
KeyPeriod = Key(imgui.KeyPeriod)
KeySlash = Key(imgui.KeySlash)
Key0 = Key(imgui.Key0)
Key1 = Key(imgui.Key1)
Key2 = Key(imgui.Key2)
Key3 = Key(imgui.Key3)
Key4 = Key(imgui.Key4)
Key5 = Key(imgui.Key5)
Key6 = Key(imgui.Key6)
Key7 = Key(imgui.Key7)
Key8 = Key(imgui.Key8)
Key9 = Key(imgui.Key9)
KeySemicolon = Key(imgui.KeySemicolon)
KeyEqual = Key(imgui.KeyEqual)
KeyA = Key(imgui.KeyA)
KeyB = Key(imgui.KeyB)
KeyC = Key(imgui.KeyC)
KeyD = Key(imgui.KeyD)
KeyE = Key(imgui.KeyE)
KeyF = Key(imgui.KeyF)
KeyG = Key(imgui.KeyG)
KeyH = Key(imgui.KeyH)
KeyI = Key(imgui.KeyI)
KeyJ = Key(imgui.KeyJ)
KeyK = Key(imgui.KeyK)
KeyL = Key(imgui.KeyL)
KeyM = Key(imgui.KeyM)
KeyN = Key(imgui.KeyN)
KeyO = Key(imgui.KeyO)
KeyP = Key(imgui.KeyP)
KeyQ = Key(imgui.KeyQ)
KeyR = Key(imgui.KeyR)
KeyS = Key(imgui.KeyS)
KeyT = Key(imgui.KeyT)
KeyU = Key(imgui.KeyU)
KeyV = Key(imgui.KeyV)
KeyW = Key(imgui.KeyW)
KeyX = Key(imgui.KeyX)
KeyY = Key(imgui.KeyY)
KeyZ = Key(imgui.KeyZ)
KeyLeftBracket = Key(imgui.KeyLeftBracket)
KeyBackslash = Key(imgui.KeyBackslash)
KeyRightBracket = Key(imgui.KeyRightBracket)
KeyGraveAccent = Key(imgui.KeyGraveAccent)
KeyEscape = Key(imgui.KeyEscape)
KeyEnter = Key(imgui.KeyEnter)
KeyTab = Key(imgui.KeyTab)
KeyBackspace = Key(imgui.KeyBackspace)
KeyInsert = Key(imgui.KeyInsert)
KeyDelete = Key(imgui.KeyDelete)
KeyRight = Key(imgui.KeyRightArrow)
KeyLeft = Key(imgui.KeyLeftArrow)
KeyDown = Key(imgui.KeyDownArrow)
KeyUp = Key(imgui.KeyUpArrow)
KeyPageUp = Key(imgui.KeyPageUp)
KeyPageDown = Key(imgui.KeyPageDown)
KeyHome = Key(imgui.KeyHome)
KeyEnd = Key(imgui.KeyEnd)
KeyCapsLock = Key(imgui.KeyCapsLock)
KeyScrollLock = Key(imgui.KeyScrollLock)
KeyNumLock = Key(imgui.KeyNumLock)
KeyPrintScreen = Key(imgui.KeyPrintScreen)
KeyPause = Key(imgui.KeyPause)
KeyF1 = Key(imgui.KeyF1)
KeyF2 = Key(imgui.KeyF2)
KeyF3 = Key(imgui.KeyF3)
KeyF4 = Key(imgui.KeyF4)
KeyF5 = Key(imgui.KeyF5)
KeyF6 = Key(imgui.KeyF6)
KeyF7 = Key(imgui.KeyF7)
KeyF8 = Key(imgui.KeyF8)
KeyF9 = Key(imgui.KeyF9)
KeyF10 = Key(imgui.KeyF10)
KeyF11 = Key(imgui.KeyF11)
KeyF12 = Key(imgui.KeyF12)
KeyNumPad0 = Key(imgui.GLFWKeyKp0)
KeyNumPad1 = Key(imgui.GLFWKeyKp1)
KeyNumPad2 = Key(imgui.GLFWKeyKp2)
KeyNumPad3 = Key(imgui.GLFWKeyKp3)
KeyNumPad4 = Key(imgui.GLFWKeyKp4)
KeyNumPad5 = Key(imgui.GLFWKeyKp5)
KeyNumPad6 = Key(imgui.GLFWKeyKp6)
KeyNumPad7 = Key(imgui.GLFWKeyKp7)
KeyNumPad8 = Key(imgui.GLFWKeyKp8)
KeyNumPad9 = Key(imgui.GLFWKeyKp9)
KeyNumPadDecimal = Key(imgui.GLFWKeyKpDecimal)
KeyNumPadDivide = Key(imgui.GLFWKeyKpDivide)
KeyNumPadMultiply = Key(imgui.GLFWKeyKpMultiply)
KeyNumPadSubtract = Key(imgui.GLFWKeyKpSubtract)
KeyNumPadAdd = Key(imgui.GLFWKeyKpAdd)
KeyNumPadEnter = Key(imgui.GLFWKeyKpEnter)
KeyNumPadEqual = Key(imgui.GLFWKeyKpEqual)
KeyLeftShift = Key(imgui.KeyLeftShift)
KeyLeftControl = Key(imgui.KeyLeftCtrl)
KeyLeftAlt = Key(imgui.KeyLeftAlt)
KeyLeftSuper = Key(imgui.KeyLeftSuper)
KeyRightShift = Key(imgui.KeyRightShift)
KeyRightControl = Key(imgui.KeyRightCtrl)
KeyRightAlt = Key(imgui.KeyRightAlt)
KeyRightSuper = Key(imgui.KeyRightSuper)
KeyMenu = Key(imgui.KeyMenu)
)

// refer glfw3.h.
Expand Down Expand Up @@ -186,6 +204,23 @@ func keyFromGLFWKey(k imgui.GLFWKey) Key {
imgui.GLFWKeyF10: KeyF10,
imgui.GLFWKeyF11: KeyF11,
imgui.GLFWKeyF12: KeyF12,
imgui.GLFWKeyKp0: KeyNumPad0,
imgui.GLFWKeyKp1: KeyNumPad1,
imgui.GLFWKeyKp2: KeyNumPad2,
imgui.GLFWKeyKp3: KeyNumPad3,
imgui.GLFWKeyKp4: KeyNumPad4,
imgui.GLFWKeyKp5: KeyNumPad5,
imgui.GLFWKeyKp6: KeyNumPad6,
imgui.GLFWKeyKp7: KeyNumPad7,
imgui.GLFWKeyKp8: KeyNumPad8,
imgui.GLFWKeyKp9: KeyNumPad9,
imgui.GLFWKeyKpDecimal: KeyNumPadDecimal,
imgui.GLFWKeyKpDivide: KeyNumPadDivide,
imgui.GLFWKeyKpMultiply: KeyNumPadMultiply,
imgui.GLFWKeyKpSubtract: KeyNumPadSubtract,
imgui.GLFWKeyKpAdd: KeyNumPadAdd,
imgui.GLFWKeyKpEnter: KeyNumPadEnter,
imgui.GLFWKeyKpEqual: KeyNumPadEqual,
imgui.GLFWKeyLeftShift: KeyLeftShift,
imgui.GLFWKeyLeftControl: KeyLeftControl,
imgui.GLFWKeyLeftAlt: KeyLeftAlt,
Expand Down
Loading