[atomix/wip/gtk3-port] Moved the remaining canvas helpers to board
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [atomix/wip/gtk3-port] Moved the remaining canvas helpers to board
- Date: Sun, 11 Jan 2015 11:28:20 +0000 (UTC)
commit 4973d1576dfd1258d3fb67eceb7490558e1d2546
Author: Robert Roth <robert roth off gmail com>
Date: Sun Jan 11 13:18:51 2015 +0200
Moved the remaining canvas helpers to board
src/board.c | 35 +++++++++++++++++++++++++++++++----
src/canvas_helper.c | 29 -----------------------------
src/canvas_helper.h | 6 ------
3 files changed, 31 insertions(+), 39 deletions(-)
---
diff --git a/src/board.c b/src/board.c
index 37516e8..f3ac768 100644
--- a/src/board.c
+++ b/src/board.c
@@ -131,6 +131,35 @@ static void selector_arrows_hide (SelectorData *data);
#define BGR_FLOOR_ROWS 15
#define BGR_FLOOR_COLS 15
+static GnomeCanvasGroup *create_group (GnomeCanvas *canvas, GnomeCanvasGroup *parent)
+{
+ GnomeCanvasGroup *group;
+
+ if (parent == NULL)
+ {
+ parent = gnome_canvas_root (canvas);
+ }
+ group = GNOME_CANVAS_GROUP (gnome_canvas_item_new (parent,
+ gnome_canvas_group_get_type
+ (), "x", 0.0, "y", 0.0,
+ NULL));
+ return group;
+}
+
+static void set_background_color (GtkWidget *canvas, GdkColor *color)
+{
+ /* try to alloc color */
+ if (gdk_colormap_alloc_color (gdk_colormap_get_system (), color, FALSE, TRUE))
+ {
+ GtkStyle *style;
+ style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (canvas)));
+
+ /* set new style */
+ style->bg[GTK_STATE_NORMAL] = *color;
+ gtk_widget_set_style (GTK_WIDGET (canvas), style);
+ }
+}
+
static void create_background_floor (void)
{
int row, col;
@@ -422,17 +451,15 @@ static void render_tile (Tile *tile, gint row, gint col)
group = level_items->obstacles;
break;
- case TILE_TYPE_FLOOR:
- group = NULL; /* level_items->floor; */
- break;
-
case TILE_TYPE_SHADOW:
group = level_items->shadows;
break;
case TILE_TYPE_UNKNOWN:
+ case TILE_TYPE_FLOOR:
default:
group = NULL;
+ break;
}
if (group != NULL)
diff --git a/src/canvas_helper.c b/src/canvas_helper.c
index 5d9e866..e562f20 100644
--- a/src/canvas_helper.c
+++ b/src/canvas_helper.c
@@ -20,20 +20,6 @@
#include "math.h"
#include "canvas_helper.h"
-void set_background_color (GtkWidget *canvas, GdkColor *color)
-{
- /* try to alloc color */
- if (gdk_colormap_alloc_color (gdk_colormap_get_system (), color, FALSE, TRUE))
- {
- GtkStyle *style;
- style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (canvas)));
-
- /* set new style */
- style->bg[GTK_STATE_NORMAL] = *color;
- gtk_widget_set_style (GTK_WIDGET (canvas), style);
- }
-}
-
void convert_to_playfield (Theme *theme, gdouble x, gdouble y,
guint *row, guint *col)
{
@@ -59,18 +45,3 @@ void convert_to_canvas (Theme *theme, guint row, guint col,
*x = col * tile_width;
*y = row * tile_height;
}
-
-GnomeCanvasGroup *create_group (GnomeCanvas *canvas, GnomeCanvasGroup *parent)
-{
- GnomeCanvasGroup *group;
-
- if (parent == NULL)
- {
- parent = gnome_canvas_root (canvas);
- }
- group = GNOME_CANVAS_GROUP (gnome_canvas_item_new (parent,
- gnome_canvas_group_get_type
- (), "x", 0.0, "y", 0.0,
- NULL));
- return group;
-}
diff --git a/src/canvas_helper.h b/src/canvas_helper.h
index fba3eae..51e6214 100644
--- a/src/canvas_helper.h
+++ b/src/canvas_helper.h
@@ -20,9 +20,6 @@
#define _ATOMIX_CANVAS_HELPER_H_
#include "theme.h"
-#include <libgnomecanvas/libgnomecanvas.h>
-
-void set_background_color (GtkWidget * canvas, GdkColor * color);
void convert_to_playfield (Theme * theme, gdouble x, gdouble y,
guint * row, guint * col);
@@ -30,7 +27,4 @@ void convert_to_playfield (Theme * theme, gdouble x, gdouble y,
void convert_to_canvas (Theme * theme, guint row, guint col,
gdouble * x, gdouble * y);
-GnomeCanvasGroup *create_group (GnomeCanvas * canvas,
- GnomeCanvasGroup * parent);
-
#endif /* _ATOMIX_CANVAS_HELPER_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]