diff options
Diffstat (limited to 'go/ui/touchManager.go')
| -rw-r--r-- | go/ui/touchManager.go | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/go/ui/touchManager.go b/go/ui/touchManager.go index dfe4774a..9429b3b4 100644 --- a/go/ui/touchManager.go +++ b/go/ui/touchManager.go @@ -34,15 +34,15 @@ const ( ) var touchTypes = struct { - tap TouchType - longtap TouchType - pan TouchType - pinch TouchType + tap TouchType + longtap TouchType + pan TouchType + pinch TouchType }{ - tap: _tap, - longtap: _longtap, - pan: _pan, - pinch: _pinch, + tap: _tap, + longtap: _longtap, + pan: _pan, + pinch: _pinch, } // TouchInput is a "manager" for touch input and provides logical encapsulations of @@ -51,10 +51,10 @@ type TouchInput struct { touchIDs []ebiten.TouchID touches map[ebiten.TouchID]*touch - pinch *pinch - pan *pan - longtap *longtap - taps []tap + pinch *pinch + pan *pan + longtap *longtap + taps []tap } func (t *TouchInput) consumetap(i int) { @@ -65,9 +65,7 @@ func (t *TouchInput) consumetap(i int) { } } -var ( - TouchManager *TouchInput -) +var TouchManager *TouchInput func init() { TouchManager = NewTouchInput() @@ -181,10 +179,10 @@ func (in *TouchInput) Update() error { t := in.touches[id] t.isLongtap = true in.longtap = &longtap{ - id: id, - tap: tap{t.originX, t.originY}, + id: id, + tap: tap{t.originX, t.originY}, duration: t.duration, - } + } } } } @@ -193,10 +191,10 @@ func (in *TouchInput) Update() error { } type touch struct { - originX, originY int - currX, currY int - duration int - wasPinch, isPan, isLongtap bool + originX, originY int + currX, currY int + duration int + wasPinch, isPan, isLongtap bool } type pinch struct { @@ -252,6 +250,6 @@ type tap struct { type longtap struct { tap - id ebiten.TouchID + id ebiten.TouchID duration int } |
