[gnome-games/gnibbles-clutter] Some minor code clean-up



commit 34ae081bc976120a2c371657587b0a3024b9d758
Author: Guillaume Beland <guillaume beland gmail com>
Date:   Thu Jul 2 20:41:32 2009 -0400

    Some minor code clean-up

 gnibbles/board.c        |    2 +-
 gnibbles/gnibbles.c     |    1 -
 gnibbles/level.c        |    1 +
 gnibbles/main.c         |   12 +++++-------
 gnibbles/worm-clutter.c |   41 ++++++++++++++++++++---------------------
 gnibbles/worm-clutter.h |   21 ++++++---------------
 6 files changed, 33 insertions(+), 45 deletions(-)
---
diff --git a/gnibbles/board.c b/gnibbles/board.c
index 1266a41..158c294 100644
--- a/gnibbles/board.c
+++ b/gnibbles/board.c
@@ -26,8 +26,8 @@
 #include <glib/gprintf.h>
 #include <glib/gi18n.h>
 #include <gdk/gdk.h>
-#include <libgames-support/games-runtime.h>
 
+#include <libgames-support/games-runtime.h>
 #include <clutter-gtk/clutter-gtk.h>
 
 #include "main.h"
diff --git a/gnibbles/gnibbles.c b/gnibbles/gnibbles.c
index b6b097e..05203f4 100644
--- a/gnibbles/gnibbles.c
+++ b/gnibbles/gnibbles.c
@@ -44,7 +44,6 @@
 #include "scoreboard.h"
 #include "board.h"
 #include "level.h"
-
 #include "worm-clutter.h"
 
 #ifdef GGZ_CLIENT
diff --git a/gnibbles/level.c b/gnibbles/level.c
index bc65579..5c25cd9 100644
--- a/gnibbles/level.c
+++ b/gnibbles/level.c
@@ -21,6 +21,7 @@
 
 #include <stdlib.h>
 #include <glib/gi18n.h>
+
 #include "level.h"
 #include "gnibbles.h"
 #include "worm-clutter.h"
diff --git a/gnibbles/main.c b/gnibbles/main.c
index cb17f5c..b3052b0 100644
--- a/gnibbles/main.c
+++ b/gnibbles/main.c
@@ -1299,20 +1299,18 @@ render_logo_clutter (void)
   clutter_actor_set_position (CLUTTER_ACTOR (desc), (width / 2) - 170, height - 40);
   clutter_actor_show (desc);
 
-  clutter_container_add (CLUTTER_CONTAINER (stage), 
-                         CLUTTER_ACTOR (logo), 
+  clutter_container_add (CLUTTER_CONTAINER (landing_page),
+                         CLUTTER_ACTOR (logo),
                          CLUTTER_ACTOR (text),
                          CLUTTER_ACTOR (desc),
                          NULL);
+  
+  clutter_container_add_actor (CLUTTER_CONTAINER (stage), 
+                         CLUTTER_ACTOR (landing_page));
   clutter_actor_raise_top (logo);
   clutter_actor_raise (text, logo);
   clutter_actor_raise (desc, logo);
 
-  clutter_container_add (CLUTTER_CONTAINER (landing_page),
-                         CLUTTER_ACTOR (logo),
-                         CLUTTER_ACTOR (text),
-                         CLUTTER_ACTOR (desc),
-                         NULL);
 }
 
 static void
diff --git a/gnibbles/worm-clutter.c b/gnibbles/worm-clutter.c
index d75ca2e..c0cd2fa 100644
--- a/gnibbles/worm-clutter.c
+++ b/gnibbles/worm-clutter.c
@@ -20,14 +20,17 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 #include <config.h>
+
 #include <glib/gprintf.h>
 #include <ctype.h>
 #include <glib/gi18n.h>
 #include <gdk/gdk.h>
 #include <stdlib.h>
 #include <math.h>
+
 #include <libgames-support/games-runtime.h>
 #include <clutter-gtk/clutter-gtk.h>
+
 #include "main.h"
 #include "gnibbles.h"
 #include "level.h"
@@ -35,6 +38,7 @@
 #include "bonus.h"
 #include "warpmanager.h"
 #include "properties.h"
+
 #ifdef GGZ_CLIENT
 #include "ggz-network.h"
 #endif
