Bläddra i källkod

Checkin before upgrade to VS2013

Marko Pintera 12 år sedan
förälder
incheckning
f77359b863

+ 0 - 4
CSharpWrap.txt

@@ -146,10 +146,6 @@ Should I make sprite texture a resource?
 
  Consider moving all script stuff in a separate static lib?
 
-IMMEDIATE: 
- - Fix the macros.
- - Move them to a separate file.
-
 IGNORE RESOURCES FOR NOW. When building the GUI make sure that they all temporarily use the native skin
 
 

+ 16 - 0
MBansheeEngine/GUI.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Runtime.CompilerServices;
+
+namespace BansheeEngine
+{
+    public sealed class GUI : GUIBase
+    {
+        internal GUI()
+        {
+            Internal_CreateInstance(this);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUI instance);
+    }
+}

+ 41 - 0
MBansheeEngine/GUIArea.cs

@@ -0,0 +1,41 @@
+using System;
+using System.Runtime.CompilerServices;
+
+namespace BansheeEngine
+{
+    public sealed class GUIArea : ScriptObject
+    {
+        private GUILayout _layout;
+
+        public GUILayout layout
+        {
+            get { return _layout;}
+        }
+
+        public enum ResizeAxis
+        {
+            X,
+            Y,
+            XY
+        }
+
+        internal GUIArea(GUIBase parent, int x, int y, int width, int height, short depth)
+        {
+            Internal_CreateInstance(this, parent, x, y, width, height, depth);
+            _layout = new LayoutX(this);
+        }
+
+        internal GUIArea(GUIBase parent, int offsetLeft, int offsetRight, int offsetTop, int offsetBottom, ResizeAxis resizeAxis, short depth)
+        {
+            Internal_CreateResizableInstance(this, parent, offsetLeft, offsetRight, offsetTop, offsetBottom, resizeAxis, depth);
+            _layout = new LayoutX(this);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUIArea instance, GUIBase parent, int x, int y, int width, int height, short depth);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateResizableInstance(GUIArea instance, GUIBase parent, int offsetLeft, int offsetRight, int offsetTop, 
+            int offsetBottom, ResizeAxis resizeAxis, short depth);
+    }
+}

+ 37 - 0
MBansheeEngine/GUIBase.cs

@@ -0,0 +1,37 @@
+using System;
+using System.Runtime.CompilerServices;
+
+namespace BansheeEngine
+{
+    public class GUIBase : ScriptObject
+    {
+        private GUIArea mainArea;
+        private GUILayout _mainLayout;
+
+        public GUILayout main
+        {
+            get { return _mainLayout; }
+        }
+
+        internal GUIBase()
+        {
+            Internal_CreateInstance(this);
+
+            mainArea = AddResizableArea(0, 0, 0, 0, GUIArea.ResizeAxis.XY);
+            _mainLayout = mainArea.layout;
+        }
+
+        public GUIArea AddArea(int x, int y, int width = 0, int height = 0, short depth = 0)
+        {
+            return new GUIArea(this, x, y, width, height, depth);
+        }
+
+        public GUIArea AddResizableArea(int offsetLeft, int offsetRight, int offsetTop, int offsetBottom, GUIArea.ResizeAxis resizeAxis, short depth = 0)
+        {
+            return new GUIArea(this, offsetLeft, offsetRight, offsetTop, offsetBottom, resizeAxis, depth);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUIBase instance);
+    }
+}

+ 16 - 0
MBansheeEngine/GUILayout.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Runtime.CompilerServices;
+
+namespace BansheeEngine
+{
+    public class GUILayout : ScriptObject
+    {
+        internal GUILayout()
+        {
+            Internal_CreateInstance(this);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUILayout instance);
+    }
+}

+ 16 - 0
MBansheeEngine/GUILayoutX.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Runtime.CompilerServices;
+
+namespace BansheeEngine
+{
+    public class GUILayoutX : GUILayout
+    {
+        internal GUILayoutX()
+        {
+            Internal_CreateInstance(this);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUILayoutX instance);
+    }
+}

+ 16 - 0
MBansheeEngine/GUILayoutY.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Runtime.CompilerServices;
+
+namespace BansheeEngine
+{
+    public sealed class GUILayoutY : GUILayout
+    {
+        internal GUILayoutY()
+        {
+            Internal_CreateInstance(this);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUILayoutY instance);
+    }
+}

+ 6 - 0
MBansheeEngine/MBansheeEngine.csproj

@@ -45,8 +45,14 @@
     <Compile Include="BuiltinResources.cs" />
     <Compile Include="Color.cs" />
     <Compile Include="Font.cs" />
+    <Compile Include="GUI.cs" />
+    <Compile Include="GUIArea.cs" />
+    <Compile Include="GUIBase.cs" />
     <Compile Include="GUIElementStateStyle.cs" />
     <Compile Include="GUIElementStyle.cs" />
+    <Compile Include="GUILayout.cs" />
+    <Compile Include="GUILayoutX.cs" />
+    <Compile Include="GUILayoutY.cs" />
     <Compile Include="GUIWidget.cs" />
     <Compile Include="MathEx.cs" />
     <Compile Include="Matrix3.cs" />