forked from Green-Sky/tomato
sdl (master post 3.1 preview) Merge commit 'e4f454091a943345938608570b104400f62fd625'
This commit is contained in:
29
external/sdl/SDL/test/testoverlay.c
vendored
29
external/sdl/SDL/test/testoverlay.c
vendored
@@ -16,17 +16,17 @@
|
||||
* *
|
||||
********************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_test.h>
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include "testutils.h"
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MOOSEPIC_W 64
|
||||
#define MOOSEPIC_H 88
|
||||
|
||||
@@ -282,10 +282,13 @@ static void loop(void)
|
||||
if (event.key.keysym.sym != SDLK_ESCAPE) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
#ifndef SDL_PLATFORM_EMSCRIPTEN
|
||||
SDL_Delay(fpsdelay);
|
||||
#endif
|
||||
|
||||
@@ -295,7 +298,7 @@ static void loop(void)
|
||||
}
|
||||
MoveSprites(state->renderers[i]);
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -316,7 +319,7 @@ static void loop(void)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
SDL_RWops *handle;
|
||||
SDL_IOStream *handle;
|
||||
int i;
|
||||
int j;
|
||||
int fps = 12;
|
||||
@@ -441,16 +444,16 @@ int main(int argc, char **argv)
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n");
|
||||
quit(2);
|
||||
}
|
||||
handle = SDL_RWFromFile(filename, "rb");
|
||||
handle = SDL_IOFromFile(filename, "rb");
|
||||
SDL_free(filename);
|
||||
if (!handle) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n");
|
||||
quit(2);
|
||||
}
|
||||
|
||||
SDL_RWread(handle, RawMooseData, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||
SDL_ReadIO(handle, RawMooseData, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||
|
||||
SDL_RWclose(handle);
|
||||
SDL_CloseIO(handle);
|
||||
|
||||
/* Create the window and renderer */
|
||||
window_w = MOOSEPIC_W * scale;
|
||||
@@ -529,7 +532,7 @@ int main(int argc, char **argv)
|
||||
done = 0;
|
||||
|
||||
/* Loop, waiting for QUIT or RESIZE */
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, nodelay ? 0 : fps, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
Reference in New Issue
Block a user