Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Added more tests for the different primitive types

  • Loading branch information
slouken committed Sep 19, 2009
1 parent 0ee6f94 commit 30b43e4034f685c36970fa06a54d1ea0318729ba

File 1 of 1 in 30b43e4

@@ -100,6 +100,7 @@ MoveSprites(SDL_WindowID window, SDL_TextureID sprite)
{
int i, n;
int window_w, window_h;
SDL_Rect temp;
SDL_Rect *position, *velocity;

SDL_SelectRenderer(window);
@@ -138,13 +139,52 @@ MoveSprites(SDL_WindowID window, SDL_TextureID sprite)
SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
SDL_RenderFill(NULL);

/* Draw two red points to make sure they show up correctly */
/* Test points */
SDL_SetRenderDrawColor(0xFF, 0x00, 0x00, 0xFF);
SDL_RenderPoint(0, 0);
SDL_RenderPoint(window_w-1, 0);
SDL_RenderPoint(0, window_h-1);
SDL_RenderPoint(window_w-1, window_h-1);

/* Test horizontal and vertical lines */
SDL_SetRenderDrawColor(0x00, 0xFF, 0x00, 0xFF);
SDL_RenderLine(1, 0, window_w-2, 0);
SDL_RenderLine(1, window_h-1, window_w-2, window_h-1);
SDL_RenderLine(0, 1, 0, window_h-2);
SDL_RenderLine(window_w-1, 1, window_w-1, window_h-2);

/* Test fill */
SDL_SetRenderDrawColor(0xFF, 0xFF, 0xFF, 0xFF);
temp.x = window_w-sprite_w-1;
temp.y = 1;
temp.w = sprite_w;
temp.h = sprite_h;
SDL_RenderFill(&temp);
temp.x = 1;
temp.y = window_h-sprite_h-1;
temp.w = sprite_w;
temp.h = sprite_h;
SDL_RenderFill(&temp);

/* Test copy */
temp.x = 1;
temp.y = 1;
temp.w = sprite_w;
temp.h = sprite_h;
SDL_RenderCopy(sprite, NULL, &temp);
temp.x = window_w-sprite_w-1;
temp.y = window_h-sprite_h-1;
temp.w = sprite_w;
temp.h = sprite_h;
SDL_RenderCopy(sprite, NULL, &temp);

/* Test diagonal lines */
SDL_SetRenderDrawColor(0x00, 0xFF, 0x00, 0xFF);
SDL_RenderLine(sprite_w, sprite_h,
window_w-sprite_w-2, window_h-sprite_h-2);
SDL_RenderLine(window_w-sprite_w-2, sprite_h,
sprite_w, window_h-sprite_h-2);

/* Move the sprite, bounce at the wall, and draw */
n = 0;
for (i = 0; i < num_sprites; ++i) {

0 comments on commit 30b43e4

Please sign in to comment.