Added missing loop cancel for Emscripten in test programs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
diff --git a/test/checkkeys.c b/test/checkkeys.c
index 234b627..0591928 100644
--- a/test/checkkeys.c
+++ b/test/checkkeys.c
@@ -162,6 +162,11 @@ loop()
break;
}
}
+#ifdef __EMSCRIPTEN__
+ if (done) {
+ emscripten_cancel_main_loop();
+ }
+#endif
}
int
diff --git a/test/testdraw2.c b/test/testdraw2.c
index 7685e3b..b0f706a 100644
--- a/test/testdraw2.c
+++ b/test/testdraw2.c
@@ -198,6 +198,11 @@ loop()
SDL_RenderPresent(renderer);
}
+#ifdef __EMSCRIPTEN__
+ if (done) {
+ emscripten_cancel_main_loop();
+ }
+#endif
}
int
diff --git a/test/testdrawchessboard.c b/test/testdrawchessboard.c
index 35cc688..ef89c2d 100644
--- a/test/testdrawchessboard.c
+++ b/test/testdrawchessboard.c
@@ -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;
}
}
diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c
index 414872c..2eb3686 100644
--- a/test/testgamecontroller.c
+++ b/test/testgamecontroller.c
@@ -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
diff --git a/test/testgesture.c b/test/testgesture.c
index 6189f45..8982e15 100644
--- a/test/testgesture.c
+++ b/test/testgesture.c
@@ -266,6 +266,12 @@ void loop()
}
}
DrawScreen(screen, window);
+
+#ifdef __EMSCRIPTEN__
+ if (quitting) {
+ emscripten_cancel_main_loop();
+ }
+#endif
}
int main(int argc, char* argv[])
diff --git a/test/testgles2.c b/test/testgles2.c
index 55f06cb..af02c1f 100644
--- a/test/testgles2.c
+++ b/test/testgles2.c
@@ -466,6 +466,11 @@ void loop()
SDL_GL_SwapWindow(state->windows[i]);
}
}
+#ifdef __EMSCRIPTEN__
+ else {
+ emscripten_cancel_main_loop();
+ }
+#endif
}
int
diff --git a/test/testintersections.c b/test/testintersections.c
index 77bb514..f470538 100644
--- a/test/testintersections.c
+++ b/test/testintersections.c
@@ -257,6 +257,11 @@ loop()
SDL_RenderPresent(renderer);
}
+#ifdef __EMSCRIPTEN__
+ if (done) {
+ emscripten_cancel_main_loop();
+ }
+#endif
}
int
diff --git a/test/testjoystick.c b/test/testjoystick.c
index adb376e..b35a5e1 100644
--- a/test/testjoystick.c
+++ b/test/testjoystick.c
@@ -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
diff --git a/test/testoverlay2.c b/test/testoverlay2.c
index 69238fa..4a8b51b 100644
--- a/test/testoverlay2.c
+++ b/test/testoverlay2.c
@@ -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
diff --git a/test/testrelative.c b/test/testrelative.c
index 3b6ef81..68ec24c 100644
--- a/test/testrelative.c
+++ b/test/testrelative.c
@@ -67,6 +67,11 @@ loop(){
SDL_RenderPresent(renderer);
}
+#ifdef __EMSCRIPTEN__
+ if (done) {
+ emscripten_cancel_main_loop();
+ }
+#endif
}
int
diff --git a/test/testrendercopyex.c b/test/testrendercopyex.c
index 379819c..0cfa9ba 100644
--- a/test/testrendercopyex.c
+++ b/test/testrendercopyex.c
@@ -152,6 +152,11 @@ void loop()
continue;
Draw(&drawstates[i]);
}
+#ifdef __EMSCRIPTEN__
+ if (done) {
+ emscripten_cancel_main_loop();
+ }
+#endif
}
int
diff --git a/test/testrendertarget.c b/test/testrendertarget.c
index c03e639..0471ec2 100644
--- a/test/testrendertarget.c
+++ b/test/testrendertarget.c
@@ -241,6 +241,11 @@ loop()
if (!Draw(&drawstates[i])) done = 1;
}
}
+#ifdef __EMSCRIPTEN__
+ if (done) {
+ emscripten_cancel_main_loop();
+ }
+#endif
}
int
diff --git a/test/testscale.c b/test/testscale.c
index e52eacb..124138e 100644
--- a/test/testscale.c
+++ b/test/testscale.c
@@ -142,6 +142,11 @@ loop()
continue;
Draw(&drawstates[i]);
}
+#ifdef __EMSCRIPTEN__
+ if (done) {
+ emscripten_cancel_main_loop();
+ }
+#endif
}
int
diff --git a/test/testsprite2.c b/test/testsprite2.c
index 17a9cd5..d02acda 100644
--- a/test/testsprite2.c
+++ b/test/testsprite2.c
@@ -251,6 +251,11 @@ loop()
continue;
MoveSprites(state->renderers[i], sprites[i]);
}
+#ifdef __EMSCRIPTEN__
+ if (done) {
+ emscripten_cancel_main_loop();
+ }
+#endif
}
int
diff --git a/test/testspriteminimal.c b/test/testspriteminimal.c
index fc7d31f..82bee9c 100644
--- a/test/testspriteminimal.c
+++ b/test/testspriteminimal.c
@@ -136,6 +136,11 @@ void loop()
}
}
MoveSprites(renderer, sprite);
+#ifdef __EMSCRIPTEN__
+ if (done) {
+ emscripten_cancel_main_loop();
+ }
+#endif
}
int
diff --git a/test/teststreaming.c b/test/teststreaming.c
index da618c4..9b2888b 100644
--- a/test/teststreaming.c
+++ b/test/teststreaming.c
@@ -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
diff --git a/test/testviewport.c b/test/testviewport.c
index 2ac8031..385bbbd 100644
--- a/test/testviewport.c
+++ b/test/testviewport.c
@@ -129,6 +129,12 @@ loop()
SDL_RenderPresent(state->renderers[i]);
}
}
+
+#ifdef __EMSCRIPTEN__
+ if (done) {
+ emscripten_cancel_main_loop();
+ }
+#endif
}
int
diff --git a/test/testwm2.c b/test/testwm2.c
index 8d8ff46..02a0ce2 100644
--- a/test/testwm2.c
+++ b/test/testwm2.c
@@ -100,6 +100,11 @@ loop()
}
}
}
+#ifdef __EMSCRIPTEN__
+ if (done) {
+ emscripten_cancel_main_loop();
+ }
+#endif
}
int