#include "src/maze.h"
#include <iostream>
#include <cstdlib>

void wait_key(void)
{
  SDL_Event event;
 
  do
    SDL_WaitEvent(&event);
  while (event.type != SDL_QUIT && event.type != SDL_KEYDOWN);
}


int main(int argc, char **argv)
{
  if(argc != 4)
  {
    std::cerr << "Usage: ./maze <width> <height> <size>\n";
    std::cerr << " Exemple: ./maze 10 10 30\n";
    return -1;
  }
  Maze maze(atoi(argv[1]),atoi(argv[2]), atoi(argv[3]));
  int width;
  int height;
  maze.getApproximativeSizeForImage(width, height);
  SDL_Surface *image = create_image(width, height);
  white_image(image);
  SDL_Surface *display = init_display(image, std::string("Maze"));
  update_display(image, display);

  maze.constructMaze();
  maze.display(image);


  update_display(image, display);
  wait_key();

  return 0;
}
