[gnome-games/gnibbles-clutter] Trivial code refactoring



commit 76375dbe8e43825487d19a2c69c7c3339af99afb
Author: Guillaume Beland <guillaume beland gmail com>
Date:   Tue Sep 1 19:01:31 2009 -0400

    Trivial code refactoring

 gnibbles/board.c       |   16 ++++++++--------
 gnibbles/board.h       |    2 +-
 gnibbles/boni.c        |    6 +++---
 gnibbles/boni.h        |    2 +-
 gnibbles/main.c        |    8 ++++----
 gnibbles/warpmanager.c |    6 +++---
 gnibbles/warpmanager.h |    2 +-
 gnibbles/worm.c        |    6 +++---
 gnibbles/worm.h        |    2 +-
 9 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/gnibbles/board.c b/gnibbles/board.c
index 59618cf..165ec0d 100644
--- a/gnibbles/board.c
+++ b/gnibbles/board.c
@@ -175,7 +175,7 @@ gnibbles_board_load_level (GnibblesBoard *board)
 }
 
 void
-gnibbles_board_resize (GnibblesBoard *board, gint newtile)
+gnibbles_board_rescale (GnibblesBoard *board, gint tilesize)
 {
   if (!board->level)
     return;
@@ -190,11 +190,11 @@ gnibbles_board_resize (GnibblesBoard *board, gint newtile)
   ClutterActor *tmp;
 
   clutter_actor_set_size (CLUTTER_ACTOR (stage), 
-                          BOARDWIDTH * newtile,
-                          BOARDHEIGHT * newtile);
+                          BOARDWIDTH * tilesize,
+                          BOARDHEIGHT * tilesize);
   clutter_actor_set_size (CLUTTER_ACTOR (board->surface),
-                          BOARDWIDTH * newtile,
-                          BOARDHEIGHT * newtile);
+                          BOARDWIDTH * tilesize,
+                          BOARDHEIGHT * tilesize);
 
   count = clutter_group_get_n_children (CLUTTER_GROUP (board->level));
 
@@ -202,9 +202,9 @@ gnibbles_board_resize (GnibblesBoard *board, gint newtile)
     tmp = clutter_group_get_nth_child (CLUTTER_GROUP (board->level), i);
     clutter_actor_get_position (CLUTTER_ACTOR (tmp), &x_pos, &y_pos);
     clutter_actor_set_position (CLUTTER_ACTOR (tmp),
-                                (x_pos / properties->tilesize) * newtile,
-                                (y_pos / properties->tilesize) * newtile);
-    clutter_actor_set_size (CLUTTER_ACTOR (tmp), newtile, newtile);
+                                (x_pos / properties->tilesize) * tilesize,
+                                (y_pos / properties->tilesize) * tilesize);
+    clutter_actor_set_size (CLUTTER_ACTOR (tmp), tilesize, tilesize);
   }
 }
 
diff --git a/gnibbles/board.h b/gnibbles/board.h
index aab7b1a..f8cf990 100644
--- a/gnibbles/board.h
+++ b/gnibbles/board.h
@@ -45,7 +45,7 @@ typedef struct {
 } GnibblesBoard;
 
 GnibblesBoard* gnibbles_board_new (void);
-void gnibbles_board_resize (GnibblesBoard *board, gint newtile);
+void gnibbles_board_rescale (GnibblesBoard *board, gint tilesize);
 void gnibbles_board_level_new (GnibblesBoard *board, gint level);
 void gnibbles_board_level_add_bonus (GnibblesBoard *board, gint regular);
 
diff --git a/gnibbles/boni.c b/gnibbles/boni.c
index a537b3c..aafbbb2 100644
--- a/gnibbles/boni.c
+++ b/gnibbles/boni.c
@@ -192,7 +192,7 @@ gnibbles_boni_remove_bonus_final (GnibblesBoni * boni, gint x, gint y)
 }
 
 void 
