Stop for some seconds on every face
[cascardo/movie.git] / movie.c
diff --git a/movie.c b/movie.c
index 2b14232..4110fab 100644 (file)
--- a/movie.c
+++ b/movie.c
@@ -21,6 +21,9 @@
 #define HBORDER 32
 #define VBORDER 8
 
+#define STOP_INTERVAL (5*1000)
+#define FPS (4)
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <cairo.h>
@@ -41,6 +44,7 @@ TTF_Font *font;
 
 SDL_Rect *points;
 int psize;
+int stop = 0;
 
 void
 ReadPoints (char *filename)
@@ -78,6 +82,7 @@ GetNextPoint (void)
   next = (cur + 1) % psize;
   if ((points[next].x == rect.x && points[next].y == rect.y) || cur == -1)
   {
+    stop = 1;
     cur = next;
     next = (cur + 1) % psize;
     err = 0;
@@ -204,7 +209,12 @@ ShowNext (Uint32 interval, void *data)
   event.type = SDL_USEREVENT;
   event.code = 0;
   SDL_PushEvent ((SDL_Event *) &event);
-  return 33;
+  if (stop)
+  {
+    stop = 0;
+    return STOP_INTERVAL;
+  }
+  return 1000/FPS;
 }
 
 int