[gnome-nibbles/arnaudb/wip/gtk4: 167/188] Make walls display correctly.




commit 0bfc8b72cfe7bce58bad31f1a45dce0ccbf916d3
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Tue Jun 16 15:53:37 2020 +0200

    Make walls display correctly.

 data/pix/empty.svg    | 24 ++++++++++++++++++++++++
 data/pix/meson.build  |  1 +
 src/nibbles-view.vala | 11 +++++++----
 3 files changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/data/pix/empty.svg b/data/pix/empty.svg
new file mode 100644
index 0000000..78ef48a
--- /dev/null
+++ b/data/pix/empty.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   id="svg1"
+   width="177.16536px"
+   height="177.16536px"
+   version="1.1">
+  <metadata
+     id="metadata1424">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+</svg>
diff --git a/data/pix/meson.build b/data/pix/meson.build
index e9ef8fc..43b4680 100644
--- a/data/pix/meson.build
+++ b/data/pix/meson.build
@@ -27,6 +27,7 @@ small_pix = [
     'wall-tee-left.svg',
     'wall-tee-right.svg',
     'wall-tee-up.svg',
+    'empty.svg'
 ]
 
 scoreboard_pix = [
diff --git a/src/nibbles-view.vala b/src/nibbles-view.vala
index 5d45c0a..9fc39ca 100644
--- a/src/nibbles-view.vala
+++ b/src/nibbles-view.vala
@@ -133,7 +133,7 @@ private class NibblesView : Widget
     public int tile_size { internal get; protected construct set; }
 
     /* Pixmaps */
-    private Gdk.Pixbuf wall_pixmaps[11];
+    private Gdk.Pixbuf wall_pixmaps[12];
     private Gdk.Pixbuf worm_pixmaps[6];
     private Gdk.Pixbuf boni_pixmaps[9];
 
@@ -284,6 +284,7 @@ private class NibblesView : Widget
                     switch (game.board[j, i])
                     {
                         case 'a':   // the most common thing on top in the switch
+                            tmp = new Image.from_pixbuf (wall_pixmaps[11]);
                             break;
 
                         case 'b': // straight up
@@ -352,10 +353,11 @@ private class NibblesView : Widget
 
                 if (tmp != null)
                 {
+                    ((!) tmp).pixel_size = tile_size;
                     ((!) tmp).insert_after (this, /* insert first */ null);
                     GridLayoutChild child_layout = (GridLayoutChild) layout.get_layout_child ((!) tmp);
-                    child_layout.set_left_attach (i);
-                    child_layout.set_top_attach (j);
+                    child_layout.set_left_attach (j);
+                    child_layout.set_top_attach (i);
                 }
             }
         }
@@ -420,7 +422,8 @@ private class NibblesView : Widget
             "wall-tee-right.svg",
             "wall-tee-left.svg",
             "wall-tee-down.svg",
-            "wall-cross.svg"
+            "wall-cross.svg",
+            "empty.svg"
         };
 
         string[] worm_files =


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