gopxl / pixel

A hand-crafted 2D game library in Go.
MIT License
242 stars 10 forks source link

Input events #85

Closed bhperry closed 4 months ago

bhperry commented 4 months ago

Adding support for callbacks on window events.

Ended up deciding to go with a really simple system for this to avoid adding unnecessary overhead or restricting how callbacks are processed. A single callback function can be set for each supported type of window event (button, char, mouse enter/exit, mouse move, scroll). If users want to add additional structure to their event handlers (e.g. lists/trees of callback handlers), process events async, etc. then that is left up to them to implement.