sdl (master post 3.1 preview) Merge commit 'e4f454091a943345938608570b104400f62fd625'
This commit is contained in:
24
external/sdl/SDL/test/testwm.c
vendored
24
external/sdl/SDL/test/testwm.c
vendored
@@ -10,14 +10,14 @@
|
||||
freely.
|
||||
*/
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_test_font.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
static SDLTest_CommonState *state;
|
||||
static int done;
|
||||
|
||||
@@ -154,7 +154,17 @@ static void loop(void)
|
||||
{
|
||||
int i;
|
||||
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)) {
|
||||
SDLTest_CommonEvent(state, &event, &done);
|
||||
|
||||
@@ -248,7 +258,7 @@ static void loop(void)
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -281,7 +291,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Main render loop */
|
||||
done = 0;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
Reference in New Issue
Block a user