This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository elimine.

View the commit online.

commit 940c02e4178f319f68ff08c2963b8e9b6aed9ff4
Author: Vincent Torri <vto...@outlook.fr>
AuthorDate: Tue Jul 15 07:20:57 2025 +0200

    fix stupid bug
---
 src/bin/elimine.c | 52 ++++++++++++----------------------------------------
 src/bin/elimine.h | 10 +++++-----
 src/bin/score.c   |  9 +++------
 3 files changed, 20 insertions(+), 51 deletions(-)

diff --git a/src/bin/elimine.c b/src/bin/elimine.c
index c61f9ea..b444dd7 100644
--- a/src/bin/elimine.c
+++ b/src/bin/elimine.c
@@ -11,6 +11,7 @@
 
 #include "icon.h"
 #include "score.h"
+#include "elimine.h"
 
 #define lookup(l, c) (l) * ctx->nc + (c)
 
@@ -29,24 +30,6 @@ typedef enum
     CUSTOM
 } Difficulty;
 
-typedef struct
-{
-    Evas_Object *remain; /* nbr of remaing bombs */
-    Evas_Object *time;
-    Evas_Object *smiley;
-    Evas_Object *grd;
-    Eina_Array *tiles;
-
-    int *state;
-    int *known;
-    int nl; /* number of lines of the board */
-    int nc; /* number of columns of the board */
-    int nm; /* number of remaining mines in the board based on flagged tiles */
-    int pixel_sz; /* size in pixels of a tile */
-
-    Eina_Bool finished;
-} Ctx;
-
 static Evas_Object *cph = NULL;
 static Evas_Object *rect = NULL;
 
@@ -347,19 +330,12 @@ _cb_mouse_up(void *ctx_, Evas *evas EINA_UNUSED, Evas_Object *obj, void *event_i
 }
 
 static void
-_cb_mouse_down(void *ctx_, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+_cb_mouse_down(void *ctx_, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
 {
     Ctx *ctx;
-    Evas_Event_Mouse_Down *ev;
-    int l;
-    int c;
 
     ctx = (Ctx *)ctx_;
 
-    ev = (Evas_Event_Mouse_Down *)event_info;
-    c = ev->output.x / (16 * ctx->pixel_sz);
-    l = (ev->output.y - 32 * ctx->pixel_sz) / (16 * ctx->pixel_sz);
-    TILE(TILE_NOTHING, l, c);
     evas_object_image_data_set(ctx->smiley, smiley_bmp_get(SMILEY_SURPRISED));
     evas_object_image_pixels_dirty_set(ctx->smiley, EINA_TRUE);
     int x, y, w, h;
@@ -394,7 +370,7 @@ elm_main(int argc, char **argv)
     win = elm_win_add(NULL, "Elimine", ELM_WIN_BASIC);
     elm_win_title_set(win, "Elimine");
     elm_win_autodel_set(win, EINA_TRUE);
-    evas_object_data_set(win, "ctx", ctx);
+    evas_object_data_set(win, "elimine.ctx", ctx);
 
 
     /* background */
@@ -446,19 +422,15 @@ elm_main(int argc, char **argv)
     evas_object_show(o);
     ctx->smiley = o;
 
-    o = evas_object_image_filled_add(evas_object_evas_get(win));
+    o = score_add(win);
+    score_set(o, 0);
+    //evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+    //evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
     evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
-    tile_size_get(&icon_w, &icon_h);
-    icon_w *= ctx->pixel_sz;
-    icon_h *= ctx->pixel_sz;
-    evas_object_image_size_set(o, icon_w, icon_h);
-    evas_object_image_data_set(o, tile_bmp_get(TILE_BOMB_EXPLODED));
-    evas_object_resize(o, icon_w, icon_h);
-    evas_object_size_hint_min_set(o, icon_w, icon_h);
-    evas_object_size_hint_max_set(o, icon_w, icon_h);
+    evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, 0);
     elm_box_pack_end(hbox, o);
     evas_object_show(o);
+    ctx->remain = o;
 
     /* table */
     o = elm_table_add(win);
@@ -526,7 +498,7 @@ elm_main(int argc, char **argv)
     display_board(ctx);
 
     win_w = ctx->nc * ctx->pixel_sz;
-    win_h = ctx->nl * ctx->pixel_sz;
+    win_h = (ctx->nl + 32) * ctx->pixel_sz;
     evas_object_resize(win,
                        win_w * elm_config_scale_get(),
                        win_h * elm_config_scale_get());
@@ -535,10 +507,10 @@ elm_main(int argc, char **argv)
 
     elm_run();
 
-    return 0;
-
     ctx_del(ctx);
 
+    return 0;
+
     (void)argc;
     (void)argv;
 }
diff --git a/src/bin/elimine.h b/src/bin/elimine.h
index f50087f..5f58219 100644
--- a/src/bin/elimine.h
+++ b/src/bin/elimine.h
@@ -8,18 +8,18 @@
 
 typedef struct
 {
-    Evas *evas;
-    Evas_Object *grd;
+    Evas_Object *remain; /* nbr of remaing bombs */
+    Evas_Object *time;
     Evas_Object *smiley;
-    Eina_List *tiles;
+    Evas_Object *grd;
+    Eina_Array *tiles;
 
     int *state;
     int *known;
     int nl; /* number of lines of the board */
     int nc; /* number of columns of the board */
-    int nm; /* number of mines in the board */
+    int nm; /* number of remaining mines in the board based on flagged tiles */
     int pixel_sz; /* size in pixels of a tile */
-    int flagged; /* number of tile with a flag */
 
     Eina_Bool finished;
 } Ctx;
diff --git a/src/bin/score.c b/src/bin/score.c
index 0ab61c4..1fba8f1 100644
--- a/src/bin/score.c
+++ b/src/bin/score.c
@@ -192,10 +192,10 @@ score_add(Evas_Object *win)
     if (!_smart) _smart_init();
     obj = evas_object_smart_add(evas, _smart);
 
-    ctx = evas_object_data_get(win, "ctx");
+    ctx = evas_object_data_get(win, "elimine.ctx");
     EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, NULL);
 
-    evas_object_data_set(obj, "ctx", ctx);
+    evas_object_data_set(obj, "elimine.ctx", ctx);
 
     return obj;
 }
@@ -211,9 +211,8 @@ score_set(Evas_Object *obj, int val)
     sd = evas_object_smart_data_get(obj);
     EINA_SAFETY_ON_NULL_RETURN(sd);
 
-    ctx = evas_object_data_get(obj, "ctx");
+    ctx = evas_object_data_get(obj, "elimine.ctx");
     EINA_SAFETY_ON_NULL_RETURN(ctx);
-    printf(" $$ pixel_sz: %p %d\n", (void *)ctx, ctx->pixel_sz);
 
     if (!sd->pixel_sz)
     {
@@ -223,10 +222,8 @@ score_set(Evas_Object *obj, int val)
 
         sd->pixel_sz = ctx->pixel_sz;
         cipher_size_get(&icon_w, &icon_h);
-        printf(" $$ %d %d %d\n", icon_w, icon_h, sd->pixel_sz);
         icon_w *= sd->pixel_sz;
         icon_h *= sd->pixel_sz;
-        printf(" $$ %d %d\n", icon_w, icon_h);
 
         for (int i = 0; i < 3; i++)
         {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to