diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-07-04 10:19:52 -0400 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-07-06 11:49:19 -0400 |
| commit | c5addb37547acff9483ad126497ffa934d223c48 (patch) | |
| tree | b1c298222477eb78061a54c5d2493f0e77b14447 /go | |
| parent | 232145193498c9d34f687485b7ad212e0100612b (diff) | |
| download | muhqs-game-c5addb37547acff9483ad126497ffa934d223c48.tar.gz muhqs-game-c5addb37547acff9483ad126497ffa934d223c48.zip | |
allow to update a TextBox's text
Diffstat (limited to 'go')
| -rw-r--r-- | go/ui/textBox.go | 6 |
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()) |
