diff options
author | Laurent Ghigonis <laurent@p1sec.com> | 2012-11-03 16:16:09 +0100 |
---|---|---|
committer | Laurent Ghigonis <laurent@p1sec.com> | 2012-11-03 16:16:09 +0100 |
commit | 39a48dae6aac00d2bb289b80f754ee328b86b83a (patch) | |
tree | de797cf684864f0e0aef40eef76410e9863ae0a3 | |
parent | preliminary work on elife. (diff) | |
download | glouglou-39a48dae6aac00d2bb289b80f754ee328b86b83a.tar.xz glouglou-39a48dae6aac00d2bb289b80f754ee328b86b83a.zip |
fix pointers
-rw-r--r-- | src/elife_evas_smart.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/elife_evas_smart.c b/src/elife_evas_smart.c index 9cbd6b7..f7f53cf 100644 --- a/src/elife_evas_smart.c +++ b/src/elife_evas_smart.c @@ -3,9 +3,6 @@ #include "elife_evas_smart.h" -#define BG 0xff002b36 -#define FG 0xff839496 - #define MIN(a,b) (((a)<(b))?(a):(b)) static void cell_mouse_down(void *data, Evas *evas, Evas_Object *child, void *event_info); @@ -52,7 +49,7 @@ struct cell { }; struct grid { - struct cell ***grid; + struct cell **cells; Evas_Object *obj; int w, h; int age; @@ -78,10 +75,10 @@ grid_new(Evas_Object *container, int w, int h) int i, j; g = xmalloc(sizeof(struct grid)); - g->grid = xmalloc(sizeof(struct cell *) * w * h); + g->cells = xmalloc(sizeof(struct cell) * w * h); for (i=0; i<w; i++) { for (j=0; j<h; j++) { - cell = xmalloc(sizeof(struct cell)); + cell = &(g->cells[(i*j) + j]); o = evas_object_image_filled_add(evas_object_evas_get(container)); if (!o) err(1, "Cannot create evas_object for cell"); @@ -97,7 +94,6 @@ grid_new(Evas_Object *container, int w, int h) cell); cell->obj = o; cell->age = 0; - g->grid[i][j] = cell; evas_object_smart_member_add(o, container); } } @@ -129,7 +125,7 @@ grid_redraw(struct grid *grid) for (i=0; i<grid->w; i++) { for (j=0; j<grid->h; j++) { - cell = grid->grid[i][j]; + cell = &(grid->cells[(i*j) + j]); o = cell->obj; evas_object_resize(o, cell_w, cell_h); evas_object_image_fill_set(o, 0, 0, cell_w, cell_h); @@ -178,9 +174,12 @@ static Evas_Object * elife_object_new(Evas *evas) { Evas_Object *elife_object; + struct grid *grid; elife_object = evas_object_smart_add(evas, _elife_object_smart_get()); + grid = grid_new(elife_object, 10, 10); + evas_object_data_set(elife_object, "grid", grid); evas_object_smart_callback_add(elife_object, "refresh", elife_on_refresh, |