[gnome-nibbles/wip/vala] Move teensy classes, structs and enums at the top of the files



commit 2acfe15ffed5035d691078c04a45976c788e74d0
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date:   Sun Oct 25 21:28:28 2015 +0200

    Move teensy classes, structs and enums at the top of the files
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754608

 src/boni.vala         |   60 ++++++++--------
 src/nibbles-view.vala |  184 ++++++++++++++++++++++++------------------------
 src/worm.vala         |   48 +++++++-------
 3 files changed, 146 insertions(+), 146 deletions(-)
---
diff --git a/src/boni.vala b/src/boni.vala
index 890467c..a3412a6 100644
--- a/src/boni.vala
+++ b/src/boni.vala
@@ -19,6 +19,36 @@
 // This is a fairly literal translation of the LGPLv2+ original by
 // Sean MacIsaac, Ian Peters, Guillaume Béland.
 
+public enum BonusType
+{
+    REGULAR,
+    HALF,
+    DOUBLE,
+    LIFE,
+    REVERSE,
+    CUT,
+    SWITCH,
+    WARP
+}
+
+public class Bonus : Object
+{
+    public int x;
+    public int y;
+    public BonusType type;
+    public bool fake;
+    public int countdown;
+
+    public Bonus (int x, int y, BonusType type, bool fake, int countdown)
+    {
+        this.x = x;
+        this.y = y;
+        this.type = type;
+        this.fake = fake;
+        this.countdown = countdown;
+    }
+}
+
 public class Boni : Object
 {
     public Gee.LinkedList<Bonus> bonuses;
@@ -93,33 +123,3 @@ public class Boni : Object
         return null;
     }
 }
-
-public class Bonus : Object
-{
-    public int x;
-    public int y;
-    public BonusType type;
-    public bool fake;
-    public int countdown;
-
-    public Bonus (int x, int y, BonusType type, bool fake, int countdown)
-    {
-        this.x = x;
-        this.y = y;
-        this.type = type;
-        this.fake = fake;
-        this.countdown = countdown;
-    }
-}
-
-public enum BonusType
-{
-    REGULAR,
-    HALF,
-    DOUBLE,
-    LIFE,
-    REVERSE,
-    CUT,
-    SWITCH,
-    WARP
-}
diff --git a/src/nibbles-view.vala b/src/nibbles-view.vala
index 7961a92..ec12c8e 100644
--- a/src/nibbles-view.vala
+++ b/src/nibbles-view.vala
@@ -16,6 +16,98 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+private class WormActor : Clutter.Actor
+{
+    public override void show ()
+    {
+        base.show ();
+
+        set_opacity (0);
+        set_scale (3.0, 3.0);
+
+        save_easing_state ();
+        set_easing_mode (Clutter.AnimationMode.EASE_OUT_CIRC);
+        set_easing_duration (NibblesGame.GAMEDELAY * 26);
+        set_scale (1.0, 1.0);
+        set_pivot_point (0.5f, 0.5f);
+        set_opacity (0xff);
+        restore_easing_state ();
+    }
+
+    public override void hide ()
+    {
+        save_easing_state ();
+        set_easing_mode (Clutter.AnimationMode.EASE_IN_QUAD);
+        set_easing_duration (NibblesGame.GAMEDELAY * 15);
+        set_scale (0.4f, 0.4f);
+        set_opacity (0);
+        restore_easing_state ();
+    }
+}
+
+private class BonusTexture : GtkClutter.Texture
+{
+    public static const float SIZE_MULTIPLIER = 2;
+
+    public override void show ()
+    {
+        base.show ();
+
+        set_opacity (0);
+        set_scale (3.0, 3.0);
+
+        save_easing_state ();
+        set_easing_mode (Clutter.AnimationMode.EASE_OUT_BOUNCE);
+        set_easing_duration (NibblesGame.GAMEDELAY * 20);
+        set_scale (1.0, 1.0);
+        set_pivot_point (0.5f, 0.5f);
+        set_opacity (0xff);
+        restore_easing_state ();
+    }
+
+    public new void set_size (float width, float height)
+    {
+        base.set_size (SIZE_MULTIPLIER * width, SIZE_MULTIPLIER * height);
+    }
+}
+
+private class WarpTexture: GtkClutter.Texture
+{
+    public static const float SIZE_MULTIPLIER = 2;
+
+    public override void show ()
+    {
+        base.show ();
+
+        set_opacity (0);
+        set_scale (3.0, 3.0);
+
+        save_easing_state ();
+        set_easing_mode (Clutter.AnimationMode.EASE_OUT_CIRC);
+        set_easing_duration (NibblesGame.GAMEDELAY * 15);
+        set_scale (1.0, 1.0);
+        set_pivot_point (0.5f, 0.5f);
+        set_opacity (0xff);
+        restore_easing_state ();
+    }
+
+    public override void hide ()
+    {
+        save_easing_state ();
+        set_easing_mode (Clutter.AnimationMode.EASE_IN_QUAD);
+        set_easing_duration (NibblesGame.GAMEDELAY * 15);
+        set_scale (0.4f, 0.4f);
+        set_pivot_point (0.5f, 0.5f);
+        set_opacity (0);
+        restore_easing_state ();
+    }
+
+    public new void set_size (float width, float height)
+    {
+        base.set_size (SIZE_MULTIPLIER * width, SIZE_MULTIPLIER * height);
+    }
+}
+
 public class NibblesView : GtkClutter.Embed
 {
     /* Sound */
@@ -835,95 +927,3 @@ public class NibblesView : GtkClutter.Embed
         return color_lookup[colorval];
     }
 }
