updating the bug

This commit is contained in:
tTh 2024-09-10 12:01:00 +02:00
parent 3fc33f10ea
commit 19e3db36ed
1 changed files with 13 additions and 6 deletions

View File

@ -1,5 +1,8 @@
/*
* Strange Bug ?
*
* gcc -Wall strangebug.c -lSDL2 -o strangebug
*
*/
#include <stdio.h>
@ -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);