#include <SDL2/SDL.h>
#include <cmath>

int main() {
    SDL_Init(SDL_INIT_VIDEO);
    SDL_Window* w = SDL_CreateWindow("Centric Circles", 0, 0, 640, 480, 0);
    SDL_Renderer* r = SDL_CreateRenderer(w, -1, 0);
    int cx = 640/2, cy = 480/2;
    bool running = true;
    int f = 0;
    while (running && f<360*5) {
        SDL_Event e;
        while(SDL_PollEvent(&e)) if(e.type==SDL_QUIT) running=false;
        SDL_SetRenderDrawColor(r,0,0,0,255);
        SDL_RenderClear(r);
        for(int i=0;i<40;i++){
            int rad = 10 + i*10 + int(5*sin(f*0.05 + i));
            for(int a=0;a<360;a+=2){
                int x = cx + int(rad*cos(a*M_PI/180.0));
                int y = cy + int(rad*sin(a*M_PI/180.0));
                SDL_SetRenderDrawColor(r,(i*20+f)%256,(i*30)%256,200,255);
                SDL_RenderDrawPoint(r,x,y);
            }
        }
        SDL_RenderPresent(r);
        SDL_Delay(16);
        f++;
    }
    SDL_DestroyRenderer(r);
    SDL_DestroyWindow(w);
    SDL_Quit();
    return 0;
}
