diff --git a/src/events.c b/src/events.c index c33577f..81c3753 100644 --- a/src/events.c +++ b/src/events.c @@ -192,6 +192,7 @@ int wiiuse_poll(struct wiimote_t** wm, int wiimotes) { } int wiiuse_update(struct wiimote_t** wiimotes, int nwiimotes, wiiuse_update_cb callback) { + int evnt = 0; if (wiiuse_poll(wiimotes, nwiimotes)) { static struct WiimoteState_t s; int i = 0; @@ -215,12 +216,12 @@ int wiiuse_update(struct wiimote_t** wiimotes, int nwiimotes, wiiuse_update_cb c s.state = wiimotes[i]->state; s.expansion = wiimotes[i]->exp; callback( &s ); + evnt++; break; } } - return 1; } - return 0; + return evnt; } /** diff --git a/src/wiiuse.h b/src/wiiuse.h index 2fe5dba..3b8ee8a 100644 --- a/src/wiiuse.h +++ b/src/wiiuse.h @@ -784,6 +784,8 @@ WIIUSE_EXPORT extern int wiiuse_poll(struct wiimote_t** wm, int wiimotes); * * Alternative to calling wiiuse_poll yourself, and provides the same * information struct on all platforms. + * + * @return Number of wiimotes that had an event. */ WIIUSE_EXPORT extern int wiiuse_update(struct wiimote_t** wm, int wiimotes, wiiuse_update_cb callback);