Fixed compile errors in example programs.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Thu, 25 Dec 2014 21:42:56 +0100
changeset 9290 fe975b2313fa
parent 9289 5f857c00d25d
child 9291 02b47b8164da
Fixed compile errors in example programs.
test/testgamecontroller.c
test/testgesture.c
test/testmultiaudio.c
--- a/test/testgamecontroller.c	Wed Dec 24 22:22:35 2014 -0500
+++ b/test/testgamecontroller.c	Thu Dec 25 21:42:56 2014 +0100
@@ -214,7 +214,7 @@
     emscripten_set_main_loop_arg(loop, gamecontroller, 0, 1);
 #else
     while (!done) {
-        loop(gamecontroler);
+        loop(gamecontroller);
     }
 #endif
 
--- a/test/testgesture.c	Wed Dec 24 22:22:35 2014 -0500
+++ b/test/testgesture.c	Thu Dec 25 21:42:56 2014 +0100
@@ -269,6 +269,9 @@
 
 int main(int argc, char* argv[])
 {
+  window = NULL;
+  screen = NULL;
+  quitting = SDL_FALSE;
 
   /* Enable standard application logging */
   SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
@@ -279,13 +282,8 @@
 
   if (SDL_Init(SDL_INIT_VIDEO) < 0 ) return 1;
 
-  if (!(screen = initScreen(WIDTH,HEIGHT)))
-  {
-      SDL_Quit();
-      return 1;
-  }
-
-  if (!(window = initWindow(NULL,WIDTH,HEIGHT)))
+  if (!(window = initWindow(window, WIDTH, HEIGHT)) ||
+      !(screen = SDL_GetWindowSurface(window)))
   {
       SDL_Quit();
       return 1;
--- a/test/testmultiaudio.c	Wed Dec 24 22:22:35 2014 -0500
+++ b/test/testmultiaudio.c	Thu Dec 25 21:42:56 2014 +0100
@@ -54,7 +54,9 @@
 loop()
 {
     if(cbd[0].done) {
+#ifdef __EMSCRIPTEN__
         emscripten_cancel_main_loop();
+#endif
         SDL_PauseAudioDevice(cbd[0].dev, 1);
         SDL_CloseAudioDevice(cbd[0].dev);
         SDL_FreeWAV(sound);
@@ -145,6 +147,17 @@
 
         SDL_Delay(100);
     }
+
+#ifndef __EMSCRIPTEN__
+    for (i = 0; i < devcount; i++) {
+        if (cbd[i].dev) {
+            SDL_PauseAudioDevice(cbd[i].dev, 1);
+            SDL_CloseAudioDevice(cbd[i].dev);
+        }
+    }
+
+    SDL_Log("All done!\n");
+#endif
 }