test/testime.c
changeset 7639 9406b7dd2f2d
parent 7517 965d57022c01
child 7663 53fe1b64eb2d
     1.1 --- a/test/testime.c	Mon Aug 12 22:00:21 2013 -0700
     1.2 +++ b/test/testime.c	Wed Aug 14 23:30:10 2013 -0700
     1.3 @@ -80,7 +80,7 @@
     1.4  
     1.5  void usage()
     1.6  {
     1.7 -    printf("usage: testime [--font fontfile]\n");
     1.8 +    SDL_Log("usage: testime [--font fontfile]\n");
     1.9      exit(0);
    1.10  }
    1.11  
    1.12 @@ -210,6 +210,9 @@
    1.13      SDL_Event event;
    1.14      const char *fontname = DEFAULT_FONT;
    1.15  
    1.16 +    /* Enable standard application logging */
    1.17 +    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
    1.18 +
    1.19      /* Initialize test framework */
    1.20      state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
    1.21      if (!state) {
    1.22 @@ -251,12 +254,12 @@
    1.23      font = TTF_OpenFont(fontname, DEFAULT_PTSIZE);
    1.24      if (! font)
    1.25      {
    1.26 -        fprintf(stderr, "Failed to find font: %s\n", TTF_GetError());
    1.27 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to find font: %s\n", TTF_GetError());
    1.28          exit(-1);
    1.29      }
    1.30  #endif
    1.31  
    1.32 -    printf("Using font: %s\n", fontname);
    1.33 +    SDL_Log("Using font: %s\n", fontname);
    1.34      atexit(SDL_Quit);
    1.35  
    1.36      InitInput();
    1.37 @@ -321,8 +324,7 @@
    1.38                          break;
    1.39                      }
    1.40  
    1.41 -                    fprintf(stderr,
    1.42 -                            "Keyboard: scancode 0x%08X = %s, keycode 0x%08X = %s\n",
    1.43 +                    SDL_Log("Keyboard: scancode 0x%08X = %s, keycode 0x%08X = %s\n",
    1.44                              event.key.keysym.scancode,
    1.45                              SDL_GetScancodeName(event.key.keysym.scancode),
    1.46                              event.key.keysym.sym, SDL_GetKeyName(event.key.keysym.sym));
    1.47 @@ -333,12 +335,12 @@
    1.48                          markedRect.w < 0)
    1.49                          break;
    1.50  
    1.51 -                    fprintf(stderr, "Keyboard: text input \"%s\"\n", event.text.text);
    1.52 +                    SDL_Log("Keyboard: text input \"%s\"\n", event.text.text);
    1.53  
    1.54                      if (SDL_strlen(text) + SDL_strlen(event.text.text) < sizeof(text))
    1.55                          SDL_strlcat(text, event.text.text, sizeof(text));
    1.56  
    1.57 -                    fprintf(stderr, "text inputed: %s\n", text);
    1.58 +                    SDL_Log("text inputed: %s\n", text);
    1.59  
    1.60                      // After text inputed, we can clear up markedText because it
    1.61                      // is committed
    1.62 @@ -347,7 +349,7 @@
    1.63                      break;
    1.64  
    1.65                  case SDL_TEXTEDITING:
    1.66 -                    fprintf(stderr, "text editing \"%s\", selected range (%d, %d)\n",
    1.67 +                    SDL_Log("text editing \"%s\", selected range (%d, %d)\n",
    1.68                              event.edit.text, event.edit.start, event.edit.length);
    1.69  
    1.70                      strcpy(markedText, event.edit.text);