gnome-games r8479 - in trunk: aisleriot libgames-support



Author: chpe
Date: Tue Jan  6 18:19:57 2009
New Revision: 8479
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8479&view=rev

Log:
To highlight the cards, draw them fist normally and then again with the
highlight colour and opacity 0.5. Looks much better than the previous
effect.

Modified:
   trunk/aisleriot/card.c
   trunk/aisleriot/slot-renderer.c
   trunk/libgames-support/games-card-theme.c

Modified: trunk/aisleriot/card.c
==============================================================================
--- trunk/aisleriot/card.c	(original)
+++ trunk/aisleriot/card.c	Tue Jan  6 18:19:57 2009
@@ -223,15 +223,16 @@
     cogl_translate (-CLUTTER_FIXED_TO_INT (tex_width) / 2, 0, 0);
   }
 
-  if (priv->highlighted) {
-    cogl_color (&priv->highlight_color);
-  } else {
-    cogl_color (&white);
-  }
-
+  cogl_color (&white);
   cogl_texture_rectangle (tex, 0, 0,
                           tex_width, tex_height,
                           0, 0, CFX_ONE, CFX_ONE);
+  if (priv->highlighted) {
+    cogl_color (&priv->highlight_color);
+    cogl_texture_rectangle (tex, 0, 0,
+                            tex_width, tex_height,
+                            0, 0, CFX_ONE, CFX_ONE);
+  }
 
   if (x_swapped)
     cogl_pop_matrix ();

Modified: trunk/aisleriot/slot-renderer.c
==============================================================================
--- trunk/aisleriot/slot-renderer.c	(original)
+++ trunk/aisleriot/slot-renderer.c	Tue Jan  6 18:19:57 2009
@@ -342,18 +342,26 @@
                                   FALSE,
                                   &cardx, &cardy);
 
-  if (priv->show_highlight && (card_num >= priv->highlight_start)) {
-    cogl_color (&priv->highlight_color);
-  } else {
-    cogl_color (&white);
-  }
-
+  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);
+  }
 }
 
 static void
@@ -385,17 +393,21 @@
     tex_width = cogl_texture_get_width (cogl_tex);
     tex_height = cogl_texture_get_height (cogl_tex);
 
-    if (priv->show_highlight) {
-      cogl_color (&priv->highlight_color);
-    } else {
-      cogl_color (&white);
-    }
-
+    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);
+    }
   }
 
 paint_cards:

Modified: trunk/libgames-support/games-card-theme.c
==============================================================================
--- trunk/libgames-support/games-card-theme.c	(original)
+++ trunk/libgames-support/games-card-theme.c	Tue Jan  6 18:19:57 2009
@@ -473,7 +473,7 @@
   GType type = G_TYPE_INVALID;
   GamesCardThemeInfo *theme_info = NULL;
 
-  if (!theme_name)
+  if (!theme_name || !theme_name[0])
     goto default_fallback;
 
   _games_card_theme_ensure_theme_infos ();



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