added MouseWheel event function

This commit is contained in:
Thomas Friedel 2018-09-08 11:07:55 +02:00
parent bfed5dc792
commit 77993ea244

View file

@ -32,6 +32,7 @@ type Window struct {
MouseDown func(button, x, y int)
MouseMove func(x, y int)
MouseUp func(button, x, y int)
MouseWheel func(x, y int)
KeyDown func(scancode int, rn rune, name string)
KeyUp func(scancode int, rn rune, name string)
KeyChar func(rn rune)
@ -154,6 +155,11 @@ func (wnd *Window) StartFrame() error {
wnd.MouseMove(int(e.X), int(e.Y))
handled = true
}
case *sdl.MouseWheelEvent:
if wnd.MouseWheel != nil {
wnd.MouseWheel(int(e.X), int(e.Y))
handled = true
}
case *sdl.KeyboardEvent:
if e.Type == sdl.KEYDOWN {
if wnd.KeyDown != nil {