[gnome-games] [aisleriot] Upgrade to Clutter 0.9



commit a594115e066c779afa3655d6ec1d3f3ec6778e71
Author: Neil Roberts <nroberts src gnome org>
Date:   Thu Apr 30 23:23:29 2009 +0100

    [aisleriot] Upgrade to Clutter 0.9
    
    - Paints using the new Cogl material API
    
    - Brings back dependency on Clutter-GTK instead of GamesClutterEmbed.
    
    - Uses backface culling to render AisleriotCards. That way the other
      side of the card will be drawn at exactly the right moment
      regardless of where the card is on the stage. Previously it would
      glitch and flip too early unless the card was at the dead center of
      the stage.
    
    - Drawing highlights has been removed from AisleriotCard. These are
      only used for animated cards anyway so it wouldn't make sense to
      highlight them.
    
    - Highlights in AisleriotSlotRenderer are now drawn by precalculating
      a color which biases the texture. Previously the same effect was
      acheived by rendering the card twice.
---
 aisleriot/Makefile.am     |    5 +-
 aisleriot/baize.c         |   15 +---
 aisleriot/board.c         |    7 +-
 aisleriot/card.c          |  181 ++++++++------------------------------------
 aisleriot/card.h          |    3 +-
 aisleriot/slot-renderer.c |  114 +++++++++++++++++-----------
 aisleriot/sol.c           |    4 +-
 7 files changed, 117 insertions(+), 212 deletions(-)

diff --git a/aisleriot/Makefile.am b/aisleriot/Makefile.am
index 2a4e8fe..f779d6c 100644
--- a/aisleriot/Makefile.am
+++ b/aisleriot/Makefile.am
@@ -102,8 +102,9 @@ sol_clutter_SOURCES += guile16-compat.h
 endif
 		
 sol_clutter_CPPFLAGS = $(sol_CPPFLAGS) -DHAVE_CLUTTER
-sol_clutter_CFLAGS = $(sol_CFLAGS) $(CLUTTER_CFLAGS)
-sol_clutter_LDADD = $(sol_LDADD) $(CLUTTER_LIBS)
+sol_clutter_CFLAGS = $(sol_CFLAGS) $(CLUTTER_CFLAGS) $(CLUTTER_GTK_CFLAGS)
+sol_clutter_LDADD = $(sol_LDADD) $(CLUTTER_LIBS) $(CLUTTER_GTK_LIBS)
+
 
 endif # HAVE_CLUTTER
 
diff --git a/aisleriot/baize.c b/aisleriot/baize.c
index 825f34b..8b5ee54 100644
--- a/aisleriot/baize.c
+++ b/aisleriot/baize.c
@@ -58,7 +58,6 @@ aisleriot_baize_paint (ClutterActor *actor)
   CoglHandle tex;
   ClutterGeometry stage_geom;
   guint tex_width, tex_height;
-  static const ClutterColor white = { 0xff, 0xff, 0xff, 0xff };
 
   if ((stage = clutter_actor_get_stage (actor)) == NULL)
     return;
@@ -76,13 +75,9 @@ aisleriot_baize_paint (ClutterActor *actor)
   clutter_actor_get_allocation_geometry (stage, &stage_geom);
 
   /* Repeat the texture to fill the size of the stage */
-  cogl_color (&white);
-  cogl_texture_rectangle (tex, 0, 0,
-                          CLUTTER_INT_TO_FIXED (stage_geom.width),
-                          CLUTTER_INT_TO_FIXED (stage_geom.height),
-                          0, 0,
-                          CLUTTER_INT_TO_FIXED (stage_geom.width)
-                          / tex_width,
-                          CLUTTER_INT_TO_FIXED (stage_geom.height)
-                          / tex_height);
+  cogl_set_source_texture (tex);
+  cogl_rectangle_with_texture_coords (0, 0, stage_geom.width, stage_geom.height,
+                                      0, 0,
+                                      (gfloat) stage_geom.width / tex_width,
+                                      (gfloat) stage_geom.height / tex_height);
 }
