[gcompris/gcomprixogoo] Added a sign on the scale



commit a68c3786be1cd07fe0242e1dd2b8a27627401e55
Author: Bruno Coudoin <bruno coudoin free fr>
Date:   Sun Jan 3 17:31:57 2010 +0100

    Added a sign on the scale
    
    The scale activity is sometimes annoying because you cannot easiliy
    see which side the scale goes. I added a sign < > or = on it to ease
    the task.

 src/scalesboard-activity/scale.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/scalesboard-activity/scale.c b/src/scalesboard-activity/scale.c
index 56b1579..05a15db 100644
--- a/src/scalesboard-activity/scale.c
+++ b/src/scalesboard-activity/scale.c
@@ -39,6 +39,7 @@ static void game_won(void);
 
 static GooCanvasItem *boardRootItem = NULL;
 static GooCanvasItem *group_g, *group_d, *group_m;
+static GooCanvasItem *sign;
 static GooCanvasItem *bras;
 static GooCanvasItem *answer_item;
 static GString *answer_string = NULL;
@@ -342,6 +343,15 @@ scale_anim_plate(void)
   if(get_weight_plate(1) == 0)
     delta_y = -PLATE_Y_DELTA;
 
+  /* Update the sign */
+  if (diff == 0)
+    g_object_set(sign, "text", "=", NULL);
+  else if (diff < 0)
+    g_object_set(sign, "text", "<", NULL);
+  else
+    g_object_set(sign, "text", ">", NULL);
+
+
   if(last_delta != delta_y)
     {
       goo_canvas_item_translate(group_g, 0, -last_delta);
@@ -946,6 +956,18 @@ scale_next_level()
 				 NULL);
   gdk_pixbuf_unref(pixmap);
 
+  /* Set a sign on the scale in case it's not easy to determine
+     on which side it balances */
+  sign = goo_canvas_text_new(boardRootItem,
+			     "=",
+			     BOARDWIDTH/2 + 2,
+			     balance_left_y + 80,
+			     -1,
+			     GTK_ANCHOR_CENTER,
+			     "font", gc_skin_font_board_medium,
+			     "fill-color", "white",
+			      NULL);
+
   /* create left plate */
   group_g = goo_canvas_group_new (boardRootItem,
 				  NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]