[gnome-nibbles] Removed a few instances of clutter_actor_animate and modified configure so it checks for the needed



commit 72f2888d75849bc7b76fc9d39f0619d6ffc1022c
Author: Bryan Quigley <bryanquigs src gnome org>
Date:   Mon Jul 22 00:02:49 2013 -0400

    Removed a few instances of clutter_actor_animate and modified
    configure so it checks for the needed version of clutter

 configure.ac |    6 +++---
 src/board.c  |   15 +++++++++------
 src/bonus.c  |    2 +-
 src/main.c   |   51 +++++++++++++++++++++++++++------------------------
 src/worm.c   |   33 ++++++++++++++++++++-------------
 5 files changed, 60 insertions(+), 47 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5f17a5b..3dd4b5c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,15 +60,15 @@ dnl ###########################################################################
 GTK_REQUIRED=3.4.0
 RSVG_REQUIRED=2.32.0
 CANBERRA_GTK_REQUIRED=0.26
-CLUTTER_REQUIRED=1.0.0
-CLUTTER_GTK_REQUIRED=0.91.6
+CLUTTER_REQUIRED=1.14.4
+CLUTTER_GTK_REQUIRED=1.2.0
 
 PKG_CHECK_MODULES(GNOME_NIBBLES, [
   gtk+-3.0 >= $GTK_REQUIRED
   librsvg-2.0 >= $RSVG_REQUIRED
   libcanberra-gtk3 >= $CANBERRA_GTK_REQUIRED
   clutter-1.0 >= $CLUTTER_REQUIRED
-  clutter-gtk-1.0 >= $CLUTTER_REQUIRED
+  clutter-gtk-1.0 >= $CLUTTER_GTK_REQUIRED
 ])
 
 dnl ###########################################################################
diff --git a/src/board.c b/src/board.c
index 0de97e3..d0e6a6f 100644
--- a/src/board.c
+++ b/src/board.c
@@ -184,12 +184,15 @@ gnibbles_board_load_level (GnibblesBoard *board)
 
   clutter_actor_set_opacity (board->level, 0);
   clutter_actor_set_scale (CLUTTER_ACTOR (board->level), 0.2, 0.2);
-  clutter_actor_animate (board->level, CLUTTER_EASE_OUT_BOUNCE, 1210,
-                         "opacity", 0xff,
-                         "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
-                         "scale-x", 1.0,
-                         "scale-y", 1.0,
-                         NULL);
+ 
+  clutter_actor_save_easing_state(board->level);
+  clutter_actor_set_easing_mode (board->level, CLUTTER_EASE_OUT_BOUNCE);
+  clutter_actor_set_easing_duration (board->level, 1210);
+  clutter_actor_set_scale (board->level, 1.0, 1.0);
+  clutter_actor_set_pivot_point (board->level,.5,.5);
+  clutter_actor_set_opacity (board->level, 0xff);
+  clutter_actor_restore_easing_state(board->level);
+
 }
 
 void
diff --git a/src/bonus.c b/src/bonus.c
index 2e4b26d..8c54425 100644
--- a/src/bonus.c
+++ b/src/bonus.c
@@ -98,7 +98,7 @@ gnibbles_bonus_draw (GnibblesBonus *bonus)
   if (err)
     gnibbles_error (err->message);
 
-  clutter_container_add_actor (CLUTTER_CONTAINER (stage), bonus->actor);
+  clutter_actor_add_child (stage, bonus->actor);
 
   clutter_actor_set_opacity (bonus->actor, 0);
   clutter_actor_set_scale (bonus->actor, 3.0, 3.0);
