aboutsummaryrefslogtreecommitdiff
path: root/go/ui/touchManager.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-06-17 11:43:34 -0500
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:21 +0200
commit4206d7fe5cf450fbc1f9a16e8d57b85c08df3dab (patch)
treec0dd008bcb47fe6e7af49e5b79ba928ace002cc7 /go/ui/touchManager.go
parentab08e0b7c7ebc50549392e6de3908dfa61f1e973 (diff)
downloadmuhqs-game-4206d7fe5cf450fbc1f9a16e8d57b85c08df3dab.tar.gz
muhqs-game-4206d7fe5cf450fbc1f9a16e8d57b85c08df3dab.zip
make input events consumable
Having a input queue of consumable input events allow widgets to prevent the further handling of the same event by different collections by consuming the event.
Diffstat (limited to 'go/ui/touchManager.go')
-rw-r--r--go/ui/touchManager.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/go/ui/touchManager.go b/go/ui/touchManager.go
index cedff82c..ef4448d5 100644
--- a/go/ui/touchManager.go
+++ b/go/ui/touchManager.go
@@ -49,6 +49,14 @@ type TouchInput struct {
Taps []Tap
}
+func (t *TouchInput) consumeTap(i int) {
+ if len(t.Taps) == 1 {
+ t.Taps = []Tap{}
+ } else {
+ t.Taps[i] = t.Taps[len(t.Taps)-1]
+ }
+}
+
var (
TouchManager *TouchInput
)