-
-private class WormActor : Clutter.Actor
-{
-    public override void show ()
-    {
-        base.show ();
-
-        set_opacity (0);
-        set_scale (3.0, 3.0);
-
-        save_easing_state ();
-        set_easing_mode (Clutter.AnimationMode.EASE_OUT_CIRC);
-        set_easing_duration (NibblesGame.GAMEDELAY * 26);
-        set_scale (1.0, 1.0);
-        set_pivot_point (0.5f, 0.5f);
-        set_opacity (0xff);
-        restore_easing_state ();
-    }
-
-    public override void hide ()
-    {
-        save_easing_state ();
-        set_easing_mode (Clutter.AnimationMode.EASE_IN_QUAD);
-        set_easing_duration (NibblesGame.GAMEDELAY * 15);
-        set_scale (0.4f, 0.4f);
-        set_opacity (0);
-        restore_easing_state ();
-    }
-}
-
-private class BonusTexture : GtkClutter.Texture
-{
-    public static const float SIZE_MULTIPLIER = 2;
-
-    public override void show ()
-    {
-        base.show ();
-
-        set_opacity (0);
-        set_scale (3.0, 3.0);
-
-        save_easing_state ();
-        set_easing_mode (Clutter.AnimationMode.EASE_OUT_BOUNCE);
-        set_easing_duration (NibblesGame.GAMEDELAY * 20);
-        set_scale (1.0, 1.0);
-        set_pivot_point (0.5f, 0.5f);
-        set_opacity (0xff);
-        restore_easing_state ();
-    }
-
-    public new void set_size (float width, float height)
-    {
-        base.set_size (SIZE_MULTIPLIER * width, SIZE_MULTIPLIER * height);
-    }
-}
-
-private class WarpTexture: GtkClutter.Texture
-{
-    public static const float SIZE_MULTIPLIER = 2;
-
-    public override void show ()
-    {
-        base.show ();
-
-        set_opacity (0);
-        set_scale (3.0, 3.0);
-
-        save_easing_state ();
-        set_easing_mode (Clutter.AnimationMode.EASE_OUT_CIRC);
-        set_easing_duration (NibblesGame.GAMEDELAY * 15);
-        set_scale (1.0, 1.0);
-        set_pivot_point (0.5f, 0.5f);
-        set_opacity (0xff);
-        restore_easing_state ();
-    }
-
-    public override void hide ()
-    {
-        save_easing_state ();
-        set_easing_mode (Clutter.AnimationMode.EASE_IN_QUAD);
-        set_easing_duration (NibblesGame.GAMEDELAY * 15);
-        set_scale (0.4f, 0.4f);
-        set_pivot_point (0.5f, 0.5f);
-        set_opacity (0);
-        restore_easing_state ();
-    }
-
-    public new void set_size (float width, float height)
-    {
-        base.set_size (SIZE_MULTIPLIER * width, SIZE_MULTIPLIER * height);
-    }
-}
diff --git a/src/worm.vala b/src/worm.vala
index 448ec8a..6b5a0fc 100644
--- a/src/worm.vala
+++ b/src/worm.vala
@@ -19,6 +19,30 @@
 // This is a fairly literal translation of the LGPLv2+ original by
 // Sean MacIsaac, Ian Peters, Guillaume Béland.
 
+public enum WormDirection
+{
+    NONE,
+    RIGHT,
+    DOWN,
+    LEFT,
+    UP
+}
+
+public struct Position
+{
+    int x;
+    int y;
+}
+
+public struct WormProperties
+{
+    int color;
+    uint up;
+    uint down;
+    uint left;
+    uint right;
+}
+
 public class Worm : Object
 {
     public const int STARTING_LENGTH = 5;
@@ -762,27 +786,3 @@ public class Worm : Object
         }
     }
 }
-
-public struct Position
-{
-    int x;
-    int y;
-}
-
-public enum WormDirection
-{
-    NONE,
-    RIGHT,
-    DOWN,
-    LEFT,
-    UP
-}
-
-public struct WormProperties
-{
-    int color;
-    uint up;
-    uint down;
-    uint left;
-    uint right;
-}


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