[gnome-games/gnibbles-clutter] Fixed gnibbles_worm_reset(), Worm now restart properly after death
- From: Guillaume Béland <guillaubel src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games/gnibbles-clutter] Fixed gnibbles_worm_reset(), Worm now restart properly after death
- Date: Fri, 17 Jul 2009 16:34:33 +0000 (UTC)
commit 4f6eed5241d2dbfddfc74fab5eda5cab35c7b2bf
Author: Guillaume Beland <guillaume beland gmail com>
Date: Fri Jul 17 12:31:47 2009 -0400
Fixed gnibbles_worm_reset(), Worm now restart properly after death
gnibbles/main.c | 11 ++++++-----
gnibbles/worm-clutter.c | 20 ++++++++++++--------
2 files changed, 18 insertions(+), 13 deletions(-)
---
diff --git a/gnibbles/main.c b/gnibbles/main.c
index 3230684..5f579ed 100644
--- a/gnibbles/main.c
+++ b/gnibbles/main.c
@@ -289,7 +289,10 @@ configure_event_cb (GtkWidget * widget, GdkEventConfigure * event, gpointer data
gnibbles_worm_resize (worms[i], tilesize);
}
} else {
- //render_logo ();
+ if (logo)
+ hide_logo ();
+
+ render_logo ();
}
/* But, has the tile size changed? */
@@ -865,8 +868,7 @@ setup_window ()
static void
render_logo (void)
-{
-
+{
gfloat width, height;
ClutterActor *image;
ClutterActor *text;
@@ -904,6 +906,7 @@ render_logo (void)
clutter_container_add_actor (CLUTTER_CONTAINER (stage),
CLUTTER_ACTOR (logo));
}
+
static void
on_hide_logo_completed (ClutterAnimation *animation, ClutterActor *actor)
{
@@ -973,8 +976,6 @@ main (int argc, char **argv)
network_gui_update ();
#endif
- render_logo ();
-
gtk_action_set_sensitive (pause_action, FALSE);
gtk_action_set_sensitive (resume_action, FALSE);
gtk_action_set_sensitive (end_game_action, FALSE);
diff --git a/gnibbles/worm-clutter.c b/gnibbles/worm-clutter.c
index 51f4510..5ca29d8 100644
--- a/gnibbles/worm-clutter.c
+++ b/gnibbles/worm-clutter.c
@@ -325,7 +325,7 @@ gnibbles_worm_new (guint number, guint t_xhead,
guint t_yhead, gint t_direction)
{
GnibblesWorm *worm = g_new (GnibblesWorm, 1);
-
+
worm->actors = clutter_group_new ();
worm->list = NULL;
worm->number = number;
@@ -438,8 +438,10 @@ gnibbles_worm_destroy (GnibblesWorm *worm)
while (worm->list)
gnibbles_worm_remove_actor (worm);
- g_list_free (worm->list);
- //g_free (worm->actors);
+ if (worm->list)
+ g_list_free (worm->list);
+
+ g_free (worm);
}
void
@@ -501,11 +503,13 @@ gnibbles_worm_reset (GnibblesWorm * worm)
gnibbles_worm_remove_actor (worm);
}
- worms[worm->number] = gnibbles_worm_new (worm->number,
- worm->xstart,
- worm->ystart,
- worm->direction_start);
- gnibbles_worm_destroy (worm);
+ worm->xhead = worm->xstart;
+ worm->yhead = worm->ystart;
+ worm->xtail = worm->xhead;
+ worm->ytail = worm->yhead;
+ worm->direction = worm->direction_start;
+
+ gnibbles_worm_add_actor (worm);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]