From 19e3db36ede7e02be3ab2b672951cf7990d6c602 Mon Sep 17 00:00:00 2001 From: tTh Date: Tue, 10 Sep 2024 12:01:00 +0200 Subject: [PATCH] updating the bug --- code/SDL2/strangebug.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/code/SDL2/strangebug.c b/code/SDL2/strangebug.c index 02ef810..5a6969e 100644 --- a/code/SDL2/strangebug.c +++ b/code/SDL2/strangebug.c @@ -1,5 +1,8 @@ /* * Strange Bug ? + * + * gcc -Wall strangebug.c -lSDL2 -o strangebug + * */ #include @@ -11,11 +14,14 @@ int main(int argc, char *argv[]) { SDL_Window *win; SDL_Renderer *rend; -int idx, idy; +int foo, idx, idy; -if(SDL_CreateWindowAndRenderer(256, 256, SDL_WINDOW_SHOWN, &win, &rend)) - { - fprintf(stderr, "Err SDL_CreateWindowAndRenderer : %s", SDL_GetError()); +foo = SDL_CreateWindowAndRenderer(256, 256, + SDL_WINDOW_SHOWN, &win, &rend); +if (foo) { + fprintf(stderr, + "Err %d CreateWindowAndRenderer : %s", + foo, SDL_GetError()); exit(1); } SDL_SetRenderDrawColor(rend, 255, 0, 0, 0); @@ -24,11 +30,12 @@ SDL_RenderPresent(rend); for (idx=0; idx<256; idx++) { 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_RenderPresent(rend); - // SDL_Delay(50); /* Is the bug here ? */ + // SDL_Delay(50); /* Is the bug here ? */ } SDL_RenderPresent(rend); sleep(30);