mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
input: Refactoring: Remove unused arguments
This commit is contained in:
parent
0f2beab260
commit
76cb43a7f8
@ -241,19 +241,19 @@ func OnMouseMove(e *js.Object) {
|
||||
setMouseCursorFromEvent(e)
|
||||
}
|
||||
|
||||
func OnTouchStart(e *js.Object, scale float64, left, top int) {
|
||||
func OnTouchStart(e *js.Object) {
|
||||
e.Call("preventDefault")
|
||||
theInput.updateTouches(e, scale, left, top)
|
||||
theInput.updateTouches(e)
|
||||
}
|
||||
|
||||
func OnTouchEnd(e *js.Object, scale float64, left, top int) {
|
||||
func OnTouchEnd(e *js.Object) {
|
||||
e.Call("preventDefault")
|
||||
theInput.updateTouches(e, scale, left, top)
|
||||
theInput.updateTouches(e)
|
||||
}
|
||||
|
||||
func OnTouchMove(e *js.Object, scale float64, left, top int) {
|
||||
func OnTouchMove(e *js.Object) {
|
||||
e.Call("preventDefault")
|
||||
theInput.updateTouches(e, scale, left, top)
|
||||
theInput.updateTouches(e)
|
||||
}
|
||||
|
||||
func setMouseCursorFromEvent(e *js.Object) {
|
||||
@ -261,7 +261,7 @@ func setMouseCursorFromEvent(e *js.Object) {
|
||||
theInput.setMouseCursor(x, y)
|
||||
}
|
||||
|
||||
func (i *Input) updateTouches(e *js.Object, scale float64, left, top int) {
|
||||
func (i *Input) updateTouches(e *js.Object) {
|
||||
j := e.Get("targetTouches")
|
||||
ts := make([]*Touch, j.Get("length").Int())
|
||||
for i := 0; i < len(ts); i++ {
|
||||
|
@ -279,18 +279,9 @@ func initialize() error {
|
||||
})
|
||||
|
||||
// Touch
|
||||
canvas.Call("addEventListener", "touchstart", func(e *js.Object) {
|
||||
rect := canvas.Call("getBoundingClientRect")
|
||||
input.OnTouchStart(e, currentUI.getScale(), rect.Get("left").Int(), rect.Get("top").Int())
|
||||
})
|
||||
canvas.Call("addEventListener", "touchend", func(e *js.Object) {
|
||||
rect := canvas.Call("getBoundingClientRect")
|
||||
input.OnTouchEnd(e, currentUI.getScale(), rect.Get("left").Int(), rect.Get("top").Int())
|
||||
})
|
||||
canvas.Call("addEventListener", "touchmove", func(e *js.Object) {
|
||||
rect := canvas.Call("getBoundingClientRect")
|
||||
input.OnTouchMove(e, currentUI.getScale(), rect.Get("left").Int(), rect.Get("top").Int())
|
||||
})
|
||||
canvas.Call("addEventListener", "touchstart", input.OnTouchStart)
|
||||
canvas.Call("addEventListener", "touchend", input.OnTouchEnd)
|
||||
canvas.Call("addEventListener", "touchmove", input.OnTouchMove)
|
||||
|
||||
// Gamepad
|
||||
window.Call("addEventListener", "gamepadconnected", func(e *js.Object) {
|
||||
|
Loading…
Reference in New Issue
Block a user