gnome-games r8815 - trunk/aisleriot
- From: nroberts svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r8815 - trunk/aisleriot
- Date: Sun, 8 Mar 2009 20:33:42 +0000 (UTC)
Author: nroberts
Date: Sun Mar 8 20:33:42 2009
New Revision: 8815
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8815&view=rev
Log:
[aisleriot-slot-renderer] Allow the animation to specify the old card
Instead of specifying whether the old card was flipped, the whole
value of the old card is now passed. It will animate turning over the
cards if they are different.
AisleriotBoard uses this to set the bottom card to be the bottom most
unexposed card. This gives a better appearance when flipping over a
whole slot.
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 Sun Mar 8 20:33:42 2009
@@ -923,7 +923,7 @@
&anim.cardy);
anim.cardx += slot->rect.x;
anim.cardy += slot->rect.y;
- anim.face_down = old_card.attr.face_down;
+ anim.old_card = old_card;
anim.raise = TRUE;
g_array_append_val (animations, anim);
@@ -949,7 +949,7 @@
anim.cardx = removed_card->cardx;
anim.cardy = removed_card->cardy;
- anim.face_down = removed_card->card.attr.face_down;
+ anim.old_card = removed_card->card;
anim.raise = !removed_card->from_drag;
g_array_append_val (animations, anim);
@@ -967,9 +967,25 @@
them at the slot either. This will for example happen in
Canfield when the discard pile is flipped over into the draw
pile */
- if (animations->len == slot->exposed)
- n_unexposed_animated_cards = (slot->cards->len - slot->old_cards->len
- - slot->exposed);
+ if (animations->len > 0 && animations->len == slot->exposed)
+ {
+ AisleriotAnimStart *anim = &g_array_index (animations,
+ AisleriotAnimStart, 0);
+
+ n_unexposed_animated_cards = (slot->cards->len - slot->old_cards->len
+ - slot->exposed);
+
+ if (n_unexposed_animated_cards > 0)
+ {
+ /* Set the bottom card of the first animation to be the
+ lowest unexposed card */
+ anim->old_card
+ = CARD (slot->cards->data[slot->cards->len
+ - animations->len
+ - n_unexposed_animated_cards]);
+ anim->old_card.attr.face_down = !anim->old_card.attr.face_down;
+ }
+ }
}
aisleriot_slot_renderer_set_animations
Modified: trunk/aisleriot/slot-renderer.c
==============================================================================
--- trunk/aisleriot/slot-renderer.c (original)
+++ trunk/aisleriot/slot-renderer.c Sun Mar 8 20:33:42 2009
@@ -578,15 +578,13 @@
AnimationData anim_data;
ClutterAlpha *alpha;
ClutterKnot knots[2];
- Card card = CARD (priv->slot->cards->data[card_num]), flipped_card;
+ Card card = CARD (priv->slot->cards->data[card_num]);
guint card_width, card_height;
memset (&anim_data, 0, sizeof (anim_data));
- flipped_card = card;
- flipped_card.attr.face_down = !flipped_card.attr.face_down;
- anim_data.card_tex = aisleriot_card_new (priv->cache, flipped_card, card,
- &priv->highlight_color);
+ anim_data.card_tex = aisleriot_card_new (priv->cache, anims[i].old_card,
+ card, &priv->highlight_color);
card_width = clutter_actor_get_width (anim_data.card_tex);
card_height = clutter_actor_get_height (anim_data.card_tex);
@@ -614,7 +612,7 @@
G_N_ELEMENTS (knots));
clutter_behaviour_apply (anim_data.move, anim_data.card_tex);
- if (anims[i].face_down != card.attr.face_down) {
+ if (anims[i].old_card.value != card.value) {
int center_x, center_y;
center_x = card_width / 2;
Modified: trunk/aisleriot/slot-renderer.h
==============================================================================
--- trunk/aisleriot/slot-renderer.h (original)
+++ trunk/aisleriot/slot-renderer.h Sun Mar 8 20:33:42 2009
@@ -66,7 +66,7 @@
struct _AisleriotAnimStart
{
gint cardx, cardy;
- gboolean face_down;
+ Card old_card;
gboolean raise;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]