emscripten: fix warnings in tests

This commit is contained in:
Anonymous Maarten 2022-11-01 13:10:46 +01:00 committed by Anonymous Maarten
parent a71e558d85
commit d8884b845e
4 changed files with 10 additions and 3 deletions

View File

@ -70,12 +70,13 @@ open_audio()
SDL_PauseAudioDevice(device, SDL_FALSE); SDL_PauseAudioDevice(device, SDL_FALSE);
} }
#ifndef __EMSCRIPTEN__
static void reopen_audio() static void reopen_audio()
{ {
close_audio(); close_audio();
open_audio(); open_audio();
} }
#endif
void SDLCALL void SDLCALL
fillerup(void *unused, Uint8 * stream, int len) fillerup(void *unused, Uint8 * stream, int len)

View File

@ -472,6 +472,7 @@ render_window(int index)
++frames; ++frames;
} }
#ifndef __EMSCRIPTEN__
static int SDLCALL static int SDLCALL
render_thread_fn(void* render_ctx) render_thread_fn(void* render_ctx)
{ {
@ -512,6 +513,7 @@ loop_threaded()
SDLTest_CommonEvent(state, &event, &done); SDLTest_CommonEvent(state, &event, &done);
} }
} }
#endif
static void static void
loop() loop()

View File

@ -100,7 +100,9 @@ loop()
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
#ifndef __EMSCRIPTEN__
Uint32 then, now, frames; Uint32 then, now, frames;
#endif
/* Enable standard application logging */ /* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
@ -135,10 +137,12 @@ main(int argc, char *argv[])
srand((unsigned int)time(NULL)); srand((unsigned int)time(NULL));
#ifndef __EMSCRIPTEN__
/* Main render loop */ /* Main render loop */
frames = 0; frames = 0;
then = SDL_GetTicks(); then = SDL_GetTicks();
done = 0; done = 0;
#endif
SDL_Log("Rendering %u frames offscreen\n", max_frames); SDL_Log("Rendering %u frames offscreen\n", max_frames);

View File

@ -99,14 +99,14 @@ DrawOnViewport(SDL_Renderer * renderer)
void void
loop() loop()
{ {
SDL_Event event;
int i;
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
/* Avoid using delays */ /* Avoid using delays */
if(SDL_GetTicks() - wait_start < 1000) if(SDL_GetTicks() - wait_start < 1000)
return; return;
wait_start = SDL_GetTicks(); wait_start = SDL_GetTicks();
#endif #endif
SDL_Event event;
int i;
/* Check for events */ /* Check for events */
while (SDL_PollEvent(&event)) { while (SDL_PollEvent(&event)) {
SDLTest_CommonEvent(state, &event, &done); SDLTest_CommonEvent(state, &event, &done);