examples/wheel: Improve message

This commit is contained in:
Hajime Hoshi 2018-09-30 17:13:22 +09:00
parent 803e42714e
commit 0224858b7b
2 changed files with 4 additions and 1 deletions

View File

@ -17,6 +17,7 @@
package main package main
import ( import (
"fmt"
"image/color" "image/color"
"log" "log"
@ -55,7 +56,8 @@ func update(screen *ebiten.Image) error {
op.GeoM.Translate(screenWidth/2, screenHeight/2) op.GeoM.Translate(screenWidth/2, screenHeight/2)
screen.DrawImage(pointerImage, op) screen.DrawImage(pointerImage, op)
ebitenutil.DebugPrint(screen, "Move the red point by mouse wheeling") ebitenutil.DebugPrint(screen,
fmt.Sprintf("Move the red point by mouse wheel\n(%0.2f, %0.2f)", x, y))
return nil return nil
} }

View File

@ -248,6 +248,7 @@ func OnMouseMove(e js.Value) {
} }
func OnWheel(e js.Value) { func OnWheel(e js.Value) {
// TODO: What if e.deltaMode is not DOM_DELTA_PIXEL?
theInput.wheelX = e.Get("deltaX").Float() theInput.wheelX = e.Get("deltaX").Float()
theInput.wheelY = e.Get("deltaY").Float() theInput.wheelY = e.Get("deltaY").Float()
} }