[gnome-nibbles/arnaudb/wip/gtk4] Improve end-of-level look.



commit 7a91c73f1a098f51b4b457278a003e2b720c34b2
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed Jun 17 17:34:01 2020 +0200

    Improve end-of-level look.

 src/nibbles-view.vala   | 14 +++++++++++---
 src/nibbles-window.vala |  4 ++--
 2 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/src/nibbles-view.vala b/src/nibbles-view.vala
index 7e318ef..f19e673 100644
--- a/src/nibbles-view.vala
+++ b/src/nibbles-view.vala
@@ -132,6 +132,17 @@ private class NibblesView : Widget
         load_pixmap ();
     }
 
+    internal void hide_content ()
+    {
+        foreach (var actor in bonus_actors.values)
+        {
+            actor.hide ();
+            actor.unparent ();
+            actor.destroy ();
+        }
+        bonus_actors.clear ();
+    }
+
 //    protected override bool configure_event (Gdk.EventConfigure event)
 //    {
 //        int new_tile_size, ts_x, ts_y;
@@ -491,9 +502,6 @@ private class NibblesView : Widget
         foreach (var worm in game.worms)
             worm_actors.@get (worm).hide ();
 
-        foreach (var actor in warp_actors)
-            actor.hide ();
-
 //        level.save_easing_state ();
 //        level.set_easing_mode (Clutter.AnimationMode.EASE_IN_QUAD);
 //        level.set_easing_duration (NibblesGame.GAMEDELAY * 20);
diff --git a/src/nibbles-window.vala b/src/nibbles-window.vala
index 1d980c5..140e6e3 100644
--- a/src/nibbles-window.vala
+++ b/src/nibbles-window.vala
@@ -774,7 +774,7 @@ private class NibblesWindow : ApplicationWindow
         if (game.current_level == NibblesGame.MAX_LEVEL)
             return;
 
-        view.hide ();
+        view.hide_content ();
 
         new_game_action.set_enabled (false);
         pause_action.set_enabled (false);
@@ -913,7 +913,7 @@ private class NibblesWindow : ApplicationWindow
 
         button.grab_focus ();
 
-        view.hide ();
+        view.hide_content ();
         new_game_action.set_enabled (false);
         pause_action.set_enabled (false);
         back_action.set_enabled (false);


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