aboutsummaryrefslogtreecommitdiff
path: root/go/ui
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-07-04 10:19:52 -0400
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:23 +0200
commita3ccc38a8903604b313981f6261a3c2bcf2c6963 (patch)
tree1fab7d380f37e0511776707f050055631cef4e29 /go/ui
parent787f667f827d5546eb8eb5c5c609fa88b32550a4 (diff)
downloadmuhqs-game-a3ccc38a8903604b313981f6261a3c2bcf2c6963.tar.gz
muhqs-game-a3ccc38a8903604b313981f6261a3c2bcf2c6963.zip
allow to update a TextBox's text
Diffstat (limited to 'go/ui')
-rw-r--r--go/ui/textBox.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/go/ui/textBox.go b/go/ui/textBox.go
index 7f8d75ee..c93e14e2 100644
--- a/go/ui/textBox.go
+++ b/go/ui/textBox.go
@@ -66,6 +66,12 @@ func (tb *TextBox) Centering(centering bool) *TextBox {
return tb
}
+// UpdateText displays the new text in the TextBox.
+func (tb *TextBox) UpdateText(new string) {
+ tb.text = new
+ tb.ForceRedraw()
+}
+
func NewUnitInfo(x, y int, u *game.Unit) *TextBox {
info := fmt.Sprintf("%s\nDamage: %d\nHealth: %d\nUpkeep: %d",
u.String(), u.Damage(), u.Health, u.UpkeepCost())