[gnome-games] gnometris: Port explosion scale to clutter-0.9 with better performance



commit 0472c38ab94e71cb44d4bb789ee4a0f3f38ca7cb
Author: Jason D. Clinton <me jasonclinton com>
Date:   Thu May 7 15:43:43 2009 -0500

    gnometris: Port explosion scale to clutter-0.9 with better performance
    
    There's a unified callback now. (i.e. the number of callback is reduced
    by a factor of up to 50x when exploding.)
---
 gnometris/blockops.cpp |    8 ++++++--
 gnometris/blockops.h   |    1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gnometris/blockops.cpp b/gnometris/blockops.cpp
index 7a2b61b..d994699 100644
--- a/gnometris/blockops.cpp
+++ b/gnometris/blockops.cpp
@@ -188,6 +188,9 @@ BlockOps::BlockOps() :
 						CLUTTER_EASE_OUT_QUINT);
 	explode_fade_behaviour = clutter_behaviour_opacity_new (explode_alpha,
 								255, 0);
+	explode_scale_behaviour = clutter_behaviour_scale_new (explode_alpha,
+								1.0, 1.0,
+								2.0, 2.0);
 
 	quake_time = clutter_timeline_new_for_duration (360);
 	quake_alpha = clutter_alpha_new_full (quake_time,
@@ -217,6 +220,7 @@ BlockOps::~BlockOps()
 	g_object_unref (fall_time);
 	g_object_unref (explode_time);
 	g_object_unref (explode_fade_behaviour);
+	g_object_unref (explode_scale_behaviour);
 	g_object_unref (quake_time);
 	g_object_unref (quake_behaviour);
 }
@@ -389,8 +393,7 @@ BlockOps::eliminateLine(int l)
 							 path_line);
 			clutter_behaviour_apply (field[x][l].explode_move_behaviour, field[x][l].actor);
 			clutter_behaviour_apply (explode_fade_behaviour, field[x][l].actor);
-//			clutter_effect_scale (Block::explode_tmpl, field[x][l].actor,
-//					1.5, 1.5, NULL, NULL);
+			clutter_behaviour_apply (explode_scale_behaviour, field[x][l].actor);
 			destroy_actors = g_list_prepend (destroy_actors, field[x][l].actor);
 			field[x][l].actor = NULL;
 		}
@@ -419,6 +422,7 @@ BlockOps::checkFullLines()
 	// we can have at most 4 full lines (vertical block)
 	int num_full_lines = 0;
 	clutter_behaviour_remove_all (explode_fade_behaviour);
+	clutter_behaviour_remove_all (explode_scale_behaviour);
 
 	for (int y = MIN (posy + 4, LINES); y > 0; --y)
 	{
diff --git a/gnometris/blockops.h b/gnometris/blockops.h
index 41b4849..6748325 100644
--- a/gnometris/blockops.h
+++ b/gnometris/blockops.h
@@ -100,6 +100,7 @@ public:
 	ClutterTimeline *explode_time;
 	ClutterAlpha *explode_alpha;
 	ClutterBehaviour *explode_fade_behaviour;
+	ClutterBehaviour *explode_scale_behaviour;
 	static gboolean move_end (ClutterTimeline *timeline, BlockOps *f);
 	static gboolean fall_end (ClutterTimeline *timeline, BlockOps *f);
 	static gboolean explode_end (ClutterTimeline *timeline, BlockOps *f);



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