diff --git a/aisleriot/board.c b/aisleriot/board.c
index 8acc9de..848fff5 100644
--- a/aisleriot/board.c
+++ b/aisleriot/board.c
@@ -28,9 +28,9 @@
 #include <gdk/gdkkeysyms.h>
 
 #include <clutter/clutter.h>
+#include <clutter-gtk/clutter-gtk.h>
 
 #include <libgames-support/games-card-textures-cache.h>
-#include <libgames-support/games-clutter-embed.h>
 #include <libgames-support/games-files.h>
 #include <libgames-support/games-marshal.h>
 #include <libgames-support/games-pixbuf-utils.h>
@@ -1245,8 +1245,7 @@ drag_begin (AisleriotBoard *board)
 
     g_array_append_val (priv->removed_cards, removed_card);
 
-    card_tex = aisleriot_card_new (priv->textures, hcard, hcard,
-                                   &priv->selection_colour);
+    card_tex = aisleriot_card_new (priv->textures, hcard, hcard);
     clutter_actor_set_position (card_tex, x, y);
     clutter_container_add (CLUTTER_CONTAINER (priv->moving_cards_group),
                            card_tex, NULL);
@@ -2298,7 +2297,7 @@ slot_changed_cb (AisleriotGame *game,
 
 /* Class implementation */
 
-G_DEFINE_TYPE (AisleriotBoard, aisleriot_board, GTK_TYPE_CLUTTER_EMBED);
+G_DEFINE_TYPE (AisleriotBoard, aisleriot_board, GTK_CLUTTER_TYPE_EMBED);
 
 /* AisleriotBoardClass methods */
 
diff --git a/aisleriot/card.c b/aisleriot/card.c
index 9b62a68..6cfc643 100644
--- a/aisleriot/card.c
+++ b/aisleriot/card.c
@@ -56,8 +56,6 @@ static void aisleriot_card_set_cache (AisleriotCard *card,
    % CLUTTER_INT_TO_FIXED (360)                 \
    >= CLUTTER_INT_TO_FIXED (180))
 
-static const ClutterColor default_highlight_color = { 0, 0, 0xaa, 0xff };
-
 G_DEFINE_TYPE (AisleriotCard, aisleriot_card, CLUTTER_TYPE_ACTOR);
 
 #define AISLERIOT_CARD_GET_PRIVATE(obj) \
@@ -67,8 +65,6 @@ G_DEFINE_TYPE (AisleriotCard, aisleriot_card, CLUTTER_TYPE_ACTOR);
 struct _AisleriotCardPrivate
 {
   Card bottom_card, top_card;
-  ClutterColor highlight_color;
-  gboolean highlighted;
 
   GamesCardTexturesCache *cache;
 };
@@ -79,28 +75,10 @@ enum
 
   PROP_CACHE,
   PROP_BOTTOM_CARD,
-  PROP_TOP_CARD,
-  PROP_HIGHLIGHTED,
-  PROP_HIGHLIGHT_COLOR
+  PROP_TOP_CARD
 };
 
 static void
-aisleriot_card_set_highlight_color (AisleriotCard *card,
-                                    const ClutterColor *color)
-{
-  AisleriotCardPrivate *priv = card->priv;
-
-  g_return_if_fail (color != NULL);
-
-  if (clutter_color_equal (color, &priv->highlight_color))
-    return;
-
-  priv->highlight_color = *color;
-
-  g_object_notify (G_OBJECT (card), "highlight-color");
-}
-
-static void
 aisleriot_card_class_init (AisleriotCardClass *klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
@@ -143,35 +121,6 @@ aisleriot_card_class_init (AisleriotCardClass *klass)
                                G_PARAM_STATIC_BLURB);
   g_object_class_install_property (gobject_class, PROP_CACHE, pspec);
 
