diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-04-29 14:44:48 -0500 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-05-01 09:46:15 -0500 |
| commit | 6c4645eea5f26e32bc462c8627031a3563b1c39a (patch) | |
| tree | bb8828a53ab4b0a7baadaa58fb1cd1055d4d33cc /go/ui/clickable.go | |
| parent | c04fda8e5c2f097947843736f18b8af96a801daa (diff) | |
| download | muhqs-game-6c4645eea5f26e32bc462c8627031a3563b1c39a.tar.gz muhqs-game-6c4645eea5f26e32bc462c8627031a3563b1c39a.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/clickable.go')
| -rw-r--r-- | go/ui/clickable.go | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/go/ui/clickable.go b/go/ui/clickable.go deleted file mode 100644 index 761b7534..00000000 --- a/go/ui/clickable.go +++ /dev/null @@ -1,40 +0,0 @@ -package ui - -import ( - "github.com/hajimehoshi/ebiten/v2" -) - -type Clickable interface { - Click(x, y int) -} - -type ClickWrapper struct { - w Widget - onClick func(x, y int) -} - -func NewClickWrapper(w Widget, onClick func(x, y int)) *ClickWrapper { - return &ClickWrapper{w, onClick} -} - -func (w *ClickWrapper) Draw(screen *ebiten.Image) { - w.w.Draw(screen) -} - -func (w *ClickWrapper) FindObjectAt(x, y int) interface{} { - return w.w.FindObjectAt(x, y) -} - -func (w *ClickWrapper) Contains(x, y int) bool { - return w.w.Contains(x, y) -} - -func (w *ClickWrapper) Click(x, y int) { - w.onClick(x, y) -} - -func (w *ClickWrapper) Scroll(x, y int) { - if w, ok := w.w.(Scrollable); ok { - w.Scroll(x, y) - } -} |
