fclose (file);
}
-SDL_Rect *
+SDL_Rect
GetNextPoint (void)
{
static SDL_Rect rect = {0, 0, WIDTH, HEIGHT};
err -= ABS (thre);
y += (inc < 0) ? -1 : 1;
}
- return ▭
+ return rect;
}
void
-ShowPoint (SDL_Surface *screen, SDL_Surface *image, SDL_Rect *rect)
+ShowPoint (SDL_Surface *screen, SDL_Surface *image)
{
- SDL_BlitSurface (image, rect, screen, NULL);
+ SDL_BlitSurface (image, NULL, screen, NULL);
SDL_UpdateRect (screen, 0, 0, 0, 0);
}
+SDL_Surface *
+GetNextImage (SDL_Surface *image)
+{
+ SDL_Surface *slice;
+ SDL_Rect center;
+ center = GetNextPoint (), GetNextPoint (), GetNextPoint ();
+ slice = SDL_CreateRGBSurface (SDL_SWSURFACE, WIDTH, HEIGHT,
+ image->format->BitsPerPixel,
+ image->format->Rmask,
+ image->format->Gmask,
+ image->format->Bmask,
+ image->format->Amask);
+ center.x -= WIDTH/2;
+ center.y -= HEIGHT/2;
+ SDL_BlitSurface (image, ¢er, slice, NULL);
+ SDL_UpdateRect (slice, 0, 0, 0, 0);
+ return slice;
+}
+
Uint32
ShowNext (Uint32 interval, void *data)
{
{
SDL_Surface *screen;
SDL_Surface *image;
+ SDL_Surface *slice;
SDL_Event event;
ReadPoints ("pro-gnu");
SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER);
if (event.type == SDL_KEYDOWN)
break;
else if (event.type == SDL_USEREVENT)
- ShowPoint (screen, image, GetNextPoint ());
+ {
+ slice = GetNextImage (image);
+ ShowPoint (screen, slice);
+ SDL_FreeSurface (slice);
+ }
}
SDL_FreeSurface (image);
SDL_Quit ();