* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#define WIDTH 800
+#define HEIGHT 600
#include <SDL.h>
#include <SDL_image.h>
+SDL_Rect *
+GetNextPoint (void)
+{
+ static SDL_Rect rect = {0, 0, WIDTH, HEIGHT};
+ rect.x = (rect.x++) % WIDTH;
+ rect.y = (rect.y++) % HEIGHT;
+ return ▭
+}
+
+void
+ShowPoint (SDL_Surface *screen, SDL_Surface *image, SDL_Rect *rect)
+{
+ SDL_BlitSurface (image, rect, screen, NULL);
+ SDL_UpdateRect (screen, 0, 0, 0, 0);
+}
+
+Uint32
+ShowNext (Uint32 interval, void *data)
+{
+ SDL_UserEvent event;
+ event.type = SDL_USEREVENT;
+ event.code = 0;
+ SDL_PushEvent ((SDL_Event *) &event);
+ return 33;
+}
+
int
main (int argc, char **argv)
{
- SDL_Surface *image;
SDL_Surface *screen;
+ SDL_Surface *image;
SDL_Event event;
SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER);
screen = SDL_SetVideoMode (800, 600, 32, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN);
image = IMG_Load ("/home/cascardo/fotos/debconf.jpg");
- SDL_BlitSurface (image, NULL, screen, NULL);
- SDL_UpdateRect (screen, 0, 0, 0, 0);
+ SDL_AddTimer (0, ShowNext, NULL);
while (SDL_WaitEvent (&event))
{
if (event.type == SDL_KEYDOWN)
break;
+ else if (event.type == SDL_USEREVENT)
+ ShowPoint (screen, image, GetNextPoint ());
}
SDL_FreeSurface (image);
SDL_Quit ();