Added test code to validate SDL_WaitEventTimeout()
You can enable this by defining TEST_WAITEVENTTIMEOUTmain
parent
d6ebbc2fa4
commit
5ddd97062e
|
@ -154,7 +154,17 @@ static void loop(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
/* Check for events */
|
|
||||||
|
#ifdef TEST_WAITEVENTTIMEOUT
|
||||||
|
/* Wait up to 20 ms for input, as a test */
|
||||||
|
Uint64 then = SDL_GetTicks();
|
||||||
|
if (SDL_WaitEventTimeout(NULL, 20)) {
|
||||||
|
SDL_Log("Got an event!\n");
|
||||||
|
}
|
||||||
|
Uint64 now = SDL_GetTicks();
|
||||||
|
SDL_Log("Waited %d ms for events\n", (int)(now - then));
|
||||||
|
#endif
|
||||||
|
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
SDLTest_CommonEvent(state, &event, &done);
|
SDLTest_CommonEvent(state, &event, &done);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue