[gnome-games/gnibbles-clutter] First succesful attemp to slow down timeline



commit d16e9d387daf3ca10e2a3c96ec193eaf4c297b42
Author: Guillaume Beland <guillaubel svn gnome org>
Date:   Thu Jun 18 15:44:13 2009 -0400

    First succesful attemp to slow down timeline
    
    Simply using a clever condition to limit the call to the :new-frame handler

 gnibbles/main.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gnibbles/main.c b/gnibbles/main.c
index 4ef729d..2654c43 100644
--- a/gnibbles/main.c
+++ b/gnibbles/main.c
@@ -1256,7 +1256,11 @@ render_logo (void)
 static void
 move_worm_cb (ClutterTimeline *timeline, gint msecs, gpointer data)
 {
-  if (msecs % 19 != 0)
+
+  const int elapsed_time = clutter_timeline_get_elapsed_time (timeline);
+  const int duration = clutter_timeline_get_duration (timeline);
+
+  if (!(elapsed_time == duration))
     return;
 
   gfloat w,h;
@@ -1314,6 +1318,7 @@ move_worm_cb (ClutterTimeline *timeline, gint msecs, gpointer data)
   }
 }
 
+
 int
 main (int argc, char **argv)
 {
@@ -1401,13 +1406,12 @@ main (int argc, char **argv)
     clutter_actor_raise_top (cworms[i]->actors);
   }
 
-  ClutterTimeline *timeline = clutter_timeline_new (20);
+  ClutterTimeline *timeline = clutter_timeline_new (150);
   clutter_timeline_set_loop (timeline, TRUE);
   cworms[2]->direction = WORMDOWN;
   gnibbles_cworm_add_straight_actor (cworms[2]);
-  
+ 
   g_signal_connect (timeline, "new-frame", G_CALLBACK (move_worm_cb), NULL);
-  //g_signal_connect (timeline, "new-frame", G_CALLBACK (gnibbles_cworm_move), cworms[3]);
 
   clutter_timeline_start (timeline);
   //render_logo_clutter (board);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]