@@ -53,12 +57,6 @@ typedef struct _key_queue_entry {
   guint dir;
 } key_queue_entry;
 
-static void cworm_handle_direction (int worm, int dir);
-static void cworm_set_direction (int worm, int dir);
-static void gnibbles_worm_dequeue_keypress (GnibblesCWorm *worm);
-static void gnibbles_worm_queue_keypress (GnibblesCWorm *worm, guint dir);
-static void gnibbles_worm_queue_empty (GnibblesCWorm *worm);
-
 static GQueue *key_queue[NUMWORMS] = { NULL, NULL, NULL, NULL };
 
 static void
@@ -85,21 +83,6 @@ gnibbles_worm_queue_keypress (GnibblesCWorm * worm, guint dir)
 }
 
 static void
-cworm_handle_direction (int worm, int dir)
-{
-  if (ggz_network_mode) {
-#ifdef GGZ_CLIENT
-    network_game_move (dir);
-
-    cworms[0]->direction = dir;
-    cworms[0]->keypress = 1;
-#endif
-  } else {
-    cworm_set_direction (worm, dir);
-  }
-}
-
-static void
 cworm_set_direction (int worm, int dir)
 {
 
@@ -125,6 +108,22 @@ cworm_set_direction (int worm, int dir)
 }
 
 static void
+cworm_handle_direction (int worm, int dir)
+{
+  if (ggz_network_mode) {
+#ifdef GGZ_CLIENT
+    network_game_move (dir);
+
+    cworms[0]->direction = dir;
+    cworms[0]->keypress = 1;
+#endif
+  } else {
+    cworm_set_direction (worm, dir);
+  }
+}
+
+
+static void
 gnibbles_worm_queue_empty (GnibblesCWorm * worm)
 {
   key_queue_entry *entry;
diff --git a/gnibbles/worm-clutter.h b/gnibbles/worm-clutter.h
index 21aa0e6..c61892a 100644
--- a/gnibbles/worm-clutter.h
+++ b/gnibbles/worm-clutter.h
@@ -56,40 +56,31 @@ typedef struct {
   gint keypress;
 } GnibblesCWorm;
 
-typedef struct {
-  ClutterActor *actor;
-  gint direction;
-} WormStraight;
-
-typedef struct {
-  ClutterActor *actor;
-  gint direction;
-} WormCorner;
 
-GnibblesCWorm * gnibbles_cworm_new (guint number, guint t_xhead,
-			                    guint t_yhead, gint t_direction); 
+GnibblesCWorm* gnibbles_cworm_new (guint number, guint t_xhead,
+			                             guint t_yhead, gint t_direction);
 gint gnibbles_cworm_handle_keypress (GnibblesCWorm * worm, guint keyval);
-
 void gnibbles_cworm_add_actor (GnibblesCWorm *worm);
 void gnibbles_cworm_remove_actor (GnibblesCWorm *worm);
 void gnibbles_cworm_destroy (GnibblesCWorm * worm);
+
 void gnibbles_cworm_inverse (GnibblesCWorm *worm);
 void gnibbles_cworm_resize (GnibblesCWorm *worm, gint newtile);
 
 void gnibbles_cworm_move_straight_worm (GnibblesCWorm *worm);
 void gnibbles_cworm_move_head (GnibblesCWorm *worm);
 void gnibbles_cworm_move_tail (GnibblesCWorm *worm);
-
-void gnibbles_cworm_grow (GnibblesCWorm *worm);
 void gnibbles_cworm_shrink (GnibblesCWorm *worm, gint shrinksize);
+
 gint gnibbles_cworm_get_length (GnibblesCWorm *worm);
+
 gint gnibbles_cworm_lose_life (GnibblesCWorm * worm);
 
 gint gnibbles_cworm_can_move_to (GnibblesCWorm * worm, gint x, gint y);
 void gnibbles_cworm_position_move_head (GnibblesCWorm * worm, gint *x, gint *y);
 gint gnibbles_cworm_test_move_head (GnibblesCWorm * worm);
 gint gnibbles_cworm_is_move_safe (GnibblesCWorm * worm);
-void gnibbles_cworm_move_tail (GnibblesCWorm * worm);
+
 void gnibbles_cworm_ai_move (GnibblesCWorm * worm);
 
 #endif



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