veandco / go-sdl2-examples

This is where all go-sdl2 examples are stored
91 stars 34 forks source link

Fixed init and button detection runtime #7

Closed theunkn0wn1 closed 4 years ago

theunkn0wn1 commented 4 years ago

Fixed some small issues in the joystick example.

The JoyButtonEvent handler was checking against t.Type when it should have been checking against t.State. this caused the script to always state a button was released, even if the event was indicating the button was pressed.

There appears to be a missing int cast on the JoyDeviceAddedEvent, which resulted in compile errors.

./example.go:73:49: cannot use t.Which (type sdl.JoystickID) as type int in argument to sdl.JoystickOpen
veeableful commented 4 years ago

Thank you @theunkn0wn1! I will merge this now.