add go modules
This commit is contained in:
1 parent
83dc2f9007
commit
ed22f7a37e
24 files changed
+380
-1520
No files matched your search
@@ -0,0 +1,34 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"lab.zaar.be/thefish/alchemyst-go/util"
|
||||
blt "lab.zaar.be/thefish/bearlibterminal"
|
||||
)
|
||||
|
||||
var modifiers = []int{blt.TK_SHIFT, blt.TK_ALT, blt.TK_CONTROL}
|
||||
|
||||
func ReadKey(ctx util.ClientCtx) (string, int) {
|
||||
if !blt.HasInput() {
|
||||
return "", blt.TK_NONE
|
||||
}
|
||||
var key = blt.Read()
|
||||
var pressed = ""
|
||||
var isModifier, _ = util.InArray(key, modifiers)
|
||||
if !isModifier {
|
||||
|
||||
pressed = Scancodemap[key]
|
||||
|
||||
if blt.Check(blt.TK_SHIFT) != 0 {
|
||||
pressed = "Shift+" + pressed
|
||||
}
|
||||
if blt.Check(blt.TK_ALT) != 0 {
|
||||
pressed = "Alt+" + pressed
|
||||
}
|
||||
if blt.Check(blt.TK_CONTROL) != 0 {
|
||||
pressed = "Ctrl+" + pressed
|
||||
}
|
||||
ctx.Logger().Debug().Msg(pressed)
|
||||
}
|
||||
|
||||
return pressed, key
|
||||
}
|
||||
Reference in new issue
Block a user