[gnome-games/gnibbles-clutter] Animation tweak and minor fix
- From: Guillaume Béland <guillaubel src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-games/gnibbles-clutter] Animation tweak and minor fix
- Date: Wed, 19 Aug 2009 23:18:09 +0000 (UTC)
commit a53f4cce28727a6a82ba4a6e23b038ce3fdbc1d6
Author: Guillaume Beland <guillaume beland gmail com>
Date: Wed Aug 19 19:17:16 2009 -0400
Animation tweak and minor fix
gnibbles/gnibbles.c | 6 +++---
gnibbles/gnibbles.h | 2 +-
gnibbles/main.c | 33 ++++++++++++++++++---------------
gnibbles/worm.c | 6 +++---
4 files changed, 25 insertions(+), 22 deletions(-)
---
diff --git a/gnibbles/gnibbles.c b/gnibbles/gnibbles.c
index 481858b..24660d4 100644
--- a/gnibbles/gnibbles.c
+++ b/gnibbles/gnibbles.c
@@ -182,14 +182,14 @@ gnibbles_error (gchar *message)
}
void
-gnibbles_load_logo (void)
+gnibbles_load_logo (gint tilesize)
{
if (logo_pixmap)
g_object_unref (logo_pixmap);
logo_pixmap = gnibbles_load_pixmap_file ("gnibbles-logo.svg",
- board->width * properties->tilesize,
- board->height * properties->tilesize);
+ board->width * tilesize,
+ board->height * tilesize);
}
void
diff --git a/gnibbles/gnibbles.h b/gnibbles/gnibbles.h
index 3052385..1795407 100644
--- a/gnibbles/gnibbles.h
+++ b/gnibbles/gnibbles.h
@@ -59,7 +59,7 @@ extern GnibblesWarpManager *warpmanager;
void gnibbles_load_pixmap (gint tilesize);
void gnibbles_error (gchar *message);
-void gnibbles_load_logo (void);
+void gnibbles_load_logo (gint tilesize);
void gnibbles_init (void);
void gnibbles_add_bonus (gint regular);
gint gnibbles_move_worms (void);
diff --git a/gnibbles/main.c b/gnibbles/main.c
index 2cfd585..1038a81 100644
--- a/gnibbles/main.c
+++ b/gnibbles/main.c
@@ -282,6 +282,7 @@ configure_event_cb (GtkWidget *widget, GdkEventConfigure *event, gpointer data)
int i;
gnibbles_load_pixmap (tilesize);
+ gnibbles_load_logo (tilesize);
if (game_running ()) {
if (board) {
@@ -302,14 +303,12 @@ configure_event_cb (GtkWidget *widget, GdkEventConfigure *event, gpointer data)
/* But, has the tile size changed? */
if (properties->tilesize == tilesize) {
/* We must always re-load the logo. */
- gnibbles_load_logo ();
+ gnibbles_load_logo (tilesize);
return FALSE;
}
properties->tilesize = tilesize;
gnibbles_properties_set_tile_size (tilesize);
-
- gnibbles_load_logo ();
return FALSE;
}
@@ -912,7 +911,7 @@ render_logo (void)
clutter_actor_get_size (CLUTTER_ACTOR (stage), &width, &height);
if (!logo_pixmap)
- gnibbles_load_logo ();
+ gnibbles_load_logo (properties->tilesize);
image = gtk_clutter_texture_new_from_pixbuf (logo_pixmap);
@@ -921,12 +920,15 @@ render_logo (void)
clutter_actor_show (image);
text = clutter_text_new_full ("Sans Bold 70", _("Nibbles"), &actor_color);
- clutter_actor_set_position (CLUTTER_ACTOR (text), (width / 2) - 200, height - 130);
- clutter_actor_show (text);
+ clutter_actor_set_position (CLUTTER_ACTOR (text),
+ (width / 2) - 200,
+ height - 130);
- desc = clutter_text_new_full ("Sans Bold 18", _("A worm game for GNOME."), &actor_color);
- clutter_actor_set_position (CLUTTER_ACTOR (desc), (width / 2) - 170, height - 40);
- clutter_actor_show (desc);
+ desc = clutter_text_new_full ("Sans Bold 18", _("A worm game for GNOME."),
+ &actor_color);
+ clutter_actor_set_position (CLUTTER_ACTOR (desc),
+ (width / 2) - 170,
+ height - 40);
clutter_container_add (CLUTTER_CONTAINER (logo),
CLUTTER_ACTOR (image),
@@ -934,10 +936,10 @@ render_logo (void)
CLUTTER_ACTOR (desc),
NULL);
- clutter_actor_set_opacity (desc, 0);
- clutter_actor_set_opacity (text, 0);
- clutter_actor_set_scale (text, 0.0, 0.0);
- clutter_actor_set_scale (desc, 0.0, 0.0);
+ clutter_actor_set_opacity (CLUTTER_ACTOR (desc), 0);
+ clutter_actor_set_opacity (CLUTTER_ACTOR (text), 0);
+ clutter_actor_set_scale (CLUTTER_ACTOR (text), 0.0, 0.0);
+ clutter_actor_set_scale (CLUTTER_ACTOR (desc), 0.0, 0.0);
clutter_actor_animate (text, CLUTTER_EASE_OUT_CIRC, 1000,
"opacity", 0xff,
"scale-x", 1.0,
@@ -951,13 +953,14 @@ render_logo (void)
"fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage),
- CLUTTER_ACTOR (logo));
+ CLUTTER_ACTOR (logo));
}
static void
on_hide_logo_completed (ClutterAnimation *animation, ClutterActor *actor)
{
clutter_actor_hide (actor);
+ clutter_group_remove_all (CLUTTER_GROUP (actor));
}
static void
@@ -1018,7 +1021,7 @@ main (int argc, char **argv)
setup_window ();
gnibbles_load_pixmap (properties->tilesize);
- gnibbles_load_logo ();
+ gnibbles_load_logo (properties->tilesize);
#ifdef GGZ_CLIENT
network_init ();
diff --git a/gnibbles/worm.c b/gnibbles/worm.c
index 757c9ad..0f8d1b4 100644
--- a/gnibbles/worm.c
+++ b/gnibbles/worm.c
@@ -531,8 +531,8 @@ void
gnibbles_worm_show (GnibblesWorm *worm)
{
clutter_actor_set_opacity (worm->actors, 0);
- clutter_actor_set_scale (worm->actors, 4.0, 4.0);
- clutter_actor_animate (worm->actors, CLUTTER_EASE_OUT_CIRC, 510,
+ clutter_actor_set_scale (worm->actors, 3.0, 3.0);
+ clutter_actor_animate (worm->actors, CLUTTER_EASE_OUT_CIRC, 910,
"scale-x", 1.0,
"scale-y", 1.0,
"fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
@@ -687,7 +687,7 @@ gnibbles_worm_reduce_tail (GnibblesWorm *worm, gint erasesize)
worm->length -= erasesize;
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
- clutter_actor_animate (group, CLUTTER_EASE_OUT_ELASTIC, 450,
+ clutter_actor_animate (group, CLUTTER_EASE_OUT_ELASTIC, 850,
"opacity", 0,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]