comparison test/testsprite2.c @ 3264:8fe0806637df

Fixed bug #783 Fixed coordinate positioning with OpenGL renderer, and added a test case
author Sam Lantinga <slouken@libsdl.org>
date Sat, 19 Sep 2009 05:12:26 +0000
parents 51750b7a966f
children 8f534bf37bef
comparison
equal deleted inserted replaced
3263:924b486541dc 3264:8fe0806637df
132 cycle_direction = -cycle_direction; 132 cycle_direction = -cycle_direction;
133 } 133 }
134 SDL_SetTextureAlphaMod(sprite, (Uint8) current_alpha); 134 SDL_SetTextureAlphaMod(sprite, (Uint8) current_alpha);
135 } 135 }
136 136
137 /* Draw a gray background */
138 SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
139 SDL_RenderFill(NULL);
140
141 /* Draw two red points to make sure they show up correctly */
142 SDL_SetRenderDrawColor(0xFF, 0x00, 0x00, 0xFF);
143 SDL_RenderPoint(0, 0);
144 SDL_RenderPoint(window_w-1, 0);
145 SDL_RenderPoint(0, window_h-1);
146 SDL_RenderPoint(window_w-1, window_h-1);
147
137 /* Move the sprite, bounce at the wall, and draw */ 148 /* Move the sprite, bounce at the wall, and draw */
138 n = 0; 149 n = 0;
139 SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
140 SDL_RenderFill(NULL);
141 for (i = 0; i < num_sprites; ++i) { 150 for (i = 0; i < num_sprites; ++i) {
142 position = &positions[i]; 151 position = &positions[i];
143 velocity = &velocities[i]; 152 velocity = &velocities[i];
144 position->x += velocity->x; 153 position->x += velocity->x;
145 if ((position->x < 0) || (position->x >= (window_w - sprite_w))) { 154 if ((position->x < 0) || (position->x >= (window_w - sprite_w))) {