aboutsummaryrefslogtreecommitdiff
path: root/go/ui/textBox.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/ui/textBox.go')
-rw-r--r--go/ui/textBox.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/go/ui/textBox.go b/go/ui/textBox.go
index 1c82a307..cc813a4e 100644
--- a/go/ui/textBox.go
+++ b/go/ui/textBox.go
@@ -127,6 +127,7 @@ func NewPocList(centerX, bottomY int, poc game.PileOfCards) *PocList {
bottomY: bottomY,
poc: poc,
}
+
w.renderImpl = func() *ebiten.Image {
w.setText()
return w.render()
@@ -135,6 +136,7 @@ func NewPocList(centerX, bottomY int, poc game.PileOfCards) *PocList {
}
func (w *PocList) setText() {
+ w.Width, w.Height = -1, -1
t := ""
for _, c := range w.poc.Cards() {
t = fmt.Sprintf("%s%s\n", t, c.Name)
@@ -188,11 +190,15 @@ func NewTextInput(x, y int, width, height int, label string) *TextInput {
return w
}
-func (ti *TextInput) AddInput(input []rune) {
- ti.input += string(input)
+func (ti *TextInput) SetInput(input string) {
+ ti.input = input
ti.ForceRedraw()
}
+func (ti *TextInput) AddInput(input []rune) {
+ ti.SetInput(ti.input + string(input))
+}
+
func (ti *TextInput) HandleKey() {
if inpututil.IsKeyJustPressed(ebiten.KeyBackspace) {
if len(ti.input) > 0 {