mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +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)
|
setMouseCursorFromEvent(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
func OnTouchStart(e *js.Object, scale float64, left, top int) {
|
func OnTouchStart(e *js.Object) {
|
||||||
e.Call("preventDefault")
|
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")
|
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")
|
e.Call("preventDefault")
|
||||||
theInput.updateTouches(e, scale, left, top)
|
theInput.updateTouches(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
func setMouseCursorFromEvent(e *js.Object) {
|
func setMouseCursorFromEvent(e *js.Object) {
|
||||||
@ -261,7 +261,7 @@ func setMouseCursorFromEvent(e *js.Object) {
|
|||||||
theInput.setMouseCursor(x, y)
|
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")
|
j := e.Get("targetTouches")
|
||||||
ts := make([]*Touch, j.Get("length").Int())
|
ts := make([]*Touch, j.Get("length").Int())
|
||||||
for i := 0; i < len(ts); i++ {
|
for i := 0; i < len(ts); i++ {
|
||||||
|
@ -279,18 +279,9 @@ func initialize() error {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Touch
|
// Touch
|
||||||
canvas.Call("addEventListener", "touchstart", func(e *js.Object) {
|
canvas.Call("addEventListener", "touchstart", input.OnTouchStart)
|
||||||
rect := canvas.Call("getBoundingClientRect")
|
canvas.Call("addEventListener", "touchend", input.OnTouchEnd)
|
||||||
input.OnTouchStart(e, currentUI.getScale(), rect.Get("left").Int(), rect.Get("top").Int())
|
canvas.Call("addEventListener", "touchmove", input.OnTouchMove)
|
||||||
})
|
|
||||||
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())
|
|
||||||
})
|
|
||||||
|
|
||||||
// Gamepad
|
// Gamepad
|
||||||
window.Call("addEventListener", "gamepadconnected", func(e *js.Object) {
|
window.Call("addEventListener", "gamepadconnected", func(e *js.Object) {
|
||||||
|
Loading…
Reference in New Issue
Block a user