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



commit bee3b50e820f631e537385481db2f33c7570472f
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 |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/gnibbles/main.c b/gnibbles/main.c
index 28f5774..1a50e7e 100644
--- a/gnibbles/main.c
+++ b/gnibbles/main.c
@@ -1263,7 +1263,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;
@@ -1321,6 +1325,7 @@ move_worm_cb (ClutterTimeline *timeline, gint msecs, gpointer data)
   }
 }
 
+
 int
 main (int argc, char **argv)
 {
@@ -1410,13 +1415,13 @@ 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 (gnibbles_cworm_move), cworms[2]);
-  g_signal_connect (timeline, "new-frame", G_CALLBACK (gnibbles_cworm_move), cworms[3]);
+ 
+  g_signal_connect (timeline, "new-frame", G_CALLBACK (move_worm_cb), NULL);
+
   clutter_timeline_start (timeline);
   //render_logo_clutter (board);
 



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