From 5d6f66935a72e4a549259661db44af21d9940583 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 31 Mar 2019 01:27:13 +0900 Subject: [PATCH] ui: Remove UpdateTouches --- internal/ui/ui_js.go | 8 ++++++-- internal/ui/ui_mobile.go | 6 +----- mobile/touches_mobile.go | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/internal/ui/ui_js.go b/internal/ui/ui_js.go index f0ee2b83c..010922776 100644 --- a/internal/ui/ui_js.go +++ b/internal/ui/ui_js.go @@ -122,8 +122,12 @@ func AdjustedTouches() []*input.Touch { ts := input.Get().Touches() adjusted := make([]*input.Touch, len(ts)) for i, t := range ts { - x, y := adjustPosition(t.Position()) - adjusted[i] = input.NewTouch(t.ID(), x, y) + x, y := adjustPosition(t.X, t.Y) + adjusted[i] = &input.Touch{ + ID: t.ID, + X: x, + Y: y, + } } return adjusted } diff --git a/internal/ui/ui_mobile.go b/internal/ui/ui_mobile.go index 9c45377a4..8fc690f38 100644 --- a/internal/ui/ui_mobile.go +++ b/internal/ui/ui_mobile.go @@ -140,7 +140,7 @@ func appMain(a app.App) { for _, t := range touches { ts = append(ts, t) } - UpdateTouches(ts) + input.Get().UpdateTouches(ts) } } } @@ -434,10 +434,6 @@ func SetVsyncEnabled(enabled bool) { // Do nothing } -func UpdateTouches(touches []*input.Touch) { - input.Get().UpdateTouches(touches) -} - func DeviceScaleFactor() float64 { return getDeviceScale() } diff --git a/mobile/touches_mobile.go b/mobile/touches_mobile.go index 10ca32ff3..c6bc29901 100644 --- a/mobile/touches_mobile.go +++ b/mobile/touches_mobile.go @@ -18,7 +18,6 @@ package mobile import ( "github.com/hajimehoshi/ebiten/internal/input" - "github.com/hajimehoshi/ebiten/internal/ui" ) type position struct { @@ -39,5 +38,5 @@ func updateTouches() { Y: position.y, }) } - ui.UpdateTouches(ts) + input.Get().UpdateTouches(ts) }