-  pspec = g_param_spec_boolean ("highlighted", NULL, NULL,
-                                FALSE,
-                                G_PARAM_WRITABLE |
-                                G_PARAM_READABLE |
-                                G_PARAM_CONSTRUCT_ONLY |
-                                G_PARAM_STATIC_NAME |
-                                G_PARAM_STATIC_NICK |
-                                G_PARAM_STATIC_BLURB);
-  g_object_class_install_property (gobject_class, PROP_HIGHLIGHTED, pspec);
-
-#if 0
-  pspec = clutter_param_spec_color ("highlight-color", NULL, NULL,
-                                    &default_highlight_color,
-                                    G_PARAM_WRITABLE |
-                                    G_PARAM_STATIC_NAME |
-                                    G_PARAM_STATIC_NICK |
-                                    G_PARAM_STATIC_BLURB |
-                                    G_PARAM_CONSTRUCT);
-#else
-  pspec = g_param_spec_boxed ("highlight-color", NULL, NULL,
-                              CLUTTER_TYPE_COLOR,
-                              G_PARAM_WRITABLE |
-                              G_PARAM_STATIC_NAME |
-                              G_PARAM_STATIC_NICK |
-                              G_PARAM_STATIC_BLURB |
-                              G_PARAM_CONSTRUCT);
-#endif
-  g_object_class_install_property (gobject_class, PROP_HIGHLIGHT_COLOR, pspec);
-
   g_type_class_add_private (klass, sizeof (AisleriotCardPrivate));
 }
 
@@ -181,9 +130,6 @@ aisleriot_card_init (AisleriotCard *self)
   AisleriotCardPrivate *priv;
 
   priv = self->priv = AISLERIOT_CARD_GET_PRIVATE (self);
-
-  priv->highlighted = FALSE;
-  priv->highlight_color = default_highlight_color;
 }
 
 static void
@@ -199,14 +145,12 @@ aisleriot_card_dispose (GObject *self)
 ClutterActor *
 aisleriot_card_new (GamesCardTexturesCache *cache,
                     Card bottom_card,
-                    Card top_card,
-                    const ClutterColor *highlight_color)
+                    Card top_card)
 {
   return g_object_new (AISLERIOT_TYPE_CARD,
                        "cache", cache,
                        "bottom-card", bottom_card.value,
                        "top-card", top_card.value,
-                       "highlight-color", highlight_color,
                        NULL);
 }
 
