TetaTricks/code/SDL2/strangebug.c
2024-09-07 15:36:26 +02:00

40 lines
793 B
C

/*
* Strange Bug ?
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <SDL2/SDL.h>
int main(int argc, char *argv[])
{
SDL_Window *win;
SDL_Renderer *rend;
int idx, idy;
if(SDL_CreateWindowAndRenderer(256, 256, SDL_WINDOW_SHOWN, &win, &rend))
{
fprintf(stderr, "Err SDL_CreateWindowAndRenderer : %s", SDL_GetError());
exit(1);
}
SDL_SetRenderDrawColor(rend, 255, 0, 0, 0);
SDL_RenderClear(rend);
SDL_RenderPresent(rend);
for (idx=0; idx<256; idx++) {
for (idy=0; idy<256; idy++) {
SDL_SetRenderDrawColor(rend, 127, idx, idy, 0);
SDL_RenderDrawPoint(rend, idx, idy);
}
SDL_RenderPresent(rend);
// SDL_Delay(50); /* Is the bug here ? */
}
SDL_RenderPresent(rend);
sleep(30);
SDL_DestroyRenderer(rend);
SDL_DestroyWindow(win);
return 0;
}