[gnome-nibbles/arnaudb/wip/gtk4: 33/62] Things 1.



commit 94d209d2eeb45dac9a2b300dc88df11b2d78e365
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sun May 31 00:02:39 2020 +0200

    Things 1.

 src/nibbles-view.vala | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)
---
diff --git a/src/nibbles-view.vala b/src/nibbles-view.vala
index 70807b3..a0d7702 100644
--- a/src/nibbles-view.vala
+++ b/src/nibbles-view.vala
@@ -20,13 +20,19 @@ using Gtk;
 
 private class WormView : Object
 {
-    private List<Widget> widgets;
+    private List<Widget> widgets = new List<Widget> ();
 
     internal void set_opacity (uint8 new_opacity)
     {
         foreach (Widget widget in widgets)
             widget.set_opacity (new_opacity);
     }
+
+    internal void unparent ()
+    {
+        foreach (Widget widget in widgets)
+            widget.unparent ();
+    }
 //    protected override void show ()
 //    {
 //        base.show ();
@@ -54,7 +60,7 @@ private class WormView : Object
 //    }
 }
 
-private class BonusTexture : Object
+private class BonusTexture : Widget
 {
 //    private const float SIZE_MULTIPLIER = 2;
 
@@ -80,7 +86,7 @@ private class BonusTexture : Object
 //    }
 }
 
-private class WarpTexture: Object
+private class WarpTexture: Widget
 {
 //    private const float SIZE_MULTIPLIER = 2;
 
@@ -239,11 +245,11 @@ private class NibblesView : Widget
             actor.unparent ();
         warp_actors.clear ();
 
-        if (level != null)
-        {
+//        if (level != null)
+//        {
 //            level.remove_all_children ();
 //            stage.remove_child (level);
-        }
+//        }
 //        level = new Clutter.Actor ();
 
         string? line;
@@ -344,8 +350,9 @@ private class NibblesView : Widget
                 if (tmp != null)
                 {
                     ((!) tmp).insert_after (this, /* insert first */ null);
-                    GridLayoutChild child_layout = layout.get_layout_child ((!) tmp);
-                    child_layout.set_position (i, j);
+                    GridLayoutChild child_layout = (GridLayoutChild) layout.get_layout_child ((!) tmp);
+                    child_layout.set_left_attach (i);
+                    child_layout.set_top_attach (j);
                 }
             }
         }
@@ -472,8 +479,8 @@ private class NibblesView : Widget
         int board_width, board_height;
 //        float x_pos, y_pos;
 
-        if (level == null)
-            return;
+//        if (level == null)
+//            return;
 
         board_width = NibblesGame.WIDTH * new_tile_size;
         board_height = NibblesGame.HEIGHT * new_tile_size;
@@ -511,8 +518,8 @@ private class NibblesView : Widget
 
     private void animate_end_game_cb ()
     {
-        foreach (var worm in game.worms)
-            worm_actors.@get (worm).hide ();
+//        foreach (var worm in game.worms)
+//            worm_actors.@get (worm).hide ();
 
         foreach (var actor in warp_actors)
             actor.hide ();
@@ -765,7 +772,7 @@ private class NibblesView : Widget
     private void bonus_applied_cb (Bonus bonus, Worm worm)
     {
         var actors = worm_actors.@get (worm);
-        var actor = actors.last_child;
+//        var actor = actors.last_child;
 
 //        actor.save_easing_state ();
 //        actor.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUINT);


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