[gnome-nibbles/wip/vala: 64/64] Minor controls screen fix.
- From: Iulian Radu <iulianradu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-nibbles/wip/vala: 64/64] Minor controls screen fix.
- Date: Sun, 9 Aug 2015 12:56:48 +0000 (UTC)
commit 7b2058636e76091ce6b2427988c55d97f4b662ad
Author: Iulian Radu <iulian radu67 gmail com>
Date: Sun Aug 9 15:47:22 2015 +0300
Minor controls screen fix.
data/nibbles.ui | 13 +++++++++----
src/gnome-nibbles.vala | 10 +++++++---
src/nibbles-game.vala | 2 +-
src/nibbles-view.vala | 18 ++++++++++--------
src/worm.vala | 2 +-
5 files changed, 28 insertions(+), 17 deletions(-)
---
diff --git a/data/nibbles.ui b/data/nibbles.ui
index c1ac98b..de4db45 100644
--- a/data/nibbles.ui
+++ b/data/nibbles.ui
@@ -98,6 +98,7 @@
<property name="orientation">vertical</property>
<property name="width-request">350</property>
<property name="height-request">350</property>
+ <property name="halign">center</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
@@ -121,7 +122,8 @@
<child>
<object class="GtkToggleButton" id="players1">
<property name="visible">True</property>
- <property name="label">1</property>
+ <property name="use-underline">True</property>
+ <property name="label">_1</property>
<property name="width-request">200</property>
<property name="height-request">120</property>
<property name="valign">3</property>
@@ -135,7 +137,8 @@
<child>
<object class="GtkToggleButton" id="players2">
<property name="visible">True</property>
- <property name="label">2</property>
+ <property name="use-underline">True</property>
+ <property name="label">_2</property>
<property name="width-request">200</property>
<property name="height-request">120</property>
<property name="valign">3</property>
@@ -149,7 +152,8 @@
<child>
<object class="GtkToggleButton" id="players3">
<property name="visible">True</property>
- <property name="label">3</property>
+ <property name="use-underline">True</property>
+ <property name="label">_3</property>
<property name="width-request">200</property>
<property name="height-request">120</property>
<property name="valign">3</property>
@@ -163,7 +167,8 @@
<child>
<object class="GtkToggleButton" id="players4">
<property name="visible">True</property>
- <property name="label">4</property>
+ <property name="use-underline">True</property>
+ <property name="label">_4</property>
<property name="width-request">200</property>
<property name="height-request">120</property>
<property name="valign">3</property>
diff --git a/src/gnome-nibbles.vala b/src/gnome-nibbles.vala
index 5e03345..5fdd34d 100644
--- a/src/gnome-nibbles.vala
+++ b/src/gnome-nibbles.vala
@@ -189,12 +189,12 @@ public class Nibbles : Gtk.Application
protected override void shutdown ()
{
- base.shutdown ();
-
settings.set_int ("window-width", window_width);
settings.set_int ("window-height", window_height);
settings.set_boolean ("window-is-maximized", is_maximized);
game.save_properties (settings);
+
+ base.shutdown ();
}
/*\
@@ -337,7 +337,7 @@ public class Nibbles : Gtk.Application
if (button.get_active ())
{
var label = button.get_label ();
- game.numhumans = int.parse (label);
+ game.numhumans = int.parse (label.replace ("_", ""));
}
}
@@ -709,6 +709,7 @@ public class ControlsGrid : Gtk.Grid
{
var rotated_pixbuf = arrow_key.rotate_simple (Gdk.PixbufRotation.NONE);
move_up.add_overlay (new Gtk.Image.from_pixbuf (rotated_pixbuf));
+ move_up.show_all ();
}
else
move_up_label.set_markup (@"<b>$(upper_key)</b>");
@@ -718,6 +719,7 @@ public class ControlsGrid : Gtk.Grid
{
var rotated_pixbuf = arrow_key.rotate_simple (Gdk.PixbufRotation.UPSIDEDOWN);
move_down.add_overlay (new Gtk.Image.from_pixbuf (rotated_pixbuf));
+ move_down.show_all ();
}
else
move_down_label.set_markup (@"<b>$(upper_key)</b>");
@@ -727,6 +729,7 @@ public class ControlsGrid : Gtk.Grid
{
var rotated_pixbuf = arrow_key.rotate_simple (Gdk.PixbufRotation.COUNTERCLOCKWISE);
move_left.add_overlay (new Gtk.Image.from_pixbuf (rotated_pixbuf));
+ move_left.show_all ();
}
else
move_left_label.set_markup (@"<b>$(upper_key)</b>");
@@ -736,6 +739,7 @@ public class ControlsGrid : Gtk.Grid
{
var rotated_pixbuf = arrow_key.rotate_simple (Gdk.PixbufRotation.CLOCKWISE);
move_right.add_overlay (new Gtk.Image.from_pixbuf (rotated_pixbuf));
+ move_right.show_all ();
}
else
move_right_label.set_markup (@"<b>$(upper_key)</b>");
diff --git a/src/nibbles-game.vala b/src/nibbles-game.vala
index f61f03e..43fe8da 100644
--- a/src/nibbles-game.vala
+++ b/src/nibbles-game.vala
@@ -239,7 +239,7 @@ public class NibblesGame : Object
{
if (!dead_worms.contains (worm))
dead_worms.add (worm);
- if (!dead_worms.contains (worm))
+ if (!dead_worms.contains (other_worm))
dead_worms.add (other_worm);
continue;
}
diff --git a/src/nibbles-view.vala b/src/nibbles-view.vala
index 8a7c407..216ae5c 100644
--- a/src/nibbles-view.vala
+++ b/src/nibbles-view.vala
@@ -360,25 +360,27 @@ public class NibblesView : GtkClutter.Embed
var label = new Clutter.Text.with_text ("Source Pro 10", _(@"<b>PLAYER $(worm.id + 1)</b>"));
label.set_use_markup (true);
+ label.set_pivot_point (0.5f, 0.5f);
label.set_color (Clutter.Color.from_string (colorval_name (color)));
+
// TODO: Better aligb these
switch (worm.direction)
{
case WormDirection.UP:
- label.x = (worm.head ().x - 4) * game.tile_size;
- label.y = (worm.head ().y - 8) * game.tile_size;
+ label.set_x (worm.head ().x * game.tile_size);
+ label.set_y (worm.head ().y * game.tile_size);
break;
case WormDirection.DOWN:
- label.x = (worm.head ().x - 4) * game.tile_size;
- label.y = (worm.head ().y - 2) * game.tile_size;
+ label.set_x (worm.head ().x * game.tile_size);
+ label.set_y (worm.head ().y * game.tile_size);
break;
case WormDirection.LEFT:
- label.x = (worm.head ().x - 6) * game.tile_size;
- label.y = (worm.head ().y - 4) * game.tile_size;
+ label.set_x (worm.head ().x * game.tile_size);
+ label.set_y (worm.head ().y * game.tile_size);
break;
case WormDirection.RIGHT:
- label.x = (worm.head ().x - 0) * game.tile_size;
- label.y = (worm.head ().y - 4) * game.tile_size;
+ label.set_x (worm.head ().x * game.tile_size);
+ label.set_y (worm.head ().y * game.tile_size);
break;
default:
break;
diff --git a/src/worm.vala b/src/worm.vala
index a11f95c..8bee155 100644
--- a/src/worm.vala
+++ b/src/worm.vala
@@ -22,7 +22,7 @@
public class Worm : Object
{
public const int STARTING_LENGTH = 5;
- private const int STARTING_LIVES = 2;
+ private const int STARTING_LIVES = 6;
public const int GROW_FACTOR = 4;
public Position starting_position { get; private set; }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]