From: Thadeu Lima de Souza Cascardo Date: Tue, 12 Aug 2008 19:20:21 +0000 (-0300) Subject: Stop for some seconds on every face X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fmovie.git;a=commitdiff_plain;h=9e7841742484998d5739b00d17e457ac798e0906 Stop for some seconds on every face 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. --- diff --git a/movie.c b/movie.c index 2b14232..4110fab 100644 --- 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 #include #include @@ -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