Added missing loop cancel for Emscripten in test programs.

This commit is contained in:
Philipp Wiesemann 2015-05-18 21:21:14 +02:00
parent ac10a2f29d
commit 2c4ad51d44
18 changed files with 97 additions and 0 deletions

View file

@ -162,6 +162,11 @@ loop()
break;
}
}
#ifdef __EMSCRIPTEN__
if (done) {
emscripten_cancel_main_loop();
}
#endif
}
int

View file

@ -198,6 +198,11 @@ loop()
SDL_RenderPresent(renderer);
}
#ifdef __EMSCRIPTEN__
if (done) {
emscripten_cancel_main_loop();
}
#endif
}
int

View file

@ -62,11 +62,17 @@ loop()
while (SDL_PollEvent(&e)) {
if (e.type == SDL_QUIT) {
done = 1;
#ifdef __EMSCRIPTEN__
emscripten_cancel_main_loop();
#endif
return;
}
if(e.key.keysym.sym == SDLK_ESCAPE) {
done = 1;
#ifdef __EMSCRIPTEN__
emscripten_cancel_main_loop();
#endif
return;
}
}

View file

@ -153,6 +153,12 @@ loop(void *arg)
done = SDL_TRUE;
retval = SDL_TRUE; /* keep going, wait for reattach. */
}
#ifdef __EMSCRIPTEN__
if (done) {
emscripten_cancel_main_loop();
}
#endif
}
SDL_bool

View file

@ -266,6 +266,12 @@ void loop()
}
}
DrawScreen(screen, window);
#ifdef __EMSCRIPTEN__
if (quitting) {
emscripten_cancel_main_loop();
}
#endif
}
int main(int argc, char* argv[])

View file

@ -466,6 +466,11 @@ void loop()
SDL_GL_SwapWindow(state->windows[i]);
}
}
#ifdef __EMSCRIPTEN__
else {
emscripten_cancel_main_loop();
}
#endif
}
int

View file

@ -257,6 +257,11 @@ loop()
SDL_RenderPresent(renderer);
}
#ifdef __EMSCRIPTEN__
if (done) {
emscripten_cancel_main_loop();
}
#endif
}
int

View file

@ -175,6 +175,12 @@ loop(void *arg)
done = SDL_TRUE;
retval = SDL_TRUE; /* keep going, wait for reattach. */
}
#ifdef __EMSCRIPTEN__
if (done) {
emscripten_cancel_main_loop();
}
#endif
}
static SDL_bool

View file

@ -312,6 +312,12 @@ loop()
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, MooseTexture, NULL, &displayrect);
SDL_RenderPresent(renderer);
#ifdef __EMSCRIPTEN__
if (done) {
emscripten_cancel_main_loop();
}
#endif
}
int

View file

@ -67,6 +67,11 @@ loop(){
SDL_RenderPresent(renderer);
}
#ifdef __EMSCRIPTEN__
if (done) {
emscripten_cancel_main_loop();
}
#endif
}
int

View file

@ -152,6 +152,11 @@ void loop()
continue;
Draw(&drawstates[i]);
}
#ifdef __EMSCRIPTEN__
if (done) {
emscripten_cancel_main_loop();
}
#endif
}
int

View file

@ -241,6 +241,11 @@ loop()
if (!Draw(&drawstates[i])) done = 1;
}
}
#ifdef __EMSCRIPTEN__
if (done) {
emscripten_cancel_main_loop();
}
#endif
}
int

View file

@ -142,6 +142,11 @@ loop()
continue;
Draw(&drawstates[i]);
}
#ifdef __EMSCRIPTEN__
if (done) {
emscripten_cancel_main_loop();
}
#endif
}
int

View file

@ -251,6 +251,11 @@ loop()
continue;
MoveSprites(state->renderers[i], sprites[i]);
}
#ifdef __EMSCRIPTEN__
if (done) {
emscripten_cancel_main_loop();
}
#endif
}
int

View file

@ -136,6 +136,11 @@ void loop()
}
}
MoveSprites(renderer, sprite);
#ifdef __EMSCRIPTEN__
if (done) {
emscripten_cancel_main_loop();
}
#endif
}
int

View file

@ -115,6 +115,12 @@ loop()
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, MooseTexture, NULL, NULL);
SDL_RenderPresent(renderer);
#ifdef __EMSCRIPTEN__
if (done) {
emscripten_cancel_main_loop();
}
#endif
}
int

View file

@ -129,6 +129,12 @@ loop()
SDL_RenderPresent(state->renderers[i]);
}
}
#ifdef __EMSCRIPTEN__
if (done) {
emscripten_cancel_main_loop();
}
#endif
}
int

View file

@ -100,6 +100,11 @@ loop()
}
}
}
#ifdef __EMSCRIPTEN__
if (done) {
emscripten_cancel_main_loop();
}
#endif
}
int