[gnome-nibbles/arnaudb/wip/gtk4: 32/40] Make walls display correctly.



commit 98674f0a16fc3ee054c7306d80cb0380acc2dbd9
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 e70792e..ba250a1 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 a0d7702..04bb41b 100644
--- a/src/nibbles-view.vala
+++ b/src/nibbles-view.vala
@@ -129,7 +129,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];
 
@@ -280,6 +280,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
@@ -349,10 +350,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);
                 }
             }
         }
@@ -417,7 +419,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]