From 0224858b7b737be936d4a9a81e17bcee68883b19 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 30 Sep 2018 17:13:22 +0900 Subject: [PATCH] examples/wheel: Improve message --- examples/wheel/main.go | 4 +++- internal/input/input_js.go | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/wheel/main.go b/examples/wheel/main.go index 355c3a4e0..d475bc692 100644 --- a/examples/wheel/main.go +++ b/examples/wheel/main.go @@ -17,6 +17,7 @@ package main import ( + "fmt" "image/color" "log" @@ -55,7 +56,8 @@ func update(screen *ebiten.Image) error { op.GeoM.Translate(screenWidth/2, screenHeight/2) 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 } diff --git a/internal/input/input_js.go b/internal/input/input_js.go index 39ced91b4..9e7dc99ef 100644 --- a/internal/input/input_js.go +++ b/internal/input/input_js.go @@ -248,6 +248,7 @@ func OnMouseMove(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.wheelY = e.Get("deltaY").Float() }