mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
examples/wheel: Improve message
This commit is contained in:
parent
803e42714e
commit
0224858b7b
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user