[gnome-nibbles/wip/vala: 24/64] Fix background image not being the right size when starting the game



commit 6f5dc1ead1b4f25409d70774fa5a502cf7f62feb
Author: Iulian Radu <iulian radu67 gmail com>
Date:   Mon Jun 29 02:18:58 2015 +0300

    Fix background image not being the right size when starting the game

 src/nibbles-view.vala |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/src/nibbles-view.vala b/src/nibbles-view.vala
index dd4bc51..ef2a17f 100644
--- a/src/nibbles-view.vala
+++ b/src/nibbles-view.vala
@@ -43,7 +43,6 @@ public class NibblesView : GtkClutter.Embed
     public Gee.HashMap<Worm, WormActor> worm_actors;
 
     public const int NUM_COLORS = 7;
-
     public static string[] color_lookup =
     {
       "red",
@@ -66,20 +65,12 @@ public class NibblesView : GtkClutter.Embed
         set_size_request (NibblesGame.MINIMUM_TILE_SIZE * NibblesGame.WIDTH,
                           NibblesGame.MINIMUM_TILE_SIZE * NibblesGame.HEIGHT);
 
+        surface = new GtkClutter.Texture ();
         try
         {
             var pixbuf = new Gdk.Pixbuf.from_file (Path.build_filename (PKGDATADIR, "pixmaps", 
"wall-small-empty.svg"));
-            surface = new GtkClutter.Texture ();
-            surface.set_from_pixbuf (pixbuf);
-
-            var val = Value (typeof (bool));
-            val.set_boolean (true);
-            surface.set_opacity (100);
-
-            surface.set_property ("repeat-x", val);
-            surface.set_property ("repeat-y", val);
 
-            surface.set_position (0, 0);
+            surface.set_from_pixbuf (pixbuf);
         }
         catch (Clutter.TextureError e)
         {
@@ -92,6 +83,14 @@ public class NibblesView : GtkClutter.Embed
             error (_("Nibbles failed to load texture: %s"), e.message);
         }
 
+        surface.set_property ("repeat-x", true);
+        surface.set_property ("repeat-y", true);
+
+        surface.set_position (0, 0);
+        surface.set_size (game.tile_size * NibblesGame.WIDTH,
+                          game.tile_size * NibblesGame.HEIGHT);
+        surface.set_opacity (100);
+
         worm_actors = new Gee.HashMap<Worm, WormActor> ();
 
         load_pixmap ();


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