zntg/allg5ui/key.go
Sander Schobers cdfb863ab0 Added SDL backend.
Added Action{,s}. List of actions that can be used to defer cleanup code (see NewRenderer implementations).
Added TextInputEvent (replaces the old KeyPressEvent) and added to new events KeyDown & KeyUp.
Added VSync to NewRendererOptions.
Removed IconScale from button.
Added ImageSource interface that replaces the Image/Texture method on the Texture interface. This makes converting back a texture to an image optional (since this is atypical for a hardware texture for instance).
Added new KeyModifier: OSCommand (Windows/Command key).
Added KeyState that can keep the state of keys (pressed or not).
Added KeyEnter, representing the Enter key.
Changed signatures of CreateTexture methods in Renderer.
Changed signatures of icon related method (removed factories).
Basic example now depends on sdlgui.
2020-05-15 09:20:44 +02:00

277 lines
5.6 KiB
Go

package allg5ui
import (
"opslag.de/schobers/allg5"
"opslag.de/schobers/zntg/ui"
)
func key(key allg5.Key) ui.Key {
switch key {
case allg5.Key0:
return ui.Key0
case allg5.Key1:
return ui.Key1
case allg5.Key2:
return ui.Key2
case allg5.Key3:
return ui.Key3
case allg5.Key4:
return ui.Key4
case allg5.Key5:
return ui.Key5
case allg5.Key6:
return ui.Key6
case allg5.Key7:
return ui.Key7
case allg5.Key8:
return ui.Key8
case allg5.Key9:
return ui.Key9
case allg5.KeyA:
return ui.KeyA
case allg5.KeyAlt:
return ui.KeyAlt
case allg5.KeyAltGr:
return ui.KeyAltGr
case allg5.KeyAt:
return ui.KeyAt
case allg5.KeyB:
return ui.KeyB
case allg5.KeyBack:
return ui.KeyBack
case allg5.KeyBackslash:
return ui.KeyBackslash
case allg5.KeyBackslash2:
return ui.KeyBackslash
case allg5.KeyBackspace:
return ui.KeyBackspace
case allg5.KeyBackQuote:
return ui.KeyBacktick
case allg5.KeyButtonA:
return ui.KeyButtonA
case allg5.KeyButtonB:
return ui.KeyButtonB
case allg5.KeyButtonL1:
return ui.KeyButtonL1
case allg5.KeyButtonL2:
return ui.KeyButtonL2
case allg5.KeyButtonR1:
return ui.KeyButtonR1
case allg5.KeyButtonR2:
return ui.KeyButtonR2
case allg5.KeyButtonX:
return ui.KeyButtonX
case allg5.KeyButtonY:
return ui.KeyButtonY
case allg5.KeyC:
return ui.KeyC
case allg5.KeyCapsLock:
return ui.KeyCapsLock
case allg5.KeyCircumflex:
return ui.KeyCircumflex
case allg5.KeyCloseBrace:
return ui.KeyCloseBrace
case allg5.KeyColon2:
return ui.KeyColon2
case allg5.KeyComma:
return ui.KeyComma
case allg5.KeyCommand:
return ui.KeyCommand
case allg5.KeyD:
return ui.KeyD
case allg5.KeyDelete:
return ui.KeyDelete
case allg5.KeyDown:
return ui.KeyDown
case allg5.KeyDPadCenter:
return ui.KeyDPadCenter
case allg5.KeyDPadDown:
return ui.KeyDPadDown
case allg5.KeyDPadLeft:
return ui.KeyDPadLeft
case allg5.KeyDPadRight:
return ui.KeyDPadRight
case allg5.KeyDPadUp:
return ui.KeyDPadUp
case allg5.KeyE:
return ui.KeyE
case allg5.KeyEnd:
return ui.KeyEnd
case allg5.KeyEnter:
return ui.KeyEnter
case allg5.KeyEquals:
return ui.KeyEquals
case allg5.KeyEscape:
return ui.KeyEscape
case allg5.KeyF:
return ui.KeyF
case allg5.KeyF1:
return ui.KeyF1
case allg5.KeyF2:
return ui.KeyF2
case allg5.KeyF3:
return ui.KeyF3
case allg5.KeyF4:
return ui.KeyF4
case allg5.KeyF5:
return ui.KeyF5
case allg5.KeyF6:
return ui.KeyF6
case allg5.KeyF7:
return ui.KeyF7
case allg5.KeyF8:
return ui.KeyF8
case allg5.KeyF9:
return ui.KeyF9
case allg5.KeyF10:
return ui.KeyF10
case allg5.KeyF11:
return ui.KeyF11
case allg5.KeyF12:
return ui.KeyF12
case allg5.KeyFullstop:
return ui.KeyFullstop
case allg5.KeyG:
return ui.KeyG
case allg5.KeyH:
return ui.KeyH
case allg5.KeyHome:
return ui.KeyHome
case allg5.KeyI:
return ui.KeyI
case allg5.KeyInsert:
return ui.KeyInsert
case allg5.KeyJ:
return ui.KeyJ
case allg5.KeyK:
return ui.KeyK
case allg5.KeyL:
return ui.KeyL
case allg5.KeyLeft:
return ui.KeyLeft
case allg5.KeyLCtrl:
return ui.KeyLeftControl
case allg5.KeyLShift:
return ui.KeyLeftShift
case allg5.KeyLWin:
return ui.KeyLeftWin
case allg5.KeyM:
return ui.KeyM
case allg5.KeyMenu:
return ui.KeyMenu
case allg5.KeyMinus:
return ui.KeyMinus
case allg5.KeyN:
return ui.KeyN
case allg5.KeyNumLock:
return ui.KeyNumLock
case allg5.KeyO:
return ui.KeyO
case allg5.KeyOpenBrace:
return ui.KeyOpenBrace
case allg5.KeyP:
return ui.KeyP
case allg5.KeyPad0:
return ui.KeyPad0
case allg5.KeyPad1:
return ui.KeyPad1
case allg5.KeyPad2:
return ui.KeyPad2
case allg5.KeyPad3:
return ui.KeyPad3
case allg5.KeyPad4:
return ui.KeyPad4
case allg5.KeyPad5:
return ui.KeyPad5
case allg5.KeyPad6:
return ui.KeyPad6
case allg5.KeyPad7:
return ui.KeyPad7
case allg5.KeyPad8:
return ui.KeyPad8
case allg5.KeyPad9:
return ui.KeyPad9
case allg5.KeyPadAsterisk:
return ui.KeyPadAsterisk
case allg5.KeyPadDelete:
return ui.KeyPadDelete
case allg5.KeyPadEnter:
return ui.KeyPadEnter
case allg5.KeyPadEquals:
return ui.KeyPadEquals
case allg5.KeyPadMinus:
return ui.KeyPadMinus
case allg5.KeyPadPlus:
return ui.KeyPadPlus
case allg5.KeyPadSlash:
return ui.KeyPadSlash
case allg5.KeyPageDown:
return ui.KeyPageDown
case allg5.KeyPageUp:
return ui.KeyPageUp
case allg5.KeyPause:
return ui.KeyPause
case allg5.KeyPrintScreen:
return ui.KeyPrintScreen
case allg5.KeyQ:
return ui.KeyQ
case allg5.KeyQuote:
return ui.KeyQuote
case allg5.KeyR:
return ui.KeyR
case allg5.KeyRight:
return ui.KeyRight
case allg5.KeyRCtrl:
return ui.KeyRightControl
case allg5.KeyRShift:
return ui.KeyRightShift
case allg5.KeyRWin:
return ui.KeyRightWin
case allg5.KeyS:
return ui.KeyS
case allg5.KeyScrollLock:
return ui.KeyScrollLock
case allg5.KeySearch:
return ui.KeySearch
case allg5.KeySelect:
return ui.KeySelect
case allg5.KeySemicolon:
return ui.KeySemicolon
case allg5.KeySlash:
return ui.KeySlash
case allg5.KeySpace:
return ui.KeySpace
case allg5.KeyStart:
return ui.KeyStart
case allg5.KeyT:
return ui.KeyT
case allg5.KeyTab:
return ui.KeyTab
case allg5.KeyThumbL:
return ui.KeyThumbL
case allg5.KeyThumbR:
return ui.KeyThumbR
case allg5.KeyTilde:
return ui.KeyTilde
case allg5.KeyU:
return ui.KeyU
case allg5.KeyUp:
return ui.KeyUp
case allg5.KeyV:
return ui.KeyV
case allg5.KeyVolumeDown:
return ui.KeyVolumeDown
case allg5.KeyVolumeUp:
return ui.KeyVolumeUp
case allg5.KeyW:
return ui.KeyW
case allg5.KeyX:
return ui.KeyX
case allg5.KeyY:
return ui.KeyY
case allg5.KeyZ:
return ui.KeyZ
}
return ui.KeyNone
}