test/testrendertarget.c
changeset 7639 9406b7dd2f2d
parent 7517 965d57022c01
child 7781 3023b0270c94
     1.1 --- a/test/testrendertarget.c	Mon Aug 12 22:00:21 2013 -0700
     1.2 +++ b/test/testrendertarget.c	Wed Aug 14 23:30:10 2013 -0700
     1.3 @@ -46,7 +46,7 @@
     1.4      /* Load the sprite image */
     1.5      temp = SDL_LoadBMP(file);
     1.6      if (temp == NULL) {
     1.7 -        fprintf(stderr, "Couldn't load %s: %s", file, SDL_GetError());
     1.8 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
     1.9          return NULL;
    1.10      }
    1.11  
    1.12 @@ -77,7 +77,7 @@
    1.13      /* Create textures from the image */
    1.14      texture = SDL_CreateTextureFromSurface(renderer, temp);
    1.15      if (!texture) {
    1.16 -        fprintf(stderr, "Couldn't create texture: %s\n", SDL_GetError());
    1.17 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
    1.18          SDL_FreeSurface(temp);
    1.19          return NULL;
    1.20      }
    1.21 @@ -114,7 +114,7 @@
    1.22          SDL_RenderCopy(s->renderer, A, NULL, NULL);
    1.23          SDL_RenderReadPixels(s->renderer, NULL, SDL_PIXELFORMAT_ARGB8888, &P, sizeof(P));
    1.24  
    1.25 -        printf("Blended pixel: 0x%8.8X\n", P);
    1.26 +        SDL_Log("Blended pixel: 0x%8.8X\n", P);
    1.27  
    1.28          SDL_DestroyTexture(A);
    1.29          SDL_DestroyTexture(B);
    1.30 @@ -218,6 +218,9 @@
    1.31      Uint32 then, now;
    1.32      SDL_bool test_composite = SDL_FALSE;
    1.33  
    1.34 +    /* Enable standard application logging */
    1.35 +    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
    1.36 +
    1.37      /* Initialize test framework */
    1.38      state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
    1.39      if (!state) {
    1.40 @@ -235,8 +238,7 @@
    1.41              }
    1.42          }
    1.43          if (consumed < 0) {
    1.44 -            fprintf(stderr,
    1.45 -                    "Usage: %s %s [--composite]\n",
    1.46 +            SDL_Log("Usage: %s %s [--composite]\n",
    1.47                      argv[0], SDLTest_CommonUsage(state));
    1.48              quit(1);
    1.49          }
    1.50 @@ -289,7 +291,7 @@
    1.51      now = SDL_GetTicks();
    1.52      if (now > then) {
    1.53          double fps = ((double) frames * 1000) / (now - then);
    1.54 -        printf("%2.2f frames per second\n", fps);
    1.55 +        SDL_Log("%2.2f frames per second\n", fps);
    1.56      }
    1.57  
    1.58      SDL_stack_free(drawstates);