[gnome-games/gnibbles-clutter] Not using a timeline to call the move_worm_cb () function plus some fixes
- From: Guillaume Béland <guillaubel src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games/gnibbles-clutter] Not using a timeline to call the move_worm_cb () function plus some fixes
- Date: Mon, 6 Jul 2009 15:41:03 +0000 (UTC)
commit 852d015682551650d592614f592dbff1428941a7
Author: Guillaume Beland <guillaubel svn gnome org>
Date: Mon Jul 6 11:39:38 2009 -0400
Not using a timeline to call the move_worm_cb () function plus some fixes
now using a simple g_timeout_add (), this way also preserve original parameters
such as gamespeed
gnibbles/level.c | 8 +++++++-
gnibbles/main.c | 23 +++++------------------
2 files changed, 12 insertions(+), 19 deletions(-)
---
diff --git a/gnibbles/level.c b/gnibbles/level.c
index 5c25cd9..5c3a336 100644
--- a/gnibbles/level.c
+++ b/gnibbles/level.c
@@ -27,11 +27,12 @@
#include "worm-clutter.h"
#include "main.h"
#include "properties.h"
+#include "boni.h"
extern GnibblesCWorm *cworms[];
extern GnibblesProperties *properties;
extern GnibblesWarpManager *warpmanager;
-
+extern GnibblesBoni *boni;
GnibblesLevel *
gnibbles_level_new (gint level)
{
@@ -61,6 +62,11 @@ gnibbles_level_new (gint level)
g_free (message);
}
+ if (boni)
+ gnibbles_boni_destroy (boni);
+
+ boni = gnibbles_boni_new ();
+
for (i = 0; i < properties->numworms; i++)
if (cworms[i])
gnibbles_cworm_destroy (cworms[i]);
diff --git a/gnibbles/main.c b/gnibbles/main.c
index b3052b0..defe013 100644
--- a/gnibbles/main.c
+++ b/gnibbles/main.c
@@ -516,14 +516,8 @@ new_game_2_cb (GtkWidget * widget, gpointer data)
}
static void
-move_worm_cb (ClutterTimeline *timeline, gint msecs, gpointer data)
+move_worm_cb (void)
{
- const int elapsed_time = clutter_timeline_get_elapsed_time (timeline);
- const int duration = clutter_timeline_get_duration (timeline);
-
- if (!(elapsed_time == duration))
- return;
-
gint i, olddir, length, nbr_actor;
for (i = 0; i < properties->numworms; i++) {
@@ -563,7 +557,7 @@ move_worm_cb (ClutterTimeline *timeline, gint msecs, gpointer data)
else
gnibbles_cworm_move_head (cworms[i]);
} else if (nbr_actor < 1) {
- //worm's dead
+ //worm's dead, do something clever about it...
return;
}
}
@@ -597,7 +591,7 @@ new_game_clutter (void)
hide_logo ();
level = gnibbles_level_new (current_level);
gnibbles_board_load_level (clutter_board, level);
- //gnibbles_clutter_add_bonus (1);
+ gnibbles_clutter_add_bonus (1);
gnibbles_clutter_init ();
paused = 0;
@@ -625,14 +619,6 @@ new_game_clutter (void)
dummy_id = g_timeout_add_seconds (1, (GSourceFunc) new_game_clutter_2_cb, NULL);
-
- ClutterTimeline *timeline = clutter_timeline_new (115);
- clutter_timeline_set_loop (timeline, TRUE);
-
- g_signal_connect (timeline, "new-frame", G_CALLBACK (move_worm_cb), NULL);
-
- clutter_timeline_start (timeline);
-
network_gui_update ();
return TRUE;
@@ -865,7 +851,8 @@ main_loop (gpointer data)
gint tmp, winner;
gchar *str = NULL;
- status = gnibbles_move_worms ();
+ //status = gnibbles_move_worms ();
+ move_worm_cb ();
gnibbles_scoreboard_update (scoreboard);
if (status == VICTORY) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]