gnome-games r8169 - trunk/aisleriot



Author: jclinton
Date: Tue Oct 21 19:47:55 2008
New Revision: 8169
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8169&view=rev

Log:
Don't animate the depth of a card if it is being dropped from a drag.

Modified:
   trunk/aisleriot/board.c
   trunk/aisleriot/slot-renderer.c
   trunk/aisleriot/slot-renderer.h

Modified: trunk/aisleriot/board.c
==============================================================================
--- trunk/aisleriot/board.c	(original)
+++ trunk/aisleriot/board.c	Tue Oct 21 19:47:55 2008
@@ -215,6 +215,7 @@
 {
   Card card;
   gint cardx, cardy;
+  gboolean from_drag;
 };
 
 STATIC_ASSERT (LAST_STATUS < 16 /* 2^4 */);
@@ -873,6 +874,7 @@
                                           &removed_card.cardy);
           removed_card.cardx += slot->rect.x;
           removed_card.cardy += slot->rect.y;
+          removed_card.from_drag = FALSE;
           g_array_append_val (priv->removed_cards, removed_card);
         }
       }
@@ -904,6 +906,7 @@
         anim.cardx += slot->rect.x;
         anim.cardy += slot->rect.y;
         anim.face_down = old_card.attr.face_down;
+        anim.raise = TRUE;
 
         g_array_append_val (animations, anim);
       }
@@ -929,6 +932,7 @@
             anim.cardx = removed_card->cardx;
             anim.cardy = removed_card->cardy;
             anim.face_down = removed_card->card.attr.face_down;
+            anim.raise = !removed_card->from_drag;
 
             g_array_append_val (animations, anim);
 
@@ -1164,6 +1168,7 @@
     removed_card.cardx = x;
     removed_card.cardy = y;
     removed_card.card = hcard;
+    removed_card.from_drag = TRUE;
 
     g_array_append_val (priv->removed_cards, removed_card);
 
@@ -1302,8 +1307,10 @@
     RemovedCard *removed_card = &g_array_index (priv->removed_cards,
                                                 RemovedCard, i);
 
-    removed_card->cardx += x - priv->last_click_x;
-    removed_card->cardy += y - priv->last_click_y;
+    if (removed_card->from_drag) {
+      removed_card->cardx += x - priv->last_click_x;
+      removed_card->cardy += y - priv->last_click_y;
+    }
   }
 
   if (hslot) {

Modified: trunk/aisleriot/slot-renderer.c
==============================================================================
--- trunk/aisleriot/slot-renderer.c	(original)
+++ trunk/aisleriot/slot-renderer.c	Tue Oct 21 19:47:55 2008
@@ -500,12 +500,14 @@
       clutter_behaviour_apply (anim_data.rotate, anim_data.card_tex);
     }
 
-    alpha = clutter_alpha_new_full (priv->timeline, CLUTTER_ALPHA_SINE,
-                                    NULL, NULL);
-
-    anim_data.depth = clutter_behaviour_depth_new (alpha,
-                                                   0, card_height);
-    clutter_behaviour_apply (anim_data.depth, anim_data.card_tex);
+    if (anims[i].raise) {
+      alpha = clutter_alpha_new_full (priv->timeline, CLUTTER_ALPHA_SINE,
+                                      NULL, NULL);
+
+      anim_data.depth = clutter_behaviour_depth_new (alpha,
+                                                     0, card_height);
+      clutter_behaviour_apply (anim_data.depth, anim_data.card_tex);
+    }
 
     g_array_append_val (priv->animations, anim_data);
 

Modified: trunk/aisleriot/slot-renderer.h
==============================================================================
--- trunk/aisleriot/slot-renderer.h	(original)
+++ trunk/aisleriot/slot-renderer.h	Tue Oct 21 19:47:55 2008
@@ -69,6 +69,7 @@
 {
   gint cardx, cardy;
   gboolean face_down;
+  gboolean raise;
 };
 
 GType aisleriot_slot_renderer_get_type (void) G_GNUC_CONST;



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