gnome-games r8694 - trunk/gnometris
- From: jclinton svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r8694 - trunk/gnometris
- Date: Mon, 9 Feb 2009 16:33:30 +0000 (UTC)
Author: jclinton
Date: Mon Feb 9 16:33:30 2009
New Revision: 8694
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8694&view=rev
Log:
Perform the earthquake after the blocks slam in to foundation
Just moves the beginning of the effect to the timeline end callback.
Modified:
trunk/gnometris/blockops.cpp
trunk/gnometris/blockops.h
Modified: trunk/gnometris/blockops.cpp
==============================================================================
--- trunk/gnometris/blockops.cpp (original)
+++ trunk/gnometris/blockops.cpp Mon Feb 9 16:33:30 2009
@@ -32,7 +32,7 @@
ClutterAlpha *Block::move_block_alpha = NULL;
void
-Block::animation_destroy (ClutterTimeline *tml, gpointer *data)
+Block::animation_destroy (ClutterTimeline *tml, BlockOps *f)
{
ClutterActor *tmp_actor = NULL;
g_list_foreach (destroy_actors,
@@ -40,6 +40,11 @@
tmp_actor);
g_list_free (destroy_actors);
destroy_actors = NULL;
+
+ clutter_actor_set_position (CLUTTER_ACTOR(f->playingField),
+ f->center_anchor_x, f->center_anchor_y + f->cell_height * f->quake_ratio);
+ clutter_effect_move (f->effect_earthquake, f->playingField,
+ f->center_anchor_x, f->center_anchor_y, NULL, NULL);
}
void
@@ -142,6 +147,7 @@
rot(0),
color(0),
backgroundImage(NULL),
+ quake_ratio(0.0),
center_anchor_x(0),
center_anchor_y(0)
{
@@ -400,13 +406,9 @@
if (numFullLines > 0)
{
g_signal_connect (timeline, "completed",
- G_CALLBACK (Block::animation_destroy), (gpointer) NULL);
+ G_CALLBACK (Block::animation_destroy), this);
clutter_timeline_start (timeline);
- float quake_ratio = ((float) numCascades) / (float) LINES;
- clutter_actor_set_position (CLUTTER_ACTOR(playingField),
- center_anchor_x, center_anchor_y + cell_height * quake_ratio);
- clutter_effect_move (effect_earthquake, playingField,
- center_anchor_x, center_anchor_y, NULL, NULL);
+ quake_ratio = ((float) numCascades) / (float) LINES;
}
return numFullLines;
Modified: trunk/gnometris/blockops.h
==============================================================================
--- trunk/gnometris/blockops.h (original)
+++ trunk/gnometris/blockops.h Mon Feb 9 16:33:30 2009
@@ -61,11 +61,12 @@
static GList *destroy_actors;
static GList *destroy_behaviours;
- static void animation_destroy (ClutterTimeline *timeline, gpointer *data);
+ static void animation_destroy (ClutterTimeline *timeline, BlockOps *f);
static void behaviours_destroy (ClutterTimeline *timeline, gpointer *data);
};
class BlockOps {
+ friend class Block;
public:
BlockOps ();
~BlockOps ();
@@ -142,6 +143,8 @@
ClutterTimeline *long_anim_tml;
ClutterEffectTemplate *effect_earthquake;
+ float quake_ratio;
+
int center_anchor_x;
int center_anchor_y;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]