test/testsprite2.c
changeset 3265 8f534bf37bef
parent 3264 8fe0806637df
child 3266 7856dfe3a44f
     1.1 --- a/test/testsprite2.c	Sat Sep 19 05:12:26 2009 +0000
     1.2 +++ b/test/testsprite2.c	Sat Sep 19 05:43:15 2009 +0000
     1.3 @@ -100,6 +100,7 @@
     1.4  {
     1.5      int i, n;
     1.6      int window_w, window_h;
     1.7 +    SDL_Rect temp;
     1.8      SDL_Rect *position, *velocity;
     1.9  
    1.10      SDL_SelectRenderer(window);
    1.11 @@ -138,13 +139,52 @@
    1.12      SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
    1.13      SDL_RenderFill(NULL);
    1.14  
    1.15 -    /* Draw two red points to make sure they show up correctly */
    1.16 +    /* Test points */
    1.17      SDL_SetRenderDrawColor(0xFF, 0x00, 0x00, 0xFF);
    1.18      SDL_RenderPoint(0, 0);
    1.19      SDL_RenderPoint(window_w-1, 0);
    1.20      SDL_RenderPoint(0, window_h-1);
    1.21      SDL_RenderPoint(window_w-1, window_h-1);
    1.22  
    1.23 +    /* Test horizontal and vertical lines */
    1.24 +    SDL_SetRenderDrawColor(0x00, 0xFF, 0x00, 0xFF);
    1.25 +    SDL_RenderLine(1, 0, window_w-2, 0);
    1.26 +    SDL_RenderLine(1, window_h-1, window_w-2, window_h-1);
    1.27 +    SDL_RenderLine(0, 1, 0, window_h-2);
    1.28 +    SDL_RenderLine(window_w-1, 1, window_w-1, window_h-2);
    1.29 +
    1.30 +    /* Test fill */
    1.31 +    SDL_SetRenderDrawColor(0xFF, 0xFF, 0xFF, 0xFF);
    1.32 +    temp.x = window_w-sprite_w-1;
    1.33 +    temp.y = 1;
    1.34 +    temp.w = sprite_w;
    1.35 +    temp.h = sprite_h;
    1.36 +    SDL_RenderFill(&temp);
    1.37 +    temp.x = 1;
    1.38 +    temp.y = window_h-sprite_h-1;
    1.39 +    temp.w = sprite_w;
    1.40 +    temp.h = sprite_h;
    1.41 +    SDL_RenderFill(&temp);
    1.42 +
    1.43 +    /* Test copy */
    1.44 +    temp.x = 1;
    1.45 +    temp.y = 1;
    1.46 +    temp.w = sprite_w;
    1.47 +    temp.h = sprite_h;
    1.48 +    SDL_RenderCopy(sprite, NULL, &temp);
    1.49 +    temp.x = window_w-sprite_w-1;
    1.50 +    temp.y = window_h-sprite_h-1;
    1.51 +    temp.w = sprite_w;
    1.52 +    temp.h = sprite_h;
    1.53 +    SDL_RenderCopy(sprite, NULL, &temp);
    1.54 +
    1.55 +    /* Test diagonal lines */
    1.56 +    SDL_SetRenderDrawColor(0x00, 0xFF, 0x00, 0xFF);
    1.57 +    SDL_RenderLine(sprite_w, sprite_h,
    1.58 +                   window_w-sprite_w-2, window_h-sprite_h-2);
    1.59 +    SDL_RenderLine(window_w-sprite_w-2, sprite_h,
    1.60 +                   sprite_w, window_h-sprite_h-2);
    1.61 +
    1.62      /* Move the sprite, bounce at the wall, and draw */
    1.63      n = 0;
    1.64      for (i = 0; i < num_sprites; ++i) {