gbrainy r438 - in trunk/src: . PuzzleGames
- From: jmas svn gnome org
- To: svn-commits-list gnome org
- Subject: gbrainy r438 - in trunk/src: . PuzzleGames
- Date: Mon, 25 Aug 2008 19:22:58 +0000 (UTC)
Author: jmas
Date: Mon Aug 25 19:22:58 2008
New Revision: 438
URL: http://svn.gnome.org/viewvc/gbrainy?rev=438&view=rev
Log:
2008-08-25 Jordi Mas <jmas softcatala org>
* GameDrawingArea.cs: New API signature
* gbrainy.cs: Load saved difficulty
* CairoContextEx.cs: Allow text rotation
* PuzzleGames/PuzzleBuildTriangle.cs: More space between both puzzles
* PuzzleGames/PuzzleCirclesRectangle.cs:
Modified:
trunk/src/CairoContextEx.cs
trunk/src/ChangeLog
trunk/src/GameDrawingArea.cs
trunk/src/PuzzleGames/PuzzleBuildTriangle.cs
trunk/src/PuzzleGames/PuzzleCirclesRectangle.cs
trunk/src/gbrainy.cs
Modified: trunk/src/CairoContextEx.cs
==============================================================================
--- trunk/src/CairoContextEx.cs (original)
+++ trunk/src/CairoContextEx.cs Mon Aug 25 19:22:58 2008
@@ -92,7 +92,7 @@
}
// Shows a text from the current position. Defines all the line as text drawing box
- public void ShowPangoText (string str, bool bold, double width)
+ public void ShowPangoText (string str, bool bold, double width, double rotation)
{
Pango.Alignment align = layout.Alignment;
@@ -105,7 +105,22 @@
} else
layout.Width = (int) (width * Matrix.Xx * Pango.Scale.PangoScale);
- ShowPangoText (str);
+ if (rotation != 0) {
+
+ Cairo.Matrix old = Matrix;
+
+ UpdateFontSize ();
+ Matrix = new Cairo.Matrix ();
+ Rotate (rotation);
+ layout.SetText (str);
+ layout.SingleParagraphMode = true;
+ Pango.CairoHelper.UpdateLayout (this, layout);
+ Pango.CairoHelper.ShowLayout (this, layout);
+ Matrix = old;
+ }
+ else
+ ShowPangoText (str);
+
layout.FontDescription.Weight = Pango.Weight.Normal;
layout.Width = -1;
layout.Alignment = align;
Modified: trunk/src/GameDrawingArea.cs
==============================================================================
--- trunk/src/GameDrawingArea.cs (original)
+++ trunk/src/GameDrawingArea.cs Mon Aug 25 19:22:58 2008
@@ -97,7 +97,7 @@
gr.Color = new Cairo.Color (0, 0, 0, 1);
gr.MoveTo (0.05, y);
- gr.ShowPangoText (String.Format (Catalog.GetString ("Welcome to gbrainy {0}"), Defines.VERSION), true, -1);
+ gr.ShowPangoText (String.Format (Catalog.GetString ("Welcome to gbrainy {0}"), Defines.VERSION), true, -1, 0);
gr.Stroke ();
gr.DrawStringWithWrapping (0.05, y + 0.07, Catalog.GetString ("gbrainy is a brain teaser game and trainer to have fun and to keep your brain trained. It includes:"));
@@ -214,7 +214,7 @@
gr.Color = new Cairo.Color (0, 0, 0, 1);
gr.MoveTo (x, y);
- gr.ShowPangoText (Catalog.GetString ("Score"), false, -1);
+ gr.ShowPangoText (Catalog.GetString ("Score"), false, -1, 0);
DrawBand (gr, 0.03, y - 0.01);
y += 0.08;
@@ -248,7 +248,7 @@
y += 0.4;
gr.MoveTo (x, y);
- gr.ShowPangoText (Catalog.GetString ("Tips for your next games"), false, -1);
+ gr.ShowPangoText (Catalog.GetString ("Tips for your next games"), false, -1, 0);
DrawBand (gr, 0.03, y - 0.01);
y += 0.08;
Modified: trunk/src/PuzzleGames/PuzzleBuildTriangle.cs
==============================================================================
--- trunk/src/PuzzleGames/PuzzleBuildTriangle.cs (original)
+++ trunk/src/PuzzleGames/PuzzleBuildTriangle.cs Mon Aug 25 19:22:58 2008
@@ -153,7 +153,7 @@
gr.ShowPangoText (GetPossibleFigureAnswer (i));
if (i == (total_figures / 2) - 1) {
- y+= 0.25;
+ y+= 0.30;
x= DrawAreaX + 0.05;
}
else
Modified: trunk/src/PuzzleGames/PuzzleCirclesRectangle.cs
==============================================================================
--- trunk/src/PuzzleGames/PuzzleCirclesRectangle.cs (original)
+++ trunk/src/PuzzleGames/PuzzleCirclesRectangle.cs Mon Aug 25 19:22:58 2008
@@ -78,10 +78,12 @@
gr.LineTo (first_x + 0.5, first_y - space_fromrect);
gr.Stroke ();
- gr.MoveTo (first_x + 0.2, first_y - 0.04 - space_fromrect);
+ gr.MoveTo (first_x + 0.2, first_y - 0.06 - space_fromrect);
gr.ShowPangoText (Catalog.GetString ("8 units"));
gr.Stroke ();
+
+
// ---
// |
// |
@@ -97,13 +99,10 @@
gr.LineTo (first_x - space_fromrect - 0.04, first_y + 0.5);
gr.Stroke ();
- gr.Save ();
- gr.MoveTo (first_x - space_fromrect - 0.05, first_y + 0.3);
- gr.Rotate (270 * Math.PI/180);
- gr.ShowPangoText (Catalog.GetString ("8 units"));
- gr.Restore ();
+ gr.MoveTo (first_x - space_fromrect - 0.07, first_y + 0.3);
+ gr.ShowPangoText (Catalog.GetString ("8 units"), false, -1, 270 * Math.PI/180);
gr.Stroke ();
-
+
// Sample circle
gr.Arc (first_x + 0.7, first_y + 0.1, unit / 2, 0, 2 * Math.PI);
gr.Stroke ();
@@ -119,7 +118,7 @@
gr.LineTo (first_x + 0.65 + 0.1, first_y + 0.05 - space_fromcircle);
gr.Stroke ();
- gr.MoveTo (first_x + 0.65, first_y - space_fromcircle);
+ gr.MoveTo (first_x + 0.65, first_y - 0.04 - space_fromcircle);
gr.ShowPangoText (Catalog.GetString ("1 unit"));
gr.Stroke ();
@@ -138,14 +137,10 @@
gr.LineTo (first_x + 0.65 - space_fromcircle - 0.04, first_y + 0.1 + 0.05);
gr.Stroke ();
- gr.Save ();
- gr.MoveTo (first_x + 0.65 - space_fromcircle - 0.05, first_y + 0.15);
- gr.Rotate (270 * Math.PI/180);
- gr.ShowPangoText (Catalog.GetString ("1 unit"));
- gr.Restore ();
+ gr.MoveTo (first_x + 0.65 - space_fromcircle - 0.08, first_y + 0.15);
+ gr.ShowPangoText (Catalog.GetString ("1 unit"), false, -1, 270 * Math.PI/180);
gr.Stroke ();
-
if (DrawAnswer == false)
return;
Modified: trunk/src/gbrainy.cs
==============================================================================
--- trunk/src/gbrainy.cs (original)
+++ trunk/src/gbrainy.cs Mon Aug 25 19:22:58 2008
@@ -130,6 +130,7 @@
if (preferences == null)
preferences = new Preferences ();
+ session.GameManager.Difficulty = (Game.Difficulty) preferences.GetIntValue (Preferences.DifficultyKey);
drawing_area = new GameDrawingArea ();
drawing_vbox.Add (drawing_area);
//app_window.Resize (500, 700);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]