diff --git a/src/main.c b/src/main.c
index 8555e9e..9c7f7b6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -413,38 +413,41 @@ animate_end_game (void)
 {
   int i;
   for (i = 0; i < properties->numworms; i++) {
-    clutter_actor_animate (worms[i]->actors, CLUTTER_EASE_IN_QUAD, 500,
-                           "opacity", 0,
-                           "scale-x", 0.4, "scale-y", 0.4,
-                           "fixed::scale-center-x",
-                           (gfloat) worms[i]->xhead * properties->tilesize,
-                           "fixed::scale-center-y",
-                           (gfloat) worms[i]->yhead * properties->tilesize,
-                           NULL);
+    clutter_actor_save_easing_state(worms[i]->actors);
+    clutter_actor_set_easing_mode (worms[i]->actors, CLUTTER_EASE_IN_QUAD);
+    clutter_actor_set_easing_duration (worms[i]->actors, 500);
+    clutter_actor_set_scale (worms[i]->actors, 0.4, 0.4);
+    clutter_actor_set_opacity (worms[i]->actors, 0);
+    clutter_actor_restore_easing_state(worms[i]->actors);
   }
 
   for ( i = 0; i < boni->numbonuses; i++) {
-    clutter_actor_animate (boni->bonuses[i]->actor, CLUTTER_EASE_IN_QUAD, 500,
-                           "opacity", 0,
-                           "scale-x", 0.4, "scale-y", 0.4,
-                           "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
-                           NULL);
+    clutter_actor_save_easing_state(boni->bonuses[i]->actor);
+    clutter_actor_set_easing_mode (boni->bonuses[i]->actor, CLUTTER_EASE_IN_QUAD);
+    clutter_actor_set_easing_duration (boni->bonuses[i]->actor, 500);
+    clutter_actor_set_scale (boni->bonuses[i]->actor, 0.4, 0.4);
+    clutter_actor_set_pivot_point (boni->bonuses[i]->actor,.5,.5);
+    clutter_actor_set_opacity (boni->bonuses[i]->actor, 0);
+    clutter_actor_restore_easing_state(boni->bonuses[i]->actor);
   }
 
   for ( i = 0; i < warpmanager->numwarps; i++) {
-    clutter_actor_animate (warpmanager->warps[i]->actor, CLUTTER_EASE_IN_QUAD, 500,
-                           "opacity", 0,
-                           "scale-x", 0.4, "scale-y", 0.4,
-                           "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
-                           NULL);
+    clutter_actor_save_easing_state(warpmanager->warps[i]->actor);
+    clutter_actor_set_easing_mode (warpmanager->warps[i]->actor, CLUTTER_EASE_IN_QUAD);
+    clutter_actor_set_easing_duration (warpmanager->warps[i]->actor, 500);
+    clutter_actor_set_scale (warpmanager->warps[i]->actor, 0.4, 0.4);
+    clutter_actor_set_pivot_point (warpmanager->warps[i]->actor,.5,.5);
+    clutter_actor_set_opacity (warpmanager->warps[i]->actor, 0);
+    clutter_actor_restore_easing_state(warpmanager->warps[i]->actor);
   }
 
-
-  clutter_actor_animate (board->level, CLUTTER_EASE_IN_QUAD, 700,
-                           "scale-x", 0.4, "scale-y", 0.4,
-                           "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
-                           "opacity", 0,
-                           NULL);
+  clutter_actor_save_easing_state(board->level);
+  clutter_actor_set_easing_mode (board->level, CLUTTER_EASE_IN_QUAD);
+  clutter_actor_set_easing_duration (board->level, 700);
+  clutter_actor_set_scale (board->level, 0.4, 0.4);
+  clutter_actor_set_pivot_point (board->level,.5,.5);
+  clutter_actor_set_opacity (board->level, 0);
+  clutter_actor_restore_easing_state(board->level);
 }
 
 gboolean
diff --git a/src/worm.c b/src/worm.c
index fa4f4d3..21ad3ec 100644
--- a/src/worm.c
+++ b/src/worm.c
@@ -337,10 +337,12 @@ gnibbles_worm_grok_bonus (GnibblesWorm *worm)
 static void
 worm_grok_scale_down (ClutterAnimation *animation, ClutterActor *actor)
 {
-  clutter_actor_animate (actor, CLUTTER_EASE_OUT_QUINT, 420,
-                         "scale-x", 1.0, "scale-y", 1.0,
-                         "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
-                         NULL);
+  clutter_actor_save_easing_state(actor);
+  clutter_actor_set_easing_mode (actor, CLUTTER_EASE_OUT_QUINT);
+  clutter_actor_set_easing_duration (actor, 420);
+  clutter_actor_set_scale (actor, 1.0, 1.0);
+  clutter_actor_set_pivot_point (actor,.5,.5);
+  clutter_actor_restore_easing_state(actor);
 }
 
 static void
@@ -564,12 +566,15 @@ gnibbles_worm_show (GnibblesWorm *worm)
 {
   clutter_actor_set_opacity (worm->actors, 0);
   clutter_actor_set_scale (worm->actors, 3.0, 3.0);
-  clutter_actor_animate (worm->actors, CLUTTER_EASE_OUT_CIRC, 910,
-                         "scale-x", 1.0,
-                         "scale-y", 1.0,
-                         "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
-                         "opacity", 0xff,
-                         NULL);
+
+  clutter_actor_save_easing_state(worm->actors);
+  clutter_actor_set_easing_mode (worm->actors, CLUTTER_EASE_OUT_CIRC);
+  clutter_actor_set_easing_duration (worm->actors, 910);
+  clutter_actor_set_scale (worm->actors, 1.0, 1.0);
+  clutter_actor_set_pivot_point (worm->actors,.5,.5);
+  clutter_actor_set_opacity (worm->actors, 0xff);
+  clutter_actor_restore_easing_state(worm->actors);
+
   worm->stop = FALSE;
 }
 
@@ -723,9 +728,11 @@ gnibbles_worm_reduce_tail (GnibblesWorm *worm, gint erasesize)
     worm->length -= erasesize;
     clutter_actor_add_child (stage, group);
 
-    clutter_actor_animate (group, CLUTTER_EASE_OUT_EXPO, 850,
-                           "opacity", 0,
-                           NULL);
+    clutter_actor_save_easing_state(group);
+    clutter_actor_set_easing_mode (group, CLUTTER_EASE_OUT_EXPO);
+    clutter_actor_set_easing_duration (group, 850);
+    clutter_actor_set_opacity (group, 0);
+    clutter_actor_restore_easing_state(group);
   }
 }
 


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