updating the bug

This commit is contained in:
tTh 2024-09-10 12:01:00 +02:00
parent 3fc33f10ea
commit 19e3db36ed

View File

@ -1,5 +1,8 @@
/* /*
* Strange Bug ? * Strange Bug ?
*
* gcc -Wall strangebug.c -lSDL2 -o strangebug
*
*/ */
#include <stdio.h> #include <stdio.h>
@ -11,11 +14,14 @@ int main(int argc, char *argv[])
{ {
SDL_Window *win; SDL_Window *win;
SDL_Renderer *rend; SDL_Renderer *rend;
int idx, idy; int foo, idx, idy;
if(SDL_CreateWindowAndRenderer(256, 256, SDL_WINDOW_SHOWN, &win, &rend)) foo = SDL_CreateWindowAndRenderer(256, 256,
{ SDL_WINDOW_SHOWN, &win, &rend);
fprintf(stderr, "Err SDL_CreateWindowAndRenderer : %s", SDL_GetError()); if (foo) {
fprintf(stderr,
"Err %d CreateWindowAndRenderer : %s",
foo, SDL_GetError());
exit(1); exit(1);
} }
SDL_SetRenderDrawColor(rend, 255, 0, 0, 0); SDL_SetRenderDrawColor(rend, 255, 0, 0, 0);
@ -24,11 +30,12 @@ SDL_RenderPresent(rend);
for (idx=0; idx<256; idx++) { for (idx=0; idx<256; idx++) {
for (idy=0; idy<256; idy++) { for (idy=0; idy<256; idy++) {
SDL_SetRenderDrawColor(rend, 127, idx, idy, 0); SDL_SetRenderDrawColor(rend,
127, idx, idy, 0);
SDL_RenderDrawPoint(rend, idx, idy); SDL_RenderDrawPoint(rend, idx, idy);
} }
SDL_RenderPresent(rend); SDL_RenderPresent(rend);
// SDL_Delay(50); /* Is the bug here ? */ // SDL_Delay(50); /* Is the bug here ? */
} }
SDL_RenderPresent(rend); SDL_RenderPresent(rend);
sleep(30); sleep(30);