Make the return value of wiiuse_update match that of wiiuse_poll

This commit is contained in:
Ryan Pavlik
2011-06-17 10:15:43 -05:00
parent 8f07f7a480
commit 3ae8ff0139
2 changed files with 5 additions and 2 deletions

View File

@@ -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 wiiuse_update(struct wiimote_t** wiimotes, int nwiimotes, wiiuse_update_cb callback) {
int evnt = 0;
if (wiiuse_poll(wiimotes, nwiimotes)) { if (wiiuse_poll(wiimotes, nwiimotes)) {
static struct WiimoteState_t s; static struct WiimoteState_t s;
int i = 0; 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.state = wiimotes[i]->state;
s.expansion = wiimotes[i]->exp; s.expansion = wiimotes[i]->exp;
callback( &s ); callback( &s );
evnt++;
break; break;
} }
} }
return 1;
} }
return 0; return evnt;
} }
/** /**

View File

@@ -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 * Alternative to calling wiiuse_poll yourself, and provides the same
* information struct on all platforms. * 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); WIIUSE_EXPORT extern int wiiuse_update(struct wiimote_t** wm, int wiimotes, wiiuse_update_cb callback);