Added missing loop cancel for Emscripten in test programs.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Mon, 18 May 2015 21:21:14 +0200
changeset 9607 7746ab058d12
parent 9606 ec24a5add229
child 9608 17d2af576814
Added missing loop cancel for Emscripten in test programs.
test/checkkeys.c
test/testdraw2.c
test/testdrawchessboard.c
test/testgamecontroller.c
test/testgesture.c
test/testgles2.c
test/testintersections.c
test/testjoystick.c
test/testoverlay2.c
test/testrelative.c
test/testrendercopyex.c
test/testrendertarget.c
test/testscale.c
test/testsprite2.c
test/testspriteminimal.c
test/teststreaming.c
test/testviewport.c
test/testwm2.c
--- a/test/checkkeys.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/checkkeys.c	Mon May 18 21:21:14 2015 +0200
@@ -162,6 +162,11 @@
             break;
         }
     }
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 int
--- a/test/testdraw2.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testdraw2.c	Mon May 18 21:21:14 2015 +0200
@@ -198,6 +198,11 @@
 
         SDL_RenderPresent(renderer);
     }
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 int
--- a/test/testdrawchessboard.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testdrawchessboard.c	Mon May 18 21:21:14 2015 +0200
@@ -62,11 +62,17 @@
     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;
 		}
 	}
--- a/test/testgamecontroller.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testgamecontroller.c	Mon May 18 21:21:14 2015 +0200
@@ -153,6 +153,12 @@
         done = SDL_TRUE;
         retval = SDL_TRUE;  /* keep going, wait for reattach. */
     }
+
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 SDL_bool
--- a/test/testgesture.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testgesture.c	Mon May 18 21:21:14 2015 +0200
@@ -266,6 +266,12 @@
       }
     }
     DrawScreen(screen, window);
+
+#ifdef __EMSCRIPTEN__
+    if (quitting) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 int main(int argc, char* argv[])
--- a/test/testgles2.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testgles2.c	Mon May 18 21:21:14 2015 +0200
@@ -466,6 +466,11 @@
           SDL_GL_SwapWindow(state->windows[i]);
       }
     }
+#ifdef __EMSCRIPTEN__
+    else {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 int
--- a/test/testintersections.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testintersections.c	Mon May 18 21:21:14 2015 +0200
@@ -257,6 +257,11 @@
 
         SDL_RenderPresent(renderer);
     }
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 int
--- a/test/testjoystick.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testjoystick.c	Mon May 18 21:21:14 2015 +0200
@@ -175,6 +175,12 @@
             done = SDL_TRUE;
             retval = SDL_TRUE;  /* keep going, wait for reattach. */
         }
+
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 static SDL_bool
--- a/test/testoverlay2.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testoverlay2.c	Mon May 18 21:21:14 2015 +0200
@@ -312,6 +312,12 @@
     SDL_RenderClear(renderer);
     SDL_RenderCopy(renderer, MooseTexture, NULL, &displayrect);
     SDL_RenderPresent(renderer);
+
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 int
--- a/test/testrelative.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testrelative.c	Mon May 18 21:21:14 2015 +0200
@@ -67,6 +67,11 @@
 
         SDL_RenderPresent(renderer);
     }
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 int
--- a/test/testrendercopyex.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testrendercopyex.c	Mon May 18 21:21:14 2015 +0200
@@ -152,6 +152,11 @@
             continue;
         Draw(&drawstates[i]);
     }
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 int
--- a/test/testrendertarget.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testrendertarget.c	Mon May 18 21:21:14 2015 +0200
@@ -241,6 +241,11 @@
             if (!Draw(&drawstates[i])) done = 1;
         }
     }
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 int
--- a/test/testscale.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testscale.c	Mon May 18 21:21:14 2015 +0200
@@ -142,6 +142,11 @@
             continue;
         Draw(&drawstates[i]);
     }
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 int
--- a/test/testsprite2.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testsprite2.c	Mon May 18 21:21:14 2015 +0200
@@ -251,6 +251,11 @@
             continue;
         MoveSprites(state->renderers[i], sprites[i]);
     }
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 int
--- a/test/testspriteminimal.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testspriteminimal.c	Mon May 18 21:21:14 2015 +0200
@@ -136,6 +136,11 @@
         }
     }
     MoveSprites(renderer, sprite);
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 int
--- a/test/teststreaming.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/teststreaming.c	Mon May 18 21:21:14 2015 +0200
@@ -115,6 +115,12 @@
     SDL_RenderClear(renderer);
     SDL_RenderCopy(renderer, MooseTexture, NULL, NULL);
     SDL_RenderPresent(renderer);
+
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 int
--- a/test/testviewport.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testviewport.c	Mon May 18 21:21:14 2015 +0200
@@ -129,6 +129,12 @@
             SDL_RenderPresent(state->renderers[i]);
         }
     }
+
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 int
--- a/test/testwm2.c	Mon May 18 21:17:13 2015 +0200
+++ b/test/testwm2.c	Mon May 18 21:21:14 2015 +0200
@@ -100,6 +100,11 @@
                 }
             }
         }
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
 
 int