Shows the name related to the face when stoping
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Tue, 12 Aug 2008 20:09:45 +0000 (17:09 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Tue, 12 Aug 2008 20:09:45 +0000 (17:09 -0300)
movie.c

diff --git a/movie.c b/movie.c
index 4af9eb2..71fb01d 100644 (file)
--- a/movie.c
+++ b/movie.c
@@ -46,6 +46,7 @@ TTF_Font *font;
 
 SDL_Rect *points;
 char **names;
+int cur = -1;
 int psize;
 int stop = 0;
 
@@ -83,7 +84,6 @@ SDL_Rect
 GetNextPoint (void)
 {
   static SDL_Rect rect = {0, 0, WIDTH, HEIGHT};
-  static int cur = -1;
   static int inc, err, thre, swap;
   static int x1, y1, x2, y2;
   static int x, y;
@@ -195,19 +195,22 @@ GetNextImage (SDL_Surface *image)
   SDL_UpdateRect (slice, 0, 0, 0, 0);
   scale = CairoTarget (slice);
   SDL_FreeSurface (slice);
-  text = TTF_RenderUTF8_Solid (font, "GNU", Yellow);
-  box.w = text->w + HBORDER;
-  box.h = text->h + VBORDER;
-  box.x = (WIDTH - text->w - HBORDER) / 2;
-  box.y = HEIGHT - (text->h + 32 + VBORDER/2);
-  SDL_FillRect (scale, &box, SDL_MapRGB (scale->format, 0, 0, 0));
-  box.x += HBORDER/2;
-  box.y += VBORDER/2;
-  box.w -= HBORDER;
-  box.h -= VBORDER;
-  SDL_BlitSurface (text, NULL, scale, &box);
+  if (stop)
+  {
+    text = TTF_RenderUTF8_Solid (font, names[cur], Yellow);
+    box.w = text->w + HBORDER;
+    box.h = text->h + VBORDER;
+    box.x = (WIDTH - text->w - HBORDER) / 2;
+    box.y = HEIGHT - (text->h + 32 + VBORDER/2);
+    SDL_FillRect (scale, &box, SDL_MapRGB (scale->format, 0, 0, 0));
+    box.x += HBORDER/2;
+    box.y += VBORDER/2;
+    box.w -= HBORDER;
+    box.h -= VBORDER;
+    SDL_BlitSurface (text, NULL, scale, &box);
+    SDL_FreeSurface (text);
+  }
   SDL_UpdateRect (scale, 0, 0, 0, 0);
-  SDL_FreeSurface (text);
   return scale;
 }