
#include <iostream>

using namespace std;

#include <SDL/SDL.h>

#include "../lib/gfxMR.hpp"
#include "../lib/sdlMR.hpp"




/*
game of life
fewer than two neighboor die. cell = 0
two or three neighboor stay alive. cell = cell && 1
three neighboor born. cell = 1
four neighbook die. cell = 0
*/

int main(int argc, char * argv[])
{
    SDL_Surface *screen;
    SDL_Event event;

    int keypress = 0;
    int mx = 0,
        my = 0;
        
    SDL_Init(SDL_INIT_EVERYTHING);
    screen = SDL_SetVideoMode(512, 256, 8, SDL_SWSURFACE);

    sdlPutPixel plot(screen);
    sdlGetPixel get(screen);
    ploter * pp = &plot;
    bresenhamCircle cercle(plot);
    bresenhamLine ligne(plot);
    floodFill paint(plot,get);

    while(!keypress)
    {
        SDL_Flip(screen);
        SDL_FillRect(screen,0,0);
        while(SDL_PollEvent(&event))
        {
        	switch (event.type)
        	{
        		case SDL_QUIT:
        			keypress = 1;
        			break;
        		case SDL_KEYDOWN:
        			keypress = 1;
        			break;
        		case SDL_MOUSEMOTION:
        			mx = event.motion.x;
        			my = event.motion.y;
        			break;
        		case SDL_MOUSEBUTTONDOWN:
        			break;
        	}
        }
        
        cercle(mx, my, 3, 5);
    }

    SDL_Quit();
    return 0;
}
