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() (string, int) { if !blt.HasInput() { return "", blt.TK_NONE } var key = blt.Read() var pressed = "" var isModifier, _ = util.IntInSlice(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 } //appctx.Logger().Debug().Msg(pressed) } return pressed, key } func ReadKeyCode() int { if !blt.HasInput() { return blt.TK_NONE } return blt.Read() }