-gnibbles_boni_resize (GnibblesBoni *boni, gint newtile)
+gnibbles_boni_rescale (GnibblesBoni *boni, gint tilesize)
 {
   int i;
   gfloat x_pos, y_pos;  
@@ -201,8 +201,8 @@ gnibbles_boni_resize (GnibblesBoni *boni, gint newtile)
   for (i = 0; i < boni->numbonuses; i++) {
     clutter_actor_get_position (boni->bonuses[i]->actor, &x_pos, &y_pos);
     clutter_actor_set_position (boni->bonuses[i]->actor,
-                                (x_pos / properties->tilesize) * newtile,
-                                (y_pos / properties->tilesize) * newtile);
+                                (x_pos / properties->tilesize) * tilesize,
+                                (y_pos / properties->tilesize) * tilesize);
     gtk_clutter_texture_set_from_pixbuf (CLUTTER_TEXTURE(boni->bonuses[i]->actor), 
                                          boni_pixmaps[boni->bonuses[i]->type],
                                          &err);
diff --git a/gnibbles/boni.h b/gnibbles/boni.h
index 0502c4a..dc7e14f 100644
--- a/gnibbles/boni.h
+++ b/gnibbles/boni.h
@@ -51,6 +51,6 @@ void gnibbles_boni_remove_bonus_final (GnibblesBoni * boni, gint x, gint y);
 
 int gnibbles_boni_fake (GnibblesBoni * boni, gint x, gint y);
 
-void gnibbles_boni_resize (GnibblesBoni *boni, gint newtile);
+void gnibbles_boni_rescale (GnibblesBoni *boni, gint tilesize);
 
 #endif
diff --git a/gnibbles/main.c b/gnibbles/main.c
index bb20ba2..50cefae 100644
--- a/gnibbles/main.c
+++ b/gnibbles/main.c
@@ -284,12 +284,12 @@ configure_event_cb (GtkWidget *widget, GdkEventConfigure *event, gpointer data)
 
   if (game_running ()) {
     if (board) {
-      gnibbles_board_resize (board, tilesize);
-      gnibbles_boni_resize (boni, tilesize);
+      gnibbles_board_rescale (board, tilesize);
+      gnibbles_boni_rescale (boni, tilesize);
       if (warpmanager)
-        gnibbles_warpmanager_resize (warpmanager, tilesize);
+        gnibbles_warpmanager_rescale (warpmanager, tilesize);
       for (i=0; i<properties->numworms; i++)
-        gnibbles_worm_resize (worms[i], tilesize);
+        gnibbles_worm_rescale (worms[i], tilesize);
     }
   } else {
     if (logo)
diff --git a/gnibbles/warpmanager.c b/gnibbles/warpmanager.c
index a13c857..55146cc 100644
--- a/gnibbles/warpmanager.c
+++ b/gnibbles/warpmanager.c
@@ -218,7 +218,7 @@ gnibbles_warpmanager_worm_change_tail_pos (GnibblesWarpManager * warpmanager,
 }
 
 void 
-gnibbles_warpmanager_resize (GnibblesWarpManager *warpmanager, gint newtile)
+gnibbles_warpmanager_rescale (GnibblesWarpManager *warpmanager, gint tilesize)
 {
   int i;
   gfloat x_pos, y_pos;  
@@ -227,8 +227,8 @@ gnibbles_warpmanager_resize (GnibblesWarpManager *warpmanager, gint newtile)
   for (i = 0; i < warpmanager->numwarps; i++) {
     clutter_actor_get_position (warpmanager->warps[i]->actor, &x_pos, &y_pos);
     clutter_actor_set_position (warpmanager->warps[i]->actor,
-                                (x_pos / properties->tilesize) * newtile,
-                                (y_pos / properties->tilesize) * newtile);
+                                (x_pos / properties->tilesize) * tilesize,
+                                (y_pos / properties->tilesize) * tilesize);
     gtk_clutter_texture_set_from_pixbuf 
       (CLUTTER_TEXTURE (warpmanager->warps[i]->actor), boni_pixmaps[WARP], &err);
     if (err)
diff --git a/gnibbles/warpmanager.h b/gnibbles/warpmanager.h
index 0edce7f..54caceb 100644
--- a/gnibbles/warpmanager.h
+++ b/gnibbles/warpmanager.h
@@ -43,7 +43,7 @@ void gnibbles_warpmanager_worm_change_pos (GnibblesWarpManager *warpmanager,
 					                                 GnibblesWorm *worm);
 void gnibbles_warpmanager_worm_change_tail_pos (GnibblesWarpManager *warpmanager,
                                                 GnibblesWorm *worm);
-void gnibbles_warpmanager_resize (GnibblesWarpManager *warpmanager, 
+void gnibbles_warpmanager_rescale (GnibblesWarpManager *warpmanager, 
                                   gint tilesize);
 
 #endif
diff --git a/gnibbles/worm.c b/gnibbles/worm.c
index dc5d502..78ad6ce 100644
--- a/gnibbles/worm.c
+++ b/gnibbles/worm.c
@@ -638,7 +638,7 @@ gnibbles_worm_destroy (GnibblesWorm *worm)
 }
 
 void 
-gnibbles_worm_resize (GnibblesWorm *worm, gint newtile)
+gnibbles_worm_rescale (GnibblesWorm *worm, gint tilesize)
 {
   if (!worm)
     return;
@@ -658,8 +658,8 @@ gnibbles_worm_resize (GnibblesWorm *worm, gint newtile)
     clutter_actor_get_position (tmp, &x_pos, &y_pos);
 
     clutter_actor_set_position (tmp,
-                                (x_pos / properties->tilesize) * newtile,
-                                (y_pos / properties->tilesize) * newtile);
+                                (x_pos / properties->tilesize) * tilesize,
+                                (y_pos / properties->tilesize) * tilesize);
 
     gtk_clutter_texture_set_from_pixbuf (
        CLUTTER_TEXTURE (tmp), 
diff --git a/gnibbles/worm.h b/gnibbles/worm.h
index 5dadeda..f847e63 100644
--- a/gnibbles/worm.h
+++ b/gnibbles/worm.h
@@ -67,7 +67,7 @@ void gnibbles_worm_move_head_pointer (GnibblesWorm *worm);
 
 void gnibbles_worm_destroy (GnibblesWorm * worm);
 
-void gnibbles_worm_resize (GnibblesWorm *worm, gint newtile);
+void gnibbles_worm_rescale (GnibblesWorm *worm, gint tilesize);
 
 void gnibbles_worm_reset (GnibblesWorm *worm);
 void gnibbles_worm_move_head (GnibblesWorm *worm);



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