#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "SDL.h"

int main(void)
{
  SDL_Init(SDL_INIT_EVERYTHING);
  SDL_Surface* screen = SDL_SetVideoMode(640,480, 0, SDL_DOUBLEBUF);

  Uint32 start = SDL_GetTicks();
  int nb_frames = 1000;
  int i = 0;
  for (; i < nb_frames; i++)
    {
      SDL_Rect r = {10,10,40,60};
      r.x = (int) round(1.0 * (screen->w-1) * rand() / RAND_MAX);
      r.y = (int) round(1.0 * (screen->h-1) * rand() / RAND_MAX);
      SDL_FillRect(screen, &r, SDL_MapRGB(screen->format, 0,0,255));
      SDL_Flip(screen);
    }
  printf("%g\n", 1000.0 * nb_frames / (SDL_GetTicks() - start));
  SDL_Quit();
}

/**
 * Local Variables:
 * compile-command: "gcc -ggdb $(sdl-config --cflags --libs) base_fps.c -o base_fps -lm"
 * End:
 */