@@ -267,64 +211,46 @@ aisleriot_card_paint (ClutterActor *actor)
 {
   AisleriotCard *card = (AisleriotCard *) actor;
   AisleriotCardPrivate *priv = card->priv;
-  Card card_num;
-  ClutterFixed x_angle, y_angle;
-  CoglHandle tex;
+  CoglHandle top_tex, bottom_tex;
   ClutterActorBox alloc_box;
-  gboolean x_swapped = FALSE;
-  static const ClutterColor white = { 0xff, 0xff, 0xff, 0xff };
-  gboolean show_top = TRUE;
-
-  x_angle = clutter_actor_get_rotationx (actor, CLUTTER_X_AXIS,
-                                         NULL, NULL, NULL);
-  y_angle = clutter_actor_get_rotationx (actor, CLUTTER_Y_AXIS,
-                                         NULL, NULL, NULL);
-
-  /* Show the other side of the card if it is rotated more than 180
-     degrees in exactly one of the axes */
-  if (ANGLE_IS_UPSIDE_DOWN (x_angle))
-    show_top = !show_top;
-  if (ANGLE_IS_UPSIDE_DOWN (y_angle)) {
-    show_top = !show_top;
-    x_swapped = TRUE;
-  }
 
-  card_num = show_top ? priv->top_card : priv->bottom_card;
+  cogl_enable_backface_culling (TRUE);
 
-  tex = games_card_textures_cache_get_card_texture (priv->cache, card_num);
-  if (G_UNLIKELY (tex == COGL_INVALID_HANDLE))
+  top_tex = games_card_textures_cache_get_card_texture (priv->cache,
+                                                        priv->top_card);
+  bottom_tex = games_card_textures_cache_get_card_texture (priv->cache,
+                                                           priv->bottom_card);
+  if (G_UNLIKELY (top_tex == COGL_INVALID_HANDLE
+                  || bottom_tex == COGL_INVALID_HANDLE))
     return;
 
   clutter_actor_get_allocation_box (actor, &alloc_box);
 
-  /* Ideally we would just swap the texture coordinates, but Cogl
-     won't let you do this */
-  if (x_swapped) {
-    cogl_push_matrix ();
-    cogl_translate (CLUTTER_UNITS_TO_DEVICE (alloc_box.x2 - alloc_box.x1) / 2,
-                    0, 0);
-    cogl_rotate (180, 0, 1, 0);
-    cogl_translate (-CLUTTER_UNITS_TO_DEVICE (alloc_box.x2 - alloc_box.x1) / 2,
-                    0, 0);
-  }
+  /* Draw both sides of the card. Backface culling is enabled so only
+     one side will actually be rendered */
 
-  cogl_color (&white);
-  cogl_texture_rectangle (tex, 0, 0,
-                          CLUTTER_UNITS_TO_FIXED (alloc_box.x2 - alloc_box.x1),
-                          CLUTTER_UNITS_TO_FIXED (alloc_box.y2 - alloc_box.y1),
-                          0, 0, CFX_ONE, CFX_ONE);
-  if (priv->highlighted) {
-    cogl_color (&priv->highlight_color);
-    cogl_texture_rectangle (tex, 0, 0,
-                            CLUTTER_UNITS_TO_FIXED (alloc_box.x2
-                                                    - alloc_box.x1),
-                            CLUTTER_UNITS_TO_FIXED (alloc_box.y2
-                                                    - alloc_box.y1),
-                            0, 0, CFX_ONE, CFX_ONE);
-  }
+  cogl_set_source_texture (top_tex);
+
+  cogl_rectangle (0.0f, 0.0f,
+                  CLUTTER_UNITS_TO_FLOAT (alloc_box.x2 - alloc_box.x1),
+                  CLUTTER_UNITS_TO_FLOAT (alloc_box.y2 - alloc_box.y1));
+
+  cogl_set_source_texture (bottom_tex);
 
-  if (x_swapped)
-    cogl_pop_matrix ();
+  /* Rotate along the y-axis about the center of the card to make the
+     bottom of the card face the other way */
+  cogl_push_matrix ();
+  cogl_translate (CLUTTER_UNITS_TO_DEVICE (alloc_box.x2 - alloc_box.x1) / 2,
+                  0, 0);
+  cogl_rotate (180, 0, 1, 0);
+  cogl_translate (-CLUTTER_UNITS_TO_DEVICE (alloc_box.x2 - alloc_box.x1) / 2,
+                  0, 0);
+  cogl_rectangle (0.0f, 0.0f,
+                  CLUTTER_UNITS_TO_FLOAT (alloc_box.x2 - alloc_box.x1),
+                  CLUTTER_UNITS_TO_FLOAT (alloc_box.y2 - alloc_box.y1));
+  cogl_pop_matrix ();
+
+  cogl_enable_backface_culling (FALSE);
 }
 
 static void
