[gnome-games/gnibbles-clutter-rebased: 92/129] Some trivial code refactoring, a little animation on the splash screen and ...
- From: Jason Clinton <jclinton src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-games/gnibbles-clutter-rebased: 92/129] Some trivial code refactoring, a little animation on the splash screen and ...
- Date: Mon, 12 Oct 2009 21:33:57 +0000 (UTC)
commit f050ede4a8055afed352788a9fca0527cc0655c7
Author: Guillaume Beland <guillaume beland gmail com>
Date: Sat Aug 8 22:31:40 2009 -0400
Some trivial code refactoring, a little animation on the splash screen and ...
Polishing a little the animation when a worm eat a bonus
gnibbles/board.c | 4 +-
gnibbles/boni.c | 14 ++++------
gnibbles/gnibbles.c | 21 +++++++--------
gnibbles/main.c | 18 ++++++++++++-
gnibbles/warpmanager.c | 2 +-
gnibbles/worm-clutter.c | 65 ++++++++++++++++++++++++-----------------------
6 files changed, 69 insertions(+), 55 deletions(-)
---
diff --git a/gnibbles/board.c b/gnibbles/board.c
index 2bae893..173969d 100644
--- a/gnibbles/board.c
+++ b/gnibbles/board.c
@@ -148,8 +148,8 @@ gnibbles_board_load_level (GnibblesBoard *board)
x_pos = j * properties->tilesize;
clutter_actor_set_size (CLUTTER_ACTOR(tmp),
- properties->tilesize,
- properties->tilesize);
+ properties->tilesize,
+ properties->tilesize);
clutter_actor_set_position (CLUTTER_ACTOR (tmp), x_pos, y_pos);
clutter_actor_show (CLUTTER_ACTOR (tmp));
diff --git a/gnibbles/boni.c b/gnibbles/boni.c
index 866ee7e..d396195 100644
--- a/gnibbles/boni.c
+++ b/gnibbles/boni.c
@@ -64,14 +64,13 @@ gnibbles_boni_destroy (GnibblesBoni * boni)
void
gnibbles_boni_add_bonus (GnibblesBoni * boni, gint t_x, gint t_y,
- gint t_type, gint t_fake, gint t_countdown)
+ gint t_type, gint t_fake, gint t_countdown)
{
if (boni->numbonuses == MAXBONUSES)
return;
boni->bonuses[boni->numbonuses] = gnibbles_bonus_new (t_x, t_y,
t_type, t_fake,
t_countdown);
-
board->walls[t_x][t_y] = t_type = 'A';
board->walls[t_x + 1][t_y] = t_type + 'A';
board->walls[t_x][t_y + 1] = t_type + 'A';
@@ -91,14 +90,13 @@ gnibbles_boni_add_bonus (GnibblesBoni * boni, gint t_x, gint t_y,
void
gnibbles_boni_add_bonus_final (GnibblesBoni * boni, gint t_x, gint t_y,
- gint t_type, gint t_fake, gint t_countdown)
+ gint t_type, gint t_fake, gint t_countdown)
{
if (boni->numbonuses == MAXBONUSES)
return;
- boni->bonuses[boni->numbonuses] = gnibbles_bonus_new (t_x, t_y,
- t_type, t_fake,
- t_countdown);
-
+ boni->bonuses[boni->numbonuses] = gnibbles_bonus_new (t_x, t_y,
+ t_type, t_fake,
+ t_countdown);
board->walls[t_x][t_y] = t_type + 'A';
board->walls[t_x + 1][t_y] = t_type + 'A';
board->walls[t_x][t_y + 1] = t_type + 'A';
@@ -152,7 +150,7 @@ gnibbles_boni_remove_bonus (GnibblesBoni * boni, gint x, gint y)
board->walls[boni->bonuses[i]->x][boni->bonuses[i]->y] = EMPTYCHAR;
board->walls[boni->bonuses[i]->x + 1][boni->bonuses[i]->y] = EMPTYCHAR;
board->walls[boni->bonuses[i]->x][boni->bonuses[i]->y + 1] = EMPTYCHAR;
- board->walls[boni->bonuses[i]->x + 1][boni->bonuses[i]->y + 1] = EMPTYCHAR;
+ board->walls[boni->bonuses[i]->x + 1][boni->bonuses[i]->y + 1] = EMPTYCHAR;
gnibbles_bonus_erase (boni->bonuses[i]);
boni->bonuses[i] = boni->bonuses[--boni->numbonuses];
diff --git a/gnibbles/gnibbles.c b/gnibbles/gnibbles.c
index 3331115..47a3e22 100644
--- a/gnibbles/gnibbles.c
+++ b/gnibbles/gnibbles.c
@@ -151,8 +151,7 @@ gnibbles_load_pixmap (gint tilesize)
g_object_unref (boni_pixmaps[i]);
boni_pixmaps[i] = gnibbles_load_pixmap_file (bonus_files[i],
- 2 * tilesize,
- 2 * tilesize);
+ 2 * tilesize, 2 * tilesize);
}
for (i = 0; i < 11; i++) {
@@ -160,8 +159,7 @@ gnibbles_load_pixmap (gint tilesize)
g_object_unref (wall_pixmaps[i]);
wall_pixmaps[i] = gnibbles_load_pixmap_file (small_files[i],
- tilesize,
- tilesize);
+ 2 * tilesize, 2 * tilesize);
}
for (i = 0; i < 7; i++) {
@@ -169,7 +167,7 @@ gnibbles_load_pixmap (gint tilesize)
g_object_unref (worm_pixmaps[i]);
worm_pixmaps[i] = gnibbles_load_pixmap_file (worm_files[i],
- tilesize, tilesize);
+ tilesize, tilesize);
}
}
@@ -363,7 +361,6 @@ gnibbles_undraw_worms (gint data)
for (i = 0; i < properties->numworms; i++)
gnibbles_worm_reduce_tail (worms[i], data);
- //gnibbles_worm_undraw_nth (worms[i], data);
}
void
@@ -373,7 +370,9 @@ gnibbles_show_scores (GtkWidget * window, gint pos)
gchar *message;
if (!scoresdialog) {
- scoresdialog = games_scores_dialog_new (GTK_WINDOW (window), highscores, _("Nibbles Scores"));
+ scoresdialog = games_scores_dialog_new (GTK_WINDOW (window),
+ highscores,
+ _("Nibbles Scores"));
games_scores_dialog_set_category_description (GAMES_SCORES_DIALOG
(scoresdialog),
_("Speed:"));
@@ -381,15 +380,15 @@ gnibbles_show_scores (GtkWidget * window, gint pos)
if (pos > 0) {
games_scores_dialog_set_hilight (GAMES_SCORES_DIALOG (scoresdialog), pos);
message = g_strdup_printf ("<b>%s</b>\n\n%s",
- _("Congratulations!"),
+ _("Congratulations!"),
pos == 1 ? _("Your score is the best!") :
- _("Your score has made the top ten."));
+ _("Your score has made the top ten."));
games_scores_dialog_set_message (GAMES_SCORES_DIALOG (scoresdialog),
message);
g_free (message);
} else {
games_scores_dialog_set_message (GAMES_SCORES_DIALOG (scoresdialog),
- NULL);
+ NULL);
}
gtk_dialog_run (GTK_DIALOG (scoresdialog));
@@ -423,7 +422,7 @@ gnibbles_log_score (GtkWidget * window)
void
gnibbles_add_spec_bonus (gint t_x, gint t_y,
- gint t_type, gint t_fake, gint t_countdown)
+ gint t_type, gint t_fake, gint t_countdown)
{
gnibbles_boni_add_bonus_final (boni, t_x, t_y, t_type, t_fake, t_countdown);
}
diff --git a/gnibbles/main.c b/gnibbles/main.c
index 5e10df8..86a09a3 100644
--- a/gnibbles/main.c
+++ b/gnibbles/main.c
@@ -916,7 +916,23 @@ render_logo (void)
CLUTTER_ACTOR (text),
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_animate (text, CLUTTER_EASE_OUT_CIRC, 1000,
+ "opacity", 0xff,
+ "scale-x", 1.0,
+ "scale-y", 1.0,
+ "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
+ NULL);
+ clutter_actor_animate (desc, CLUTTER_EASE_OUT_CIRC, 1300,
+ "opacity", 0xff,
+ "scale-x", 1.0,
+ "scale-y", 1.0,
+ "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
+ NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage),
CLUTTER_ACTOR (logo));
}
diff --git a/gnibbles/warpmanager.c b/gnibbles/warpmanager.c
index f5afab3..2f3aad1 100644
--- a/gnibbles/warpmanager.c
+++ b/gnibbles/warpmanager.c
@@ -61,7 +61,7 @@ gnibbles_warpmanager_destroy (GnibblesWarpManager * warpmanager)
void
gnibbles_warpmanager_add_warp (GnibblesWarpManager * warpmanager, gint t_x,
- gint t_y, gint t_wx, gint t_wy)
+ gint t_y, gint t_wx, gint t_wy)
{
gint i, add = 1, draw = 0;
diff --git a/gnibbles/worm-clutter.c b/gnibbles/worm-clutter.c
index cad4aa4..3df553a 100644
--- a/gnibbles/worm-clutter.c
+++ b/gnibbles/worm-clutter.c
@@ -301,37 +301,37 @@ gnibbles_worm_grok_bonus (GnibblesWorm *worm)
games_sound_play ("reverse");
return;
}
-
+
switch (board->walls[worm->xhead][worm->yhead] - 'A') {
- case BONUSREGULAR:
- boni->numleft--;
- worm->change += (NUMBONI - boni->numleft) * GROWFACTOR;
- worm->score += (NUMBONI - boni->numleft) * current_level;
- games_sound_play ("gobble");
- break;
- case BONUSDOUBLE:
- worm->score += (worm->length + worm->change) * current_level;
- worm->change += worm->length + worm->change;
- games_sound_play ("bonus");
- break;
- case BONUSHALF:
- if (worm->length + worm->change > 2) {
- worm->score += ((worm->length + worm->change) / 2) * current_level;
- worm->change -= (worm->length + worm->change) / 2;
+ case BONUSREGULAR:
+ boni->numleft--;
+ worm->change += (NUMBONI - boni->numleft) * GROWFACTOR;
+ worm->score += (NUMBONI - boni->numleft) * current_level;
+ games_sound_play ("gobble");
+ break;
+ case BONUSDOUBLE:
+ worm->score += (worm->length + worm->change) * current_level;
+ worm->change += worm->length + worm->change;
games_sound_play ("bonus");
- }
- break;
- case BONUSLIFE:
- worm->lives += 1;
- games_sound_play ("life");
- break;
- case BONUSREVERSE:
- for (i = 0; i < properties->numworms; i++)
- if (worm != worms[i])
- g_timeout_add (1, (GSourceFunc)
- gnibbles_worm_inverse, worms[i]);
- games_sound_play ("reverse");
- break;
+ break;
+ case BONUSHALF:
+ if (worm->length + worm->change > 2) {
+ worm->score += ((worm->length + worm->change) / 2) * current_level;
+ worm->change -= (worm->length + worm->change) / 2;
+ games_sound_play ("bonus");
+ }
+ break;
+ case BONUSLIFE:
+ worm->lives += 1;
+ games_sound_play ("life");
+ break;
+ case BONUSREVERSE:
+ for (i = 0; i < properties->numworms; i++)
+ if (worm != worms[i])
+ g_timeout_add (1, (GSourceFunc)
+ gnibbles_worm_inverse, worms[i]);
+ games_sound_play ("reverse");
+ break;
}
}
@@ -361,7 +361,7 @@ gnibbles_worm_reset (ClutterAnimation *animation, gpointer data)
gnibbles_worm_move_head_pointer (worm);
gnibbles_worm_show (worm);
}
- /* DEBUG */
+ /* DEBUG *//*
gint i;
FILE *fo;
fo = fopen ("output.txt", "w" );
@@ -375,6 +375,7 @@ gnibbles_worm_reset (ClutterAnimation *animation, gpointer data)
fprintf (fo, "\n");
}
fclose (fo);
+ */
}
static void
@@ -387,8 +388,8 @@ gnibbles_worm_handle_bonus (GnibblesWorm *worm)
gnibbles_worm_grok_bonus (worm);
actor = gnibbles_worm_get_head_actor (worm);
- clutter_actor_animate (actor, CLUTTER_LINEAR, 220,
- "scale-x", 1.45, "scale-y", 1.45,
+ clutter_actor_animate (actor, CLUTTER_EASE_OUT_QUINT, 220,
+ "scale-x", 1.35, "scale-y", 1.35,
"fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]