[gnome-games/gnibbles-clutter] Added clutter support in bonus.[ch]
- From: Guillaume Béland <guillaubel src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games/gnibbles-clutter] Added clutter support in bonus.[ch]
- Date: Sat, 20 Jun 2009 22:12:45 -0400 (EDT)
commit ff1f53d6e66f8ab505552a34ca4a21aee5eb26d6
Author: Guillaume Beland <guillaume beland gmail com>
Date: Sat Jun 20 21:43:27 2009 -0400
Added clutter support in bonus.[ch]
gnibbles/bonus.c | 15 +++++++++++++++
gnibbles/bonus.h | 2 ++
gnibbles/main.c | 1 -
3 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/gnibbles/bonus.c b/gnibbles/bonus.c
index 2d7d80f..89fe8f5 100644
--- a/gnibbles/bonus.c
+++ b/gnibbles/bonus.c
@@ -22,9 +22,15 @@
#include <stdlib.h>
#include <gtk/gtk.h>
+#include <clutter/clutter.h>
+#include <clutter-gtk/clutter-gtk.h>
#include "gnibbles.h"
#include "bonus.h"
+#include "properties.h"
+
+extern GdkPixbuf *boni_pixmaps[];
+extern GnibblesProperties *properties;
GnibblesBonus *
gnibbles_bonus_new (gint t_x, gint t_y, gint t_type,
@@ -39,6 +45,7 @@ gnibbles_bonus_new (gint t_x, gint t_y, gint t_type,
tmp->type = t_type;
tmp->fake = t_fake;
tmp->countdown = t_countdown;
+ tmp->actor = clutter_texture_new ();
return (tmp);
}
@@ -46,6 +53,12 @@ gnibbles_bonus_new (gint t_x, gint t_y, gint t_type,
void
gnibbles_bonus_draw (GnibblesBonus * bonus)
{
+ gtk_clutter_texture_set_from_pixbuf (CLUTTER_TEXTURE (bonus->actor),
+ boni_pixmaps[bonus->type]);
+ clutter_actor_set_position (CLUTTER_ACTOR (bonus->actor),
+ bonus->x * properties->tilesize,
+ bonus->y * properties->tilesize);
+
gnibbles_draw_big_pixmap (bonus->type, bonus->x, bonus->y);
}
@@ -54,5 +67,7 @@ gnibbles_bonus_erase (GnibblesBonus * bonus)
{
gnibbles_draw_big_pixmap (BONUSNONE, bonus->x, bonus->y);
+ clutter_actor_hide (bonus->actor);
+
free (bonus);
}
diff --git a/gnibbles/bonus.h b/gnibbles/bonus.h
index 19505ae..ab79d86 100644
--- a/gnibbles/bonus.h
+++ b/gnibbles/bonus.h
@@ -23,6 +23,7 @@
#include <config.h>
#include <gtk/gtk.h>
+#include <clutter/clutter.h>
#define BONUSNONE 0
#define BONUSREGULAR 1
@@ -38,6 +39,7 @@ typedef struct {
guint type;
gint fake;
gint countdown;
+ ClutterActor *actor;
} GnibblesBonus;
GnibblesBonus *gnibbles_bonus_new (gint t_x, gint t_y, gint t_type,
diff --git a/gnibbles/main.c b/gnibbles/main.c
index 86b38ec..d0fe1a4 100644
--- a/gnibbles/main.c
+++ b/gnibbles/main.c
@@ -1259,7 +1259,6 @@ move_worm_cb (ClutterTimeline *timeline, gint msecs, gpointer data)
const int elapsed_time = clutter_timeline_get_elapsed_time (timeline);
const int duration = clutter_timeline_get_duration (timeline);
-
if (!(elapsed_time == duration))
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]