test/teststreaming.c
changeset 7639 9406b7dd2f2d
parent 7517 965d57022c01
child 8149 681eb46b8ac4
     1.1 --- a/test/teststreaming.c	Mon Aug 12 22:00:21 2013 -0700
     1.2 +++ b/test/teststreaming.c	Wed Aug 14 23:30:10 2013 -0700
     1.3 @@ -68,7 +68,7 @@
     1.4      int pitch;
     1.5  
     1.6      if (SDL_LockTexture(texture, NULL, &pixels, &pitch) < 0) {
     1.7 -        fprintf(stderr, "Couldn't lock texture: %s\n", SDL_GetError());
     1.8 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't lock texture: %s\n", SDL_GetError());
     1.9          quit(5);
    1.10      }
    1.11      src = MooseFrames[frame];
    1.12 @@ -93,15 +93,18 @@
    1.13      SDL_bool done = SDL_FALSE;
    1.14      int frame;
    1.15  
    1.16 +	/* Enable standard application logging */
    1.17 +    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
    1.18 +
    1.19      if (SDL_Init(SDL_INIT_VIDEO) < 0) {
    1.20 -        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.21 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.22          return 1;
    1.23      }
    1.24  
    1.25      /* load the moose images */
    1.26      handle = SDL_RWFromFile("moose.dat", "rb");
    1.27      if (handle == NULL) {
    1.28 -        fprintf(stderr, "Can't find the file moose.dat !\n");
    1.29 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n");
    1.30          quit(2);
    1.31      }
    1.32      SDL_RWread(handle, MooseFrames, MOOSEFRAME_SIZE, MOOSEFRAMES_COUNT);
    1.33 @@ -115,19 +118,19 @@
    1.34                                MOOSEPIC_W*4, MOOSEPIC_H*4,
    1.35                                SDL_WINDOW_RESIZABLE);
    1.36      if (!window) {
    1.37 -        fprintf(stderr, "Couldn't set create window: %s\n", SDL_GetError());
    1.38 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s\n", SDL_GetError());
    1.39          quit(3);
    1.40      }
    1.41  
    1.42      renderer = SDL_CreateRenderer(window, -1, 0);
    1.43      if (!renderer) {
    1.44 -        fprintf(stderr, "Couldn't set create renderer: %s\n", SDL_GetError());
    1.45 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError());
    1.46          quit(4);
    1.47      }
    1.48  
    1.49      MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H);
    1.50      if (!MooseTexture) {
    1.51 -        fprintf(stderr, "Couldn't set create texture: %s\n", SDL_GetError());
    1.52 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError());
    1.53          quit(5);
    1.54      }
    1.55