-}
-
-void
-ShowPoint (SDL_Surface *screen, SDL_Surface *image, SDL_Rect center, double scale)
-{
- center.x = (center.x * scale) - WIDTH/2;
- center.y = (center.y * scale) - HEIGHT/2;
- center.w = WIDTH;
- center.h = HEIGHT;
- SDL_BlitSurface (image, ¢er, screen, NULL);
- SDL_UpdateRect (screen, 0, 0, 0, 0);
-}
-
-#define SCALE 2.0
-
-int
-main (int argc, char **argv)
-{
- SDL_Surface *screen;
- SDL_Surface *image;
- SDL_Surface *scaled_image;
- SDL_Rect rect;
- SDL_Event event;
- Uint32 last, now, deslast, start;
- int i, des, desl;
- ReadPoints ("pro-gnu");
- SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER);
- screen = SDL_SetVideoMode (800, 600, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
- image = IMG_Load ("/home/cascardo/fotos/debconf.jpg");
- scaled_image = CairoScale (image, SCALE);
- start = deslast = last = SDL_GetTicks ();
- desl = des = i = 0;
- while (1)
- {
- if (SDL_PollEvent (&event))
- {
- if (event.type == SDL_KEYDOWN)
- break;
- }
- now = SDL_GetTicks ();
- /* skip */
- while (now > last + FRAME_INTERVAL)
- {
- last += FRAME_INTERVAL;
- i++;
- }
- last = now;
- if (now > deslast + 1000)
- {
- printf ("%f %f %d\n", (double) des / (double) (now - start) * 1000, (double) (des - desl) / (double) (now - deslast) * 1000, i - des);
- desl = des;
- deslast = now;
- }
- if (i > points->len)
- {
- des -= i;
- i = 0;
- }
- rect = g_array_index (points, SDL_Rect, i);
- ShowPoint (screen, scaled_image, rect, SCALE);
- SDL_Delay (FRAME_INTERVAL - (now - last));
- i++;
- des++;
- }
- SDL_FreeSurface (image);
- SDL_Quit ();
- g_array_free (points, TRUE);
- for (i = 0; i < names->len; i++)
- free (g_ptr_array_index (names, i));
- g_ptr_array_free (names, TRUE);
- return 0;