diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-04-29 14:44:48 -0500 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:57:16 +0200 |
| commit | be2aad1142bde494229d9d27d4123923aa578c1a (patch) | |
| tree | a564d1f6655c29426e1175b6d377769037e041ad /go/ui/buffer.go | |
| parent | 24d6e81d6f878f0ef4910ac125101dab963a913a (diff) | |
| download | muhqs-game-be2aad1142bde494229d9d27d4123923aa578c1a.tar.gz muhqs-game-be2aad1142bde494229d9d27d4123923aa578c1a.zip | |
overhaul ui
* implement events instead of interfaces
Interfaces and the wrappers head the problem that they could not support multiple events at once or only a single one without loosing the others.
* add text input support for WASM on mobile
A hidden html input is required to open the keyboard and receive the
input.
* improve the number choice
* fix using the default number
* add submit button only if a onclick method was provided
Diffstat (limited to 'go/ui/buffer.go')
| -rw-r--r-- | go/ui/buffer.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/go/ui/buffer.go b/go/ui/buffer.go index e46461bf..3abbc2cc 100644 --- a/go/ui/buffer.go +++ b/go/ui/buffer.go @@ -16,9 +16,9 @@ var ( type Buffer struct { WidgetBase - lines []string - pos int - font *text.GoTextFace + lines []string + pos int + font *text.GoTextFace lineSpacing float64 xMargin float64 } @@ -34,7 +34,7 @@ func (b *Buffer) render() *ebiten.Image { img.Fill(BUFFER_BACKGROUND) var y float64 = -b.font.Size for _, line := range b.lines[b.pos:] { - _, h := text.Measure(line, b.font, b.font.Size * b.lineSpacing) + _, h := text.Measure(line, b.font, b.font.Size*b.lineSpacing) y += h if y > float64(b.Height) { break @@ -72,6 +72,8 @@ func (b *Buffer) Remove(idx int) { b.ForceRedraw() } +func (*Buffer) IsScrollable() bool { return true } + func (b *Buffer) Scroll(x, y int) { if y == 0 { return |
