Stop for some seconds on every face
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Tue, 12 Aug 2008 19:20:21 +0000 (16:20 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Tue, 12 Aug 2008 19:20:21 +0000 (16:20 -0300)
Stops for five seconds on every face. It also changes the number of
frames per second to 4. It seems the CPU can't do all the work for
30FPS, and that's why the keyboard never seemed to work. The queue got
filled up with "drawing" events very fast.

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