Fixed compile errors in example programs.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Thu, 25 Dec 2014 21:42:56 +0100
changeset 9290fe975b2313fa
parent 9289 5f857c00d25d
child 9291 02b47b8164da
Fixed compile errors in example programs.
test/testgamecontroller.c
test/testgesture.c
test/testmultiaudio.c
     1.1 --- a/test/testgamecontroller.c	Wed Dec 24 22:22:35 2014 -0500
     1.2 +++ b/test/testgamecontroller.c	Thu Dec 25 21:42:56 2014 +0100
     1.3 @@ -214,7 +214,7 @@
     1.4      emscripten_set_main_loop_arg(loop, gamecontroller, 0, 1);
     1.5  #else
     1.6      while (!done) {
     1.7 -        loop(gamecontroler);
     1.8 +        loop(gamecontroller);
     1.9      }
    1.10  #endif
    1.11  
     2.1 --- a/test/testgesture.c	Wed Dec 24 22:22:35 2014 -0500
     2.2 +++ b/test/testgesture.c	Thu Dec 25 21:42:56 2014 +0100
     2.3 @@ -269,6 +269,9 @@
     2.4  
     2.5  int main(int argc, char* argv[])
     2.6  {
     2.7 +  window = NULL;
     2.8 +  screen = NULL;
     2.9 +  quitting = SDL_FALSE;
    2.10  
    2.11    /* Enable standard application logging */
    2.12    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
    2.13 @@ -279,13 +282,8 @@
    2.14  
    2.15    if (SDL_Init(SDL_INIT_VIDEO) < 0 ) return 1;
    2.16  
    2.17 -  if (!(screen = initScreen(WIDTH,HEIGHT)))
    2.18 -  {
    2.19 -      SDL_Quit();
    2.20 -      return 1;
    2.21 -  }
    2.22 -
    2.23 -  if (!(window = initWindow(NULL,WIDTH,HEIGHT)))
    2.24 +  if (!(window = initWindow(window, WIDTH, HEIGHT)) ||
    2.25 +      !(screen = SDL_GetWindowSurface(window)))
    2.26    {
    2.27        SDL_Quit();
    2.28        return 1;
     3.1 --- a/test/testmultiaudio.c	Wed Dec 24 22:22:35 2014 -0500
     3.2 +++ b/test/testmultiaudio.c	Thu Dec 25 21:42:56 2014 +0100
     3.3 @@ -54,7 +54,9 @@
     3.4  loop()
     3.5  {
     3.6      if(cbd[0].done) {
     3.7 +#ifdef __EMSCRIPTEN__
     3.8          emscripten_cancel_main_loop();
     3.9 +#endif
    3.10          SDL_PauseAudioDevice(cbd[0].dev, 1);
    3.11          SDL_CloseAudioDevice(cbd[0].dev);
    3.12          SDL_FreeWAV(sound);
    3.13 @@ -145,6 +147,17 @@
    3.14  
    3.15          SDL_Delay(100);
    3.16      }
    3.17 +
    3.18 +#ifndef __EMSCRIPTEN__
    3.19 +    for (i = 0; i < devcount; i++) {
    3.20 +        if (cbd[i].dev) {
    3.21 +            SDL_PauseAudioDevice(cbd[i].dev, 1);
    3.22 +            SDL_CloseAudioDevice(cbd[i].dev);
    3.23 +        }
    3.24 +    }
    3.25 +
    3.26 +    SDL_Log("All done!\n");
    3.27 +#endif
    3.28  }
    3.29  
    3.30