[gbrainy] Improve balance puzzle by actually showing a balance



commit c49cf2f86b1f51dc4e8e213e0ea2f6c385eb95b0
Author: Jordi Mas <jmas softcatala org>
Date:   Tue Jan 15 23:39:04 2013 +0100

    Improve balance puzzle by actually showing a balance

 data/game-graphics/balance.svg   |   25 +++++++++++++++++++++++++
 src/Games/Logic/PuzzleBalance.cs |   25 ++++---------------------
 src/Games/Makefile.am            |    3 ++-
 3 files changed, 31 insertions(+), 22 deletions(-)
---
diff --git a/data/game-graphics/balance.svg b/data/game-graphics/balance.svg
new file mode 100644
index 0000000..fe41476
--- /dev/null
+++ b/data/game-graphics/balance.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"; xmlns:xlink="http://www.w3.org/1999/xlink"; x="0px" y="0px"
+	 width="183.552px" height="40.46px" viewBox="0 0 183.552 40.46" enable-background="new 0 0 183.552 40.46" xml:space="preserve">
+<g>
+	<rect x="91.418" y="17.121" stroke="#000000" stroke-miterlimit="10" width="3.216" height="10.984"/>
+	<g>
+		<path fill="none" d="M188.802,20.604v-8.498h-7.362c0.028,0.047,0.044,0.095,0.044,0.142c0,1.878-19.117,3.399-42.698,3.399
+			c-23.58,0.001-42.696-1.52-42.696-3.397c0-0.047,0.015-0.095,0.039-0.142h-5.326v8.498L188.802,20.604z"/>
+		<path d="M138.786,15.646c23.581,0,42.698-1.521,42.698-3.399c0-0.047-0.016-0.095-0.044-0.142l-85.312,0.002
+			c-0.024,0.047-0.039,0.095-0.039,0.142C96.089,14.127,115.206,15.647,138.786,15.646z"/>
+	</g>
+	<path stroke="#000000" stroke-miterlimit="10" d="M146.901,17.695c0,0.404-1.022,0.732-2.285,0.732H41.435
+		c-1.262,0-2.284-0.328-2.284-0.732l0,0c0-0.404,1.022-0.732,2.284-0.732h103.181C145.878,16.963,146.901,17.291,146.901,17.695
+		L146.901,17.695z"/>
+	<path stroke="#000000" stroke-miterlimit="10" d="M114.921,26.665c0,0.934-1.918,1.69-4.285,1.69H75.415
+		c-2.366,0-4.283-0.757-4.283-1.69v-0.282c0-0.933,1.917-1.689,4.283-1.689h35.222c2.367,0,4.285,0.757,4.285,1.689V26.665z"/>
+	<g>
+		<path fill="none" d="M94.75,20.604v-8.498h-7.36c0.027,0.047,0.041,0.095,0.041,0.142c0,1.878-19.115,3.399-42.696,3.399
+			c-23.581,0.001-42.697-1.52-42.697-3.397c0-0.047,0.015-0.095,0.04-0.142H-3.25v8.498L94.75,20.604z"/>
+		<path d="M44.734,15.646c23.581,0,42.696-1.521,42.696-3.399c0-0.047-0.014-0.095-0.041-0.142L2.077,12.107
+			c-0.025,0.047-0.04,0.095-0.04,0.142C2.037,14.127,21.153,15.647,44.734,15.646z"/>
+	</g>
+</g>
+</svg>
diff --git a/src/Games/Logic/PuzzleBalance.cs b/src/Games/Logic/PuzzleBalance.cs
index 8197cc8..c92c4f7 100644
--- a/src/Games/Logic/PuzzleBalance.cs
+++ b/src/Games/Logic/PuzzleBalance.cs
@@ -76,16 +76,11 @@ namespace gbrainy.Games.Logic
 
 		public void DrawBalance (CairoContextEx gr, double x, double y, int index, bool full)
 		{
+
 			const double width = 0.5;
-			double fig_x = x + 0.1, fig_y = y - 0.11;
+			double fig_x = x + 0.1, fig_y = y - 0.08;
 			int total = (full == true) ? (elements * 2) : elements;
 
-			gr.Rectangle (x + 0.05, y - 0.12, 0.38, 0.08);
-			gr.Stroke ();
-
-			gr.Rectangle (x + 0.5, y - 0.12, 0.38, 0.08);
-			gr.Stroke ();
-
 			for (int i = 0; i < total; i++) {
 				switch (balances[i + index]) {
 				case 1:
@@ -107,19 +102,7 @@ namespace gbrainy.Games.Logic
 					fig_x += 0.07;
 			}
 
-			x += 0.2;
-			y += 0.01;
-			gr.MoveTo (x, y);
-			gr.LineTo (x + width, y);
-			gr.LineTo (x + width, y - 0.05);
-			gr.Stroke ();
-
-			gr.MoveTo (x , y);
-			gr.LineTo (x , y - 0.05);
-			gr.Stroke ();
-
-			gr.DrawEquilateralTriangle (x + (width / 2) - 0.04, y, 0.08);
-			gr.Stroke ();
+			gr.DrawImageFromAssembly ("balance.svg", x + 0.02, y - 0.08, 0.9, 0.25);
 		}
 
 		public override void Draw (CairoContextEx gr, int area_width, int area_height, bool rtl)
@@ -137,7 +120,7 @@ namespace gbrainy.Games.Logic
 			DrawBalance (gr, x, y, (group * elements * 6) + 2 * elements * 2, false);
 
 			gr.SetPangoFontSize (0.05);
-			gr.MoveTo (0.74, 0.68);
+			gr.MoveTo (0.74, 0.71);
 			gr.ShowPangoText ("?");
 			gr.Stroke ();
 		}
diff --git a/src/Games/Makefile.am b/src/Games/Makefile.am
index 3ba0d5c..6fecd60 100644
--- a/src/Games/Makefile.am
+++ b/src/Games/Makefile.am
@@ -94,7 +94,8 @@ $(top_srcdir)/data/game-graphics/faceboy2.svg \
 $(top_srcdir)/data/game-graphics/faceboy3.svg \
 $(top_srcdir)/data/game-graphics/facegirl1.svg \
 $(top_srcdir)/data/game-graphics/facegirl2.svg \
-$(top_srcdir)/data/game-graphics/facegirl3.svg
+$(top_srcdir)/data/game-graphics/facegirl3.svg \
+$(top_srcdir)/data/game-graphics/balance.svg
 
 
 REFS =  \



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