test: fix shadowing variables

This commit is contained in:
Christian Rauch 2021-03-26 22:52:30 +00:00 committed by Sam Lantinga
parent b972258d56
commit 570768f627
7 changed files with 18 additions and 19 deletions

View File

@ -29,7 +29,7 @@ SDL_Surface *surface;
int done; int done;
void void
DrawChessBoard(SDL_Renderer * renderer) DrawChessBoard()
{ {
int row = 0,column = 0,x = 0; int row = 0,column = 0,x = 0;
SDL_Rect rect, darea; SDL_Rect rect, darea;
@ -90,7 +90,7 @@ loop()
} }
} }
DrawChessBoard(renderer); DrawChessBoard();
/* Got everything on rendering surface, /* Got everything on rendering surface,
now Update the drawing image on window screen */ now Update the drawing image on window screen */

View File

@ -33,20 +33,20 @@ callback_data cbd[64];
void SDLCALL void SDLCALL
play_through_once(void *arg, Uint8 * stream, int len) play_through_once(void *arg, Uint8 * stream, int len)
{ {
callback_data *cbd = (callback_data *) arg; callback_data *cbdata = (callback_data *) arg;
Uint8 *waveptr = sound + cbd->soundpos; Uint8 *waveptr = sound + cbdata->soundpos;
int waveleft = soundlen - cbd->soundpos; int waveleft = soundlen - cbdata->soundpos;
int cpy = len; int cpy = len;
if (cpy > waveleft) if (cpy > waveleft)
cpy = waveleft; cpy = waveleft;
SDL_memcpy(stream, waveptr, cpy); SDL_memcpy(stream, waveptr, cpy);
len -= cpy; len -= cpy;
cbd->soundpos += cpy; cbdata->soundpos += cpy;
if (len > 0) { if (len > 0) {
stream += cpy; stream += cpy;
SDL_memset(stream, spec.silence, len); SDL_memset(stream, spec.silence, len);
SDL_AtomicSet(&cbd->done, 1); SDL_AtomicSet(&cbdata->done, 1);
} }
} }

View File

@ -144,7 +144,6 @@ SDL_Texture *MooseTexture;
SDL_Rect displayrect; SDL_Rect displayrect;
int window_w; int window_w;
int window_h; int window_h;
SDL_Window *window;
SDL_Renderer *renderer; SDL_Renderer *renderer;
int paused = 0; int paused = 0;
int i; int i;

View File

@ -28,10 +28,10 @@ SDL_Rect rect;
SDL_Event event; SDL_Event event;
static void static void
DrawRects(SDL_Renderer * renderer, SDL_Rect * rect) DrawRects(SDL_Renderer * renderer)
{ {
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
SDL_RenderFillRect(renderer, rect); SDL_RenderFillRect(renderer, &rect);
} }
static void static void
@ -63,7 +63,7 @@ loop(){
if (rect.x > viewport.x + viewport.w) rect.x -= viewport.w; if (rect.x > viewport.x + viewport.w) rect.x -= viewport.w;
if (rect.y > viewport.y + viewport.h) rect.y -= viewport.h; if (rect.y > viewport.y + viewport.h) rect.y -= viewport.h;
DrawRects(renderer, &rect); DrawRects(renderer);
SDL_RenderPresent(renderer); SDL_RenderPresent(renderer);
} }

View File

@ -43,7 +43,7 @@ quit(int rc)
} }
int int
LoadSprite(char *file, SDL_Renderer *renderer) LoadSprite(char *file)
{ {
SDL_Surface *temp; SDL_Surface *temp;
@ -92,7 +92,7 @@ LoadSprite(char *file, SDL_Renderer *renderer)
} }
void void
MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite) MoveSprites()
{ {
int i; int i;
int window_w = WINDOW_WIDTH; int window_w = WINDOW_WIDTH;
@ -136,7 +136,7 @@ void loop()
done = 1; done = 1;
} }
} }
MoveSprites(renderer, sprite); MoveSprites();
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
if (done) { if (done) {
emscripten_cancel_main_loop(); emscripten_cancel_main_loop();
@ -158,7 +158,7 @@ main(int argc, char *argv[])
quit(2); quit(2);
} }
if (LoadSprite("icon.bmp", renderer) < 0) { if (LoadSprite("icon.bmp") < 0) {
quit(2); quit(2);
} }

View File

@ -67,7 +67,7 @@ void quit(int rc)
exit(rc); exit(rc);
} }
void UpdateTexture(SDL_Texture *texture, int frame) void UpdateTexture(SDL_Texture *texture)
{ {
SDL_Color *color; SDL_Color *color;
Uint8 *src; Uint8 *src;
@ -110,7 +110,7 @@ loop()
} }
frame = (frame + 1) % MOOSEFRAMES_COUNT; frame = (frame + 1) % MOOSEFRAMES_COUNT;
UpdateTexture(MooseTexture, frame); UpdateTexture(MooseTexture);
SDL_RenderClear(renderer); SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, MooseTexture, NULL, NULL); SDL_RenderCopy(renderer, MooseTexture, NULL, NULL);

View File

@ -92,7 +92,7 @@ LoadSprite(char *file, SDL_Renderer *renderer)
} }
void void
DrawOnViewport(SDL_Renderer * renderer, SDL_Rect viewport) DrawOnViewport(SDL_Renderer * renderer)
{ {
SDL_Rect rect; SDL_Rect rect;
@ -174,7 +174,7 @@ loop()
continue; continue;
/* Draw using viewport */ /* Draw using viewport */
DrawOnViewport(state->renderers[i], viewport); DrawOnViewport(state->renderers[i]);
/* Update the screen! */ /* Update the screen! */
if (use_target) { if (use_target) {