Added more tests for the different primitive types
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403806
This commit is contained in:
parent
1d966b1f67
commit
117273ed79
1 changed files with 41 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue