[gnome-mines] Added new classes for game ended cases
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-mines] Added new classes for game ended cases
- Date: Wed, 23 Apr 2014 10:45:40 +0000 (UTC)
commit fc9f080acadf1571f737d82bbf9b0a033d0e1879
Author: Robert Roth <robert roth off gmail com>
Date: Wed Apr 23 13:37:29 2014 +0300
Added new classes for game ended cases
data/gnome-mines.css.in | 10 ++++++++++
src/minefield-view.vala | 10 +++++++++-
2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/data/gnome-mines.css.in b/data/gnome-mines.css.in
index 9ef6cc1..317d72d 100644
--- a/data/gnome-mines.css.in
+++ b/data/gnome-mines.css.in
@@ -73,3 +73,13 @@ Changes are applied instantly and globally, for the whole application.
color: white;
font-size:32px;
}
+
+.explodedField {
+ border-width:1px;
+ border-color:red;
+}
+
+.completedField {
+ border-width:1px;
+ border-color:green;
+}
diff --git a/src/minefield-view.vala b/src/minefield-view.vala
index 16726e4..a3fa27f 100644
--- a/src/minefield-view.vala
+++ b/src/minefield-view.vala
@@ -260,7 +260,7 @@ public class MinefieldView : Gtk.Grid
_minefield.redraw_sector.connect (redraw_sector_cb);
_minefield.explode.connect (explode_cb);
_minefield.paused_changed.connect (() => { queue_draw (); });
-
+ _minefield.cleared.connect (complete_cb);
queue_resize ();
}
}
@@ -354,8 +354,16 @@ public class MinefieldView : Gtk.Grid
/* Show the mines that we missed or the flags that were wrong */
for (var x = 0; x < minefield.width; x++)
for (var y = 0; y < minefield.height; y++)
+ {
+ mines[x, y].add_class ("explodedField");
if (minefield.has_mine (x, y) || (!minefield.has_mine (x, y) && minefield.get_flag (x, y) ==
FlagType.FLAG))
redraw_sector_cb (x, y);
+ }
+ }
+
+ private void complete_cb (Minefield minefield)
+ {
+ forall ( (child) => { ((Tile)child).add_class("completedField"); } );
}
public override void get_preferred_width (out int minimum, out int natural)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]