@@ -360,14 +286,6 @@ aisleriot_card_set_property (GObject *self,
       aisleriot_card_set_cache (card, g_value_get_object (value));
       break;
 
-    case PROP_HIGHLIGHTED:
-      aisleriot_card_set_highlighted (card, g_value_get_boolean (value));
-      break;
-
-    case PROP_HIGHLIGHT_COLOR:
-      aisleriot_card_set_highlight_color (card, g_value_get_boxed (value));
-      break;
-
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (self, property_id, pspec);
       break;
@@ -396,11 +314,6 @@ aisleriot_card_get_property (GObject *self,
       g_value_set_object (value, priv->cache);
       break;
 
-    case PROP_HIGHLIGHTED:
-      g_value_set_boolean (value, priv->highlighted);
-      break;
-
-    case PROP_HIGHLIGHT_COLOR:
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (self, property_id, pspec);
       break;
@@ -454,31 +367,3 @@ aisleriot_card_set_cache (AisleriotCard *card, GamesCardTexturesCache *cache)
 
   g_object_notify (G_OBJECT (card), "cache");
 }
-
-void
-aisleriot_card_set_highlighted (AisleriotCard *card, gboolean highlighted)
-{
-  AisleriotCardPrivate *priv;
-
-  g_return_if_fail (AISLERIOT_IS_CARD (card));
-
-  priv = card->priv;
-
-  priv->highlighted = highlighted;
-
-  clutter_actor_queue_redraw (CLUTTER_ACTOR (card));
-
-  g_object_notify (G_OBJECT (card), "highlighted");
-}
-
-gboolean
-aisleriot_card_get_highlighted (AisleriotCard *card)
-{
-  AisleriotCardPrivate *priv;
-
-  g_return_val_if_fail (AISLERIOT_IS_CARD (card), FALSE);
-
-  priv = card->priv;
-
-  return priv->highlighted;
-}
diff --git a/aisleriot/card.h b/aisleriot/card.h
index 1b56078..a886613 100644
--- a/aisleriot/card.h
+++ b/aisleriot/card.h
@@ -65,8 +65,7 @@ GType aisleriot_card_get_type (void) G_GNUC_CONST;
 
 ClutterActor *aisleriot_card_new (GamesCardTexturesCache *cache,
                                   Card bottom_card,
-                                  Card top_card,
-                                  const ClutterColor *highlight_color);
+                                  Card top_card);
 
 void aisleriot_card_set_card (AisleriotCard *card,
                               Card bottom_card,
diff --git a/aisleriot/slot-renderer.c b/aisleriot/slot-renderer.c
index ec5798b..5129d4c 100644
--- a/aisleriot/slot-renderer.c
+++ b/aisleriot/slot-renderer.c
@@ -22,6 +22,7 @@
 #include <gtk/gtk.h>
 #include <cogl/cogl.h>
 #include <string.h>
+#include <math.h>
 
 #include "slot-renderer.h"
 #include "card.h"
@@ -45,7 +46,6 @@ static void aisleriot_slot_renderer_set_cache (AisleriotSlotRenderer *srend,
 
 static void completed_cb (AisleriotSlotRenderer *srend);
 
-static const ClutterColor white = { 0xff, 0xff, 0xff, 0xff };
 static const ClutterColor default_highlight_color = { 0, 0, 0xaa, 0xff };
 
 G_DEFINE_TYPE (AisleriotSlotRenderer, aisleriot_slot_renderer,
@@ -63,6 +63,8 @@ struct _AisleriotSlotRendererPrivate
 
   Slot *slot;
 
+  CoglHandle material;
+
   ClutterColor highlight_color;
   gboolean show_highlight;
   gint highlight_start;
@@ -209,6 +211,11 @@ aisleriot_slot_renderer_dispose (GObject *object)
     priv->timeline = NULL;
   }
 
+  if (priv->material != COGL_INVALID_HANDLE) {
+    cogl_handle_unref (priv->material);
+    priv->material = COGL_INVALID_HANDLE;
+  }
+
   aisleriot_slot_renderer_set_animation_layer (self, NULL);
 
   G_OBJECT_CLASS (aisleriot_slot_renderer_parent_class)->dispose (object);
@@ -330,6 +337,41 @@ aisleriot_slot_renderer_get_property (GObject *object,
 }
 
 static void
+aisleriot_slot_renderer_set_material_for_card (AisleriotSlotRenderer *srend,
+                                               CoglHandle tex,
+                                               gboolean show_highlight)
+{
+  AisleriotSlotRendererPrivate *priv = srend->priv;
+  guint8 opacity = clutter_actor_get_paint_opacity (CLUTTER_ACTOR (srend));
+
+  if (priv->material == COGL_INVALID_HANDLE)
+    priv->material = cogl_material_new ();
+
+  if (show_highlight)
+    /* The previous code for drawing the highlight rendered the normal
+       card texture and then rendered the card again multiplied by the
+       highlight color but with 50% transparency. The blend function
+       is alpha*src+(1-alpha*dst) where src is effectively the tex
+       times the highlight color and the dst is the original
+       tex. Therefore the final color is 0.5*tex+0.5*tex*highlight
+       which is the same as (0.5+highlight/2)*tex. We can precompute
+       that value to avoid having to draw the card twice */
+    cogl_material_set_color4ub (priv->material,
+                                MIN (priv->highlight_color.red
+                                     / 2 + 128, 0xff),
+                                MIN (priv->highlight_color.green
+                                     / 2 + 128, 0xff),
+                                MIN (priv->highlight_color.blue
+                                     / 2 + 128, 0xff),
+                                opacity);
+  else
+    cogl_material_set_color4ub (priv->material, 255, 255, 255, opacity);
+
+  cogl_material_set_layer (priv->material, 0, tex);
+  cogl_set_source (priv->material);
+}
+
+static void
 aisleriot_slot_renderer_paint_card (AisleriotSlotRenderer *srend,
                                     guint card_num)
 {
@@ -350,26 +392,11 @@ aisleriot_slot_renderer_paint_card (AisleriotSlotRenderer *srend,
                                   FALSE,
                                   &cardx, &cardy);
 
-  cogl_color (&white);
-  cogl_texture_rectangle (cogl_tex,
-                          CLUTTER_INT_TO_FIXED (cardx),
-                          CLUTTER_INT_TO_FIXED (cardy),
-                          CLUTTER_INT_TO_FIXED (cardx + tex_width),
-                          CLUTTER_INT_TO_FIXED (cardy + tex_height),
-                          0, 0, CFX_ONE, CFX_ONE);
-
-  if (priv->show_highlight && (card_num >= priv->highlight_start)) {
-    ClutterColor color = priv->highlight_color;
-
-    color.alpha = 0x80;
-    cogl_color (&color);
-    cogl_texture_rectangle (cogl_tex,
-                            CLUTTER_INT_TO_FIXED (cardx),
-                            CLUTTER_INT_TO_FIXED (cardy),
-                            CLUTTER_INT_TO_FIXED (cardx + tex_width),
-                            CLUTTER_INT_TO_FIXED (cardy + tex_height),
-                            0, 0, CFX_ONE, CFX_ONE);
-  }
+  aisleriot_slot_renderer_set_material_for_card
+    (srend, cogl_tex,
+     priv->show_highlight && card_num >= priv->highlight_start);
+
+  cogl_rectangle (cardx, cardy, cardx + tex_width, cardy + tex_height);
 }
 
 static void
@@ -403,21 +430,9 @@ aisleriot_slot_renderer_paint (ClutterActor *actor)
     tex_width = cogl_texture_get_width (cogl_tex);
     tex_height = cogl_texture_get_height (cogl_tex);
 
-    cogl_color (&white);
-    cogl_texture_rectangle (cogl_tex,
-                            0, 0,
-                            CLUTTER_INT_TO_FIXED (tex_width),
-                            CLUTTER_INT_TO_FIXED (tex_height),
-                            0, 0, CFX_ONE, CFX_ONE);
-
-    if (priv->show_highlight) {
-      cogl_color (&priv->highlight_color);
-      cogl_texture_rectangle (cogl_tex,
-                              0, 0,
-                              CLUTTER_INT_TO_FIXED (tex_width),
-                              CLUTTER_INT_TO_FIXED (tex_height),
-                              0, 0, CFX_ONE, CFX_ONE);
-    }
+    aisleriot_slot_renderer_set_material_for_card (srend, cogl_tex,
+                                                   priv->show_highlight);
+    cogl_rectangle (0, 0, tex_width, tex_height);
   } else {
     guint first_card, last_card;
 
@@ -537,6 +552,15 @@ aisleriot_slot_renderer_set_animation_layer (AisleriotSlotRenderer *srend,
   g_object_notify (G_OBJECT (srend), "animation-layer");
 }
 
+static gdouble
+aisleriot_slot_sine_animation_mode (ClutterAlpha *alpha,
+                                    gpointer data)
+{
+  ClutterTimeline *tl = clutter_alpha_get_timeline (alpha);
+
+  return sin (clutter_timeline_get_progress (tl) * G_PI);
+}
+
 void
 aisleriot_slot_renderer_set_animations (AisleriotSlotRenderer *srend,
                                         guint n_anims,
@@ -583,8 +607,9 @@ aisleriot_slot_renderer_set_animations (AisleriotSlotRenderer *srend,
 
     memset (&anim_data, 0, sizeof (anim_data));
 
-    anim_data.card_tex = aisleriot_card_new (priv->cache, anims[i].old_card,
-                                             card, &priv->highlight_color);
+    anim_data.card_tex = aisleriot_card_new (priv->cache,
+                                             anims[i].old_card,
+                                             card);
 
     card_width = clutter_actor_get_width (anim_data.card_tex);
     card_height = clutter_actor_get_height (anim_data.card_tex);
@@ -605,11 +630,11 @@ aisleriot_slot_renderer_set_animations (AisleriotSlotRenderer *srend,
     knots[1].x += priv->slot->rect.x;
     knots[1].y += priv->slot->rect.y;
 
-    alpha = clutter_alpha_new_full (priv->timeline, CLUTTER_ALPHA_RAMP_INC,
-                                    NULL, NULL);
+    alpha = clutter_alpha_new_full (priv->timeline, CLUTTER_LINEAR);
 
-    anim_data.move = clutter_behaviour_path_new (alpha, knots,
-                                                 G_N_ELEMENTS (knots));
+    anim_data.move
+      = clutter_behaviour_path_new_with_knots (alpha, knots,
+                                               G_N_ELEMENTS (knots));
     clutter_behaviour_apply (anim_data.move, anim_data.card_tex);
 
     if (anims[i].old_card.value != card.value) {
@@ -634,8 +659,9 @@ aisleriot_slot_renderer_set_animations (AisleriotSlotRenderer *srend,
     }
 
     if (anims[i].raise) {
-      alpha = clutter_alpha_new_full (priv->timeline, CLUTTER_ALPHA_SINE,
-                                      NULL, NULL);
+      alpha = clutter_alpha_new_with_func (priv->timeline,
+                                           aisleriot_slot_sine_animation_mode,
+                                           NULL, NULL);
 
       anim_data.depth = clutter_behaviour_depth_new (alpha,
                                                      0, card_height);
diff --git a/aisleriot/sol.c b/aisleriot/sol.c
index f19d445..5ac6233 100644
--- a/aisleriot/sol.c
+++ b/aisleriot/sol.c
@@ -32,7 +32,7 @@
 
 #ifdef HAVE_CLUTTER
 #include <clutter/clutter.h>
-#include <clutter-gtk/gtk-clutter-embed.h>
+#include <clutter-gtk/clutter-gtk.h>
 #endif
 
 #ifdef HAVE_HILDON
@@ -558,7 +558,7 @@ main_prog (void *closure, int argc, char *argv[])
   }
 
 #ifdef HAVE_CLUTTER
-  if (games_clutter_init_with_args (NULL, NULL, NULL, NULL, NULL, &error) != CLUTTER_INIT_SUCCESS) {
+  if (gtk_clutter_init_with_args (NULL, NULL, NULL, NULL, NULL, &error) != CLUTTER_INIT_SUCCESS) {
     g_printerr ("Failed to initialise clutter: %s\n", error->message);
     g_error_free (error);
     goto cleanup;



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