aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--go/ui/update.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/go/ui/update.go b/go/ui/update.go
index 621d5dea..9c8ce82c 100644
--- a/go/ui/update.go
+++ b/go/ui/update.go
@@ -3,6 +3,7 @@ package ui
import (
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/inpututil"
+ "muhq.space/muhqs-game/go/log"
)
// InputType distinguishes the different supported kinds of input.
@@ -29,6 +30,31 @@ const (
Longtap
)
+func (it InputType) String() string {
+ switch it {
+ case Click:
+ return "Click"
+ case Scroll:
+ return "Scroll"
+ case Text:
+ return "Text"
+ case Tap:
+ return "Tap"
+ case Pan:
+ return "Pan"
+ case Pinch:
+ return "Pinch"
+ case HoverStart:
+ return "HoverStart"
+ case HoverEnd:
+ return "HoverEnd"
+ case Longtap:
+ return "Longtap"
+ }
+ log.Panic("unexausted InputType switch")
+ return ""
+}
+
// InputEvent contains all information associated with an occurred user input.
type InputEvent struct {
Kind InputType
@@ -69,6 +95,7 @@ func ConsumeInput(i int) {
// AppendInput appends an input event to the input queue.
func AppendInput(ev InputEvent) {
+ log.Debug("append input event", "event", ev)
Input = append(Input, ev)
}