[gbrainy] MemoryFigures becomes memory faces with better graphics
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy] MemoryFigures becomes memory faces with better graphics
- Date: Wed, 2 Jan 2013 19:30:50 +0000 (UTC)
commit 8faecb7acc3f8d81282a08118a7d70e258422596
Author: Jordi Mas <jmas softcatala org>
Date: Wed Jan 2 20:33:00 2013 +0100
MemoryFigures becomes memory faces with better graphics
data/Makefile.am | 8 ++-
data/game-graphics/faceboy1.svg | 15 +++
data/game-graphics/faceboy2.svg | 26 ++++++
data/game-graphics/faceboy3.svg | 24 +++++
data/game-graphics/facegirl1.svg | 32 +++++++
data/game-graphics/facegirl2.svg | 23 +++++
data/game-graphics/facegirl3.svg | 20 ++++
po/POTFILES.in | 2 +-
src/Core/Main/Memory.cs | 7 ++-
src/Games/GameList.cs | 2 +-
src/Games/Makefile.am | 10 ++-
.../Memory/{MemoryFigures.cs => MemoryFaces.cs} | 94 ++++++++------------
12 files changed, 200 insertions(+), 63 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 244ee78..0beaa2f 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -53,7 +53,13 @@ analogies_DATA = \
game-graphics/dartboard.svg \
game-graphics/horses_men.svg \
game-graphics/lever.svg \
- game-graphics/people_table.svg
+ game-graphics/people_table.svg \
+ game-graphics/faceboy1.svg \
+ game-graphics/faceboy2.svg \
+ game-graphics/faceboy3.svg \
+ game-graphics/facegirl1.svg \
+ game-graphics/facegirl2.svg \
+ game-graphics/facegirl3.svg
themes_DATA = \
diff --git a/data/game-graphics/faceboy1.svg b/data/game-graphics/faceboy1.svg
new file mode 100644
index 0000000..7d7fc18
--- /dev/null
+++ b/data/game-graphics/faceboy1.svg
@@ -0,0 +1,15 @@
+<?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="113.39px" height="113.39px" viewBox="0 0 113.39 113.39" enable-background="new 0 0 113.39 113.39" xml:space="preserve">
+<g>
+ <path fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" d="M33.626,46.312c0,26.92,45.157,26.92,45.157,0"/>
+ <path stroke="#000000" stroke-miterlimit="10" d="M80.354,40.284L67.729,27.633c-5.229,4.916-10.424,12.104-35.118,12.62
+ C32.299,10.779,80.041,10.811,80.354,40.284"/>
+ <path fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" d="M47.42,52.744c0,6.084,18.407,6.084,18.407,0"/>
+ <ellipse cx="65.346" cy="43.511" rx="2.53" ry="2.196"/>
+ <ellipse cx="48.285" cy="43.511" rx="2.53" ry="2.196"/>
+ <path stroke="#000000" stroke-miterlimit="10" d="M73.078,70.5l-16.9,17.639L39.43,70.5c-7.058,0.833-11.763,15-11.763,15v11.167
+ h28.004h1.009h28.269V85.5C84.948,85.5,80.199,71.333,73.078,70.5z"/>
+</g>
+</svg>
diff --git a/data/game-graphics/faceboy2.svg b/data/game-graphics/faceboy2.svg
new file mode 100644
index 0000000..7dfbb54
--- /dev/null
+++ b/data/game-graphics/faceboy2.svg
@@ -0,0 +1,26 @@
+<?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="113.39px" height="113.39px" viewBox="0 0 113.39 113.39" enable-background="new 0 0 113.39 113.39" xml:space="preserve">
+<g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" d="M33.16,47.622c0,26.919,45.157,26.919,45.157,0"/>
+ <path fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" d="M33.16,41.878c0-26.919,45.157-26.919,45.157,0"/>
+ <path fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" d="M46.954,54.054c0,6.084,18.407,6.084,18.407,0"/>
+ <ellipse cx="64.88" cy="44.821" rx="2.53" ry="2.196"/>
+ <ellipse cx="47.819" cy="44.821" rx="2.53" ry="2.196"/>
+ <path stroke="#000000" stroke-miterlimit="10" d="M72.928,72.127l-5.518-0.55c0,0-5.484,2.947-11.672,2.947
+ c-6.724,0-10.449-2.593-10.449-2.593l-6.009,0.195c-7.058,0.833-11.763,15-11.763,15v11.167h28.004h1.009h28.268V87.127
+ C84.798,87.127,80.05,72.96,72.928,72.127z"/>
+ <path fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" d="M53.704,45.049c0,2.926-2.372,5.298-5.298,5.298
+ h-4.107c-2.926,0-5.298-2.372-5.298-5.298l0,0c0-2.927,2.372-5.299,5.298-5.299h4.107C51.332,39.75,53.704,42.122,53.704,45.049
+ L53.704,45.049z"/>
+ <path fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" d="M73.904,45.539c0,2.926-2.372,5.298-5.299,5.298
+ h-4.107c-2.926,0-5.298-2.372-5.298-5.298l0,0c0-2.927,2.372-5.299,5.298-5.299h4.107C71.532,40.24,73.904,42.612,73.904,45.539
+ L73.904,45.539z"/>
+ <path fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" d="M53.704,45.049"/>
+ <line fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" x1="58.659" y1="44.82" x2="53.704" y2="45.049"/>
+ </g>
+ <path stroke="#000000" stroke-miterlimit="10" d="M32.144,54.054"/>
+</g>
+</svg>
diff --git a/data/game-graphics/faceboy3.svg b/data/game-graphics/faceboy3.svg
new file mode 100644
index 0000000..910da40
--- /dev/null
+++ b/data/game-graphics/faceboy3.svg
@@ -0,0 +1,24 @@
+<?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="113.39px" height="113.39px" viewBox="0 0 113.39 113.39" enable-background="new 0 0 113.39 113.39" xml:space="preserve">
+<g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" d="M35.126,45.718c0,26.92,45.157,26.92,45.157,0"/>
+ <path stroke="#000000" stroke-miterlimit="10" d="M81.854,39.69c0,0-17.696-0.421-38.689-0.178
+ c-0.609,0.008-1.22,0.015-1.834,0.022c-2.376,0.032-4.79,0.073-7.22,0.124C33.799,10.185,81.541,10.216,81.854,39.69"/>
+ <path fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" d="M48.92,52.149c0,6.084,18.407,6.084,18.407,0"/>
+ <ellipse cx="66.846" cy="42.917" rx="2.53" ry="2.195"/>
+ <ellipse cx="49.785" cy="42.917" rx="2.53" ry="2.195"/>
+ <path stroke="#000000" stroke-miterlimit="10" d="M74.894,70.223l-5.518-0.55c0,0-5.065,9.166-11.253,9.166
+ c-6.723,0-10.868-8.812-10.868-8.812l-6.009,0.195c-7.058,0.833-11.763,15-11.763,15V96.39h28.004h1.01h28.268V85.223
+ C86.764,85.223,82.016,71.056,74.894,70.223z"/>
+ </g>
+ <path stroke="#000000" stroke-miterlimit="10" d="M34.109,52.149"/>
+ <path stroke="#000000" stroke-miterlimit="10" d="M46,38.007c0,0-0.996,13.12-12.539,13.201
+ c-11.544,0.08,0.995-11.138,0.995-11.138"/>
+</g>
+<path d="M65.078,65.907l-7.16,0.766l-6.75-0.766c0,0,3.418,2.934,2.084,5.1s2.5,0,2.5,0s1.005,1.466,1.871,2.916
+ c0.052,0.088,0.099,0.141,0.142,0.178c0.085,0.316,0.217,0.379,0.414,0.049c0.866-1.451,2.315-3.143,2.315-3.143s3.834,2.166,2.5,0
+ S65.078,65.907,65.078,65.907z"/>
+</svg>
diff --git a/data/game-graphics/facegirl1.svg b/data/game-graphics/facegirl1.svg
new file mode 100644
index 0000000..c321d7e
--- /dev/null
+++ b/data/game-graphics/facegirl1.svg
@@ -0,0 +1,32 @@
+<?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="113.39px" height="113.39px" viewBox="0 0 113.39 113.39" enable-background="new 0 0 113.39 113.39" xml:space="preserve">
+<g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" d="M34.126,47.095c0,26.92,45.157,26.92,45.157,0"/>
+ <path stroke="#000000" stroke-miterlimit="10" d="M80.854,41.067L68.229,28.416C63,33.332,57.804,40.52,33.111,41.036
+ C32.799,11.562,80.541,11.594,80.854,41.067"/>
+ <path fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" d="M47.92,53.527c0,6.084,18.407,6.084,18.407,0"/>
+ <ellipse cx="65.846" cy="44.294" rx="2.53" ry="2.196"/>
+ <ellipse cx="48.785" cy="44.294" rx="2.53" ry="2.196"/>
+ <path stroke="#000000" stroke-miterlimit="10" d="M73.894,71.6c0,0-3.296,11.051-16.77,11.051S40.246,71.6,40.246,71.6
+ c-7.058,0.834-11.763,15-11.763,15v11.168h28.004h1.009h28.268V86.6C85.764,86.6,81.016,72.434,73.894,71.6z"/>
+ <ellipse stroke="#000000" stroke-miterlimit="10" cx="44.831" cy="70.574" rx="0.731" ry="0.567"/>
+ <ellipse stroke="#000000" stroke-miterlimit="10" cx="46.314" cy="73.167" rx="0.731" ry="0.567"/>
+ <ellipse stroke="#000000" stroke-miterlimit="10" cx="48.811" cy="75.166" rx="0.731" ry="0.568"/>
+ <ellipse stroke="#000000" stroke-miterlimit="10" cx="51.262" cy="77" rx="0.731" ry="0.567"/>
+ <ellipse stroke="#000000" stroke-miterlimit="10" cx="54.523" cy="78.135" rx="0.731" ry="0.566"/>
+ <ellipse stroke="#000000" stroke-miterlimit="10" cx="67.821" cy="70.787" rx="0.731" ry="0.567"/>
+ <ellipse stroke="#000000" stroke-miterlimit="10" cx="66.339" cy="73.38" rx="0.731" ry="0.567"/>
+ <ellipse stroke="#000000" stroke-miterlimit="10" cx="63.841" cy="75.379" rx="0.731" ry="0.568"/>
+ <ellipse stroke="#000000" stroke-miterlimit="10" cx="61.39" cy="77.213" rx="0.731" ry="0.567"/>
+ <ellipse stroke="#000000" stroke-miterlimit="10" cx="58.129" cy="78.348" rx="0.73" ry="0.566"/>
+ </g>
+ <path stroke="#000000" stroke-miterlimit="10" d="M33.109,53.527"/>
+ <path stroke="#000000" stroke-width="0.75" stroke-miterlimit="10" d="M33.044,50.373c-0.441-3.311,3.739,24.948-5.677,20.858
+ c10.655,3.312,13.518-7.408,13.518-7.408"/>
+ <path stroke="#000000" stroke-width="0.75" stroke-miterlimit="10" d="M80.365,50.373c0.44-3.311-3.739,24.948,5.676,20.858
+ c-10.654,3.312-13.518-7.408-13.518-7.408"/>
+</g>
+</svg>
diff --git a/data/game-graphics/facegirl2.svg b/data/game-graphics/facegirl2.svg
new file mode 100644
index 0000000..2d05f1d
--- /dev/null
+++ b/data/game-graphics/facegirl2.svg
@@ -0,0 +1,23 @@
+<?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="113.39px" height="113.39px" viewBox="0 0 113.39 113.39" enable-background="new 0 0 113.39 113.39" xml:space="preserve">
+<g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" d="M33.265,47.34c0,26.92,45.157,26.92,45.157,0"/>
+ <path fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" d="M47.059,53.772c0,6.083,18.407,6.083,18.407,0"/>
+ <ellipse cx="64.985" cy="44.539" rx="2.53" ry="2.196"/>
+ <ellipse cx="47.924" cy="44.539" rx="2.53" ry="2.196"/>
+ <path stroke="#000000" stroke-miterlimit="10" d="M73.032,71.846c0,0-3.296,11.049-16.771,11.049
+ c-13.474,0-16.877-11.049-16.877-11.049c-7.058,0.832-11.763,15-11.763,15v11.166h28.004h1.009h28.268V86.846
+ C84.902,86.846,80.154,72.678,73.032,71.846z"/>
+ </g>
+ <path stroke="#000000" stroke-miterlimit="10" d="M32.248,53.772"/>
+</g>
+<path stroke="#000000" stroke-miterlimit="10" d="M80.494,43.126c0,0-6.981-4.126-23.943-4.292c-14.967,0-21.181,4.202-23.942,4.26
+ C32.296,12.869,80.181,12.901,80.494,43.126"/>
+<path stroke="#000000" stroke-width="0.75" stroke-miterlimit="10" d="M32.731,48.347l-2.564,16.32c0,0,10.5,3.401,17.757,1.863
+ C42.757,64.197,37.5,60,37.5,60L32.731,48.347z"/>
+<path stroke="#000000" stroke-width="0.75" stroke-miterlimit="10" d="M79.621,48.347l2.564,16.32c0,0-10.5,3.401-17.757,1.863
+ C69.596,64.197,74.853,60,74.853,60L79.621,48.347z"/>
+</svg>
diff --git a/data/game-graphics/facegirl3.svg b/data/game-graphics/facegirl3.svg
new file mode 100644
index 0000000..6a6a36e
--- /dev/null
+++ b/data/game-graphics/facegirl3.svg
@@ -0,0 +1,20 @@
+<?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="113.39px" height="113.39px" viewBox="0 0 113.39 113.39" enable-background="new 0 0 113.39 113.39" xml:space="preserve">
+<g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" d="M33.868,49.888c0,26.92,45.158,26.92,45.158,0"/>
+ <path stroke="#000000" stroke-miterlimit="10" d="M80.596,43.861c-19.471,2.014-23.721-10.486-23.721-10.486
+ s0.671,9.938-24.022,10.455C32.541,14.355,80.283,14.387,80.596,43.861"/>
+ <path fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" d="M47.662,56.32c0,6.084,18.407,6.084,18.407,0"/>
+ <ellipse cx="65.588" cy="47.087" rx="2.529" ry="2.196"/>
+ <ellipse cx="48.527" cy="47.087" rx="2.53" ry="2.196"/>
+ <path stroke="#000000" stroke-miterlimit="10" d="M73.635,74.394c0,0-3.295,11.05-16.77,11.05
+ c-13.474,0-16.877-11.05-16.877-11.05c-7.058,0.833-11.763,15-11.763,15v11.167h28.004h1.009h28.268V89.394
+ C85.506,89.394,80.758,75.227,73.635,74.394z"/>
+ </g>
+ <path stroke="#000000" stroke-miterlimit="10" d="M32.851,56.32"/>
+</g>
+<ellipse stroke="#000000" stroke-miterlimit="10" cx="56.909" cy="20.562" rx="8.159" ry="6.688"/>
+</svg>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 58bfd9f..7a67591 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -102,9 +102,9 @@ src/Games/Logic/PuzzleTrianglesWithNumbers.cs
src/Games/Memory/MemoryColouredFigures.cs
src/Games/Memory/MemoryColouredText.cs
src/Games/Memory/MemoryCountDots.cs
+src/Games/Memory/MemoryFaces.cs
src/Games/Memory/MemoryFacts.cs
src/Games/Memory/MemoryFiguresAndText.cs
-src/Games/Memory/MemoryFigures.cs
src/Games/Memory/MemoryFiguresNumbers.cs
src/Games/Memory/MemoryIndications.cs
src/Games/Memory/MemoryNumbers.cs
diff --git a/src/Core/Main/Memory.cs b/src/Core/Main/Memory.cs
index c6d5792..3bfd56e 100644
--- a/src/Core/Main/Memory.cs
+++ b/src/Core/Main/Memory.cs
@@ -66,6 +66,11 @@ namespace gbrainy.Core.Main
}
}
+ // Shading does not work well when we have images
+ protected virtual bool SupportsShading {
+ get { return true; }
+ }
+
protected override void Initialize ()
{
if (Preferences.Get <bool> (Preferences.MemQuestionWarnKey) == false ||
@@ -169,7 +174,7 @@ namespace gbrainy.Core.Main
InitDraw (gr, area_width, area_height, rtl);
- if (shade) {
+ if (SupportsShading && shade) {
if (alpha > 0)
alpha -= (1 / (double) shading_time);
diff --git a/src/Games/GameList.cs b/src/Games/GameList.cs
index 8f2bfdc..40a5daa 100644
--- a/src/Games/GameList.cs
+++ b/src/Games/GameList.cs
@@ -101,7 +101,7 @@ namespace gbrainy.Games
typeof (MemoryColouredText),
typeof (MemoryWords),
typeof (MemoryCountDots),
- typeof (MemoryFigures),
+ typeof (MemoryFaces),
typeof (MemoryIndications),
typeof (MemoryNumbers),
typeof (MemoryFacts),
diff --git a/src/Games/Makefile.am b/src/Games/Makefile.am
index ae1c9c2..b92875a 100644
--- a/src/Games/Makefile.am
+++ b/src/Games/Makefile.am
@@ -55,7 +55,7 @@ CSDISTFILES = \
$(srcdir)/Memory/MemoryColouredText.cs \
$(srcdir)/Memory/MemoryCountDots.cs \
$(srcdir)/Memory/MemoryFacts.cs \
- $(srcdir)/Memory/MemoryFigures.cs \
+ $(srcdir)/Memory/MemoryFaces.cs \
$(srcdir)/Memory/MemoryFiguresAndText.cs \
$(srcdir)/Memory/MemoryFiguresNumbers.cs \
$(srcdir)/Memory/MemoryIndications.cs \
@@ -86,7 +86,13 @@ $(top_srcdir)/data/game-graphics/train_left.svg \
$(top_srcdir)/data/game-graphics/tv_set.svg \
$(top_srcdir)/data/game-graphics/bucket.svg \
$(top_srcdir)/data/game-graphics/people_table.svg \
-$(top_srcdir)/data/game-graphics/shop.svg
+$(top_srcdir)/data/game-graphics/shop.svg \
+$(top_srcdir)/data/game-graphics/faceboy1.svg \
+$(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
REFS = \
diff --git a/src/Games/Memory/MemoryFigures.cs b/src/Games/Memory/MemoryFaces.cs
similarity index 70%
rename from src/Games/Memory/MemoryFigures.cs
rename to src/Games/Memory/MemoryFaces.cs
index e2a5a49..d229f87 100644
--- a/src/Games/Memory/MemoryFigures.cs
+++ b/src/Games/Memory/MemoryFaces.cs
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2008 Jordi Mas i HernÃndez <jmas softcatala org>
+ * Copyright (C) 2007-2012 Jordi Mas i HernÃndez <jmas softcatala org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -25,7 +25,7 @@ using gbrainy.Core.Toolkit;
namespace gbrainy.Games.Memory
{
- public class MemoryFigures : Core.Main.Memory
+ public class MemoryFaces : Core.Main.Memory
{
private ArrayListIndicesRandom figures;
private int rows;
@@ -33,30 +33,32 @@ namespace gbrainy.Games.Memory
private const double start_x_ques = 0.25;
private const double start_x_ans = 0.25;
private const double start_y = 0.15;
- private const double figure_size = 0.08;
+ private const double figure_size = 0.15;
private double rect_w, rect_h;
private int question_pos, question_answer;
private int figures_active;
- public enum FigureType
+ public enum Face
{
- Triangle,
- Rectangle,
- Diamond,
- Cercle,
- TriangleWithLine,
- RectangleWithLine,
- DiamondWithLine,
- CercleWithLine,
+ FaceBoy1,
+ FaceBoy2,
+ FaceBoy3,
+ FaceGirl1,
+ FaceGirl2,
+ FaceGirl3,
}
public override string Name {
- get {return Translations.GetString ("Memorize figures");}
+ get {return Translations.GetString ("Memorize faces");}
}
public override string MemoryQuestion {
get {
- return Translations.GetString ("In which cell is the other figure like the one shown below? Answer the cell number." );}
+ return Translations.GetString ("In which cell is the other face like the one shown below? Answer the cell number." );}
+ }
+
+ protected override bool SupportsShading {
+ get { return false; }
}
protected override void Initialize ()
@@ -65,18 +67,15 @@ namespace gbrainy.Games.Memory
switch (CurrentDifficulty) {
case GameDifficulty.Easy:
+ case GameDifficulty.Medium:
figures_active = 4;
rows = columns = 3;
break;
- case GameDifficulty.Medium:
+ case GameDifficulty.Master:
figures_active = 6;
rows = 3;
columns = 4;
break;
- case GameDifficulty.Master:
- figures_active = 8;
- columns = rows = 4;
- break;
}
rect_w = 0.65 / columns;
@@ -132,7 +131,7 @@ namespace gbrainy.Games.Memory
drawable_area.Data = fig;
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
- DrawFigure (e.Context, 0, 0, (FigureType) e.Data);
+ DrawFigure (e.Context, 0, 0, (Face) e.Data);
};
} else
@@ -182,7 +181,7 @@ namespace gbrainy.Games.Memory
if (fig >= figures_active)
fig -= figures_active;
- DrawFigure (gr, x, y, (FigureType) fig);
+ DrawFigure (gr, x, y, (Face) fig);
if (col >= columns) {
col = 0;
@@ -194,56 +193,37 @@ namespace gbrainy.Games.Memory
}
}
- private void DrawFigure (CairoContextEx gr, double x, double y, FigureType fig)
+ private void DrawFigure (CairoContextEx gr, double x, double y, Face fig)
{
double space_x, space_y;
+ string image;
space_x = (rect_w - figure_size) / 2;
space_y = (rect_h - figure_size) / 2;
switch (fig) {
- case FigureType.Triangle:
- gr.DrawEquilateralTriangle (x + space_x, y + space_y, figure_size);
- break;
- case FigureType.Rectangle:
- gr.Rectangle (x + space_x, y + space_y, figure_size, figure_size);
- gr.Stroke ();
- break;
- case FigureType.Diamond:
- gr.DrawDiamond (x + space_x, y + space_y, figure_size);
+ case Face.FaceBoy1:
+ image = "faceboy1.svg";
break;
- case FigureType.Cercle:
- gr.Arc (x + space_x + figure_size / 2, y + space_y + figure_size / 2, figure_size / 2, 0, 2 * Math.PI);
- gr.Stroke ();
+ case Face.FaceBoy2:
+ image = "faceboy2.svg";
break;
- case FigureType.TriangleWithLine:
- gr.DrawEquilateralTriangle (x + space_x, y + space_y, figure_size);
- gr.MoveTo (x + space_x + figure_size / 2, y + space_y);
- gr.LineTo (x + space_x + figure_size / 2, y + space_y + figure_size);
- gr.Stroke ();
+ case Face.FaceBoy3:
+ image = "faceboy3.svg";
break;
- case FigureType.RectangleWithLine:
- gr.Rectangle (x + space_x, y + space_y, figure_size, figure_size);
- gr.MoveTo (x + space_x, y + space_y);
- gr.LineTo (x + space_x + figure_size, y + space_y + figure_size);
- gr.MoveTo (x + space_x + figure_size, y + space_y);
- gr.LineTo (x + space_x, y + space_y + figure_size);
- gr.Stroke ();
+ case Face.FaceGirl1:
+ image = "facegirl1.svg";
break;
- case FigureType.DiamondWithLine:
- gr.DrawDiamond (x + space_x, y + space_y, figure_size);
- gr.MoveTo (x + space_x + figure_size / 2, y + space_y);
- gr.LineTo (x + space_x + figure_size / 2, y + space_y + figure_size);
- gr.Stroke ();
+ case Face.FaceGirl2:
+ image = "facegirl2.svg";
break;
- case FigureType.CercleWithLine:
- gr.Arc (x + space_x + figure_size / 2, y + space_y + figure_size / 2, figure_size / 2, 0, 2 * Math.PI);
- gr.Stroke ();
- gr.MoveTo (x + space_x + figure_size / 2, y + space_y);
- gr.LineTo (x + space_x + figure_size / 2, y + space_y + figure_size);
- gr.Stroke ();
+ case Face.FaceGirl3:
+ image = "facegirl3.svg";
break;
+ default:
+ throw new InvalidOperationException("Invalid value");
}
+ gr.DrawImageFromAssembly (image, x + space_x, y + space_y, figure_size, figure_size);
}
private void DrawGrid (CairoContextEx gr, double x, double y)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]