forked from Green-Sky/tomato
sdl (master post 3.1 preview) Merge commit 'e4f454091a943345938608570b104400f62fd625'
This commit is contained in:
14
external/sdl/SDL/test/testrelative.c
vendored
14
external/sdl/SDL/test/testrelative.c
vendored
@@ -12,16 +12,16 @@
|
||||
|
||||
/* Simple program: Test relative mouse motion */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
static SDLTest_CommonState *state;
|
||||
static int i, done;
|
||||
static float mouseX, mouseY;
|
||||
@@ -47,6 +47,8 @@ static void loop(void)
|
||||
mouseX += event.motion.xrel;
|
||||
mouseY += event.motion.yrel;
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < state->num_windows; ++i) {
|
||||
@@ -77,7 +79,7 @@ static void loop(void)
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -124,7 +126,7 @@ int main(int argc, char *argv[])
|
||||
rect.h = 10;
|
||||
/* 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