test/checkkeys.c
changeset 7639 9406b7dd2f2d
parent 7517 965d57022c01
child 8149 681eb46b8ac4
     1.1 --- a/test/checkkeys.c	Mon Aug 12 22:00:21 2013 -0700
     1.2 +++ b/test/checkkeys.c	Wed Aug 14 23:30:10 2013 -0700
     1.3 @@ -117,13 +117,13 @@
     1.4  static void
     1.5  PrintText(char *text)
     1.6  {
     1.7 -    unsigned char *spot, expanded[1024];
     1.8 +    char *spot, expanded[1024];
     1.9  
    1.10      expanded[0] = '\0';
    1.11      for ( spot = text; *spot; ++spot )
    1.12      {
    1.13          size_t length = SDL_strlen(expanded);
    1.14 -        SDL_snprintf(expanded + length, sizeof(expanded) - length, "\\x%.2x", *spot);
    1.15 +        SDL_snprintf(expanded + length, sizeof(expanded) - length, "\\x%.2x", (unsigned char)*spot);
    1.16      }
    1.17      SDL_Log("Text (%s): \"%s%s\"\n", expanded, *text == '"' ? "\\" : "", text);
    1.18  }
    1.19 @@ -134,10 +134,13 @@
    1.20      SDL_Window *window;
    1.21      SDL_Event event;
    1.22      int done;
    1.23 +	
    1.24 +	/* Enable standard application logging */
    1.25 +	SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
    1.26  
    1.27      /* Initialize SDL */
    1.28      if (SDL_Init(SDL_INIT_VIDEO) < 0) {
    1.29 -        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.30 +		SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.31          return (1);
    1.32      }
    1.33  
    1.34 @@ -146,7 +149,7 @@
    1.35                                SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
    1.36                                640, 480, 0);
    1.37      if (!window) {
    1.38 -        fprintf(stderr, "Couldn't create 640x480 window: %s\n",
    1.39 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create 640x480 window: %s\n",
    1.40                  SDL_GetError());
    1.41          quit(2);
    1.42      }
    1.43 @@ -166,7 +169,7 @@
    1.44          switch (event.type) {
    1.45          case SDL_KEYDOWN:
    1.46          case SDL_KEYUP:
    1.47 -            PrintKey(&event.key.keysym, event.key.state, event.key.repeat);
    1.48 +			PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE);
    1.49              break;
    1.50          case SDL_TEXTINPUT:
    1.51              PrintText(event.text.text);