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 }