Просмотр исходного кода

Modifying engine GUI elements so they don't pass structures by value in internal calls

BearishSun 10 лет назад
Родитель
Сommit
a5d7369e0c
37 измененных файлов с 1410 добавлено и 1390 удалено
  1. 2 2
      MBansheeEngine/GUI/GUIButton.cs
  2. 16 6
      MBansheeEngine/GUI/GUIElement.cs
  3. 16 16
      MBansheeEngine/GUI/GUIElementStyle.cs
  4. 2 2
      MBansheeEngine/GUI/GUILabel.cs
  5. 2 2
      MBansheeEngine/GUI/GUIListBox.cs
  6. 66 66
      MBansheeEngine/GUI/GUIProgressBar.cs
  7. 87 87
      MBansheeEngine/GUI/GUIRenderTexture.cs
  8. 7 2
      MBansheeEngine/GUI/GUIScrollArea.cs
  9. 245 245
      MBansheeEngine/GUI/GUISlider.cs
  10. 2 2
      MBansheeEngine/GUI/GUITextBox.cs
  11. 2 2
      MBansheeEngine/GUI/GUITexture.cs
  12. 2 2
      MBansheeEngine/GUI/GUIToggle.cs
  13. 1 1
      SBansheeEngine/Include/BsScriptGUIButton.h
  14. 162 162
      SBansheeEngine/Include/BsScriptGUIElement.h
  15. 11 11
      SBansheeEngine/Include/BsScriptGUIElementStyle.h
  16. 1 1
      SBansheeEngine/Include/BsScriptGUIInputBox.h
  17. 1 1
      SBansheeEngine/Include/BsScriptGUILabel.h
  18. 1 1
      SBansheeEngine/Include/BsScriptGUIListBox.h
  19. 26 26
      SBansheeEngine/Include/BsScriptGUIProgressBar.h
  20. 26 26
      SBansheeEngine/Include/BsScriptGUIRenderTexture.h
  21. 1 1
      SBansheeEngine/Include/BsScriptGUIScrollArea.h
  22. 70 70
      SBansheeEngine/Include/BsScriptGUISlider.h
  23. 1 1
      SBansheeEngine/Include/BsScriptGUITexture.h
  24. 1 1
      SBansheeEngine/Include/BsScriptGUIToggle.h
  25. 2 2
      SBansheeEngine/Source/BsScriptGUIButton.cpp
  26. 311 305
      SBansheeEngine/Source/BsScriptGUIElement.cpp
  27. 22 22
      SBansheeEngine/Source/BsScriptGUIElementStyle.cpp
  28. 2 2
      SBansheeEngine/Source/BsScriptGUIInputBox.cpp
  29. 2 2
      SBansheeEngine/Source/BsScriptGUILabel.cpp
  30. 2 2
      SBansheeEngine/Source/BsScriptGUIListBox.cpp
  31. 63 63
      SBansheeEngine/Source/BsScriptGUIProgressBar.cpp
  32. 64 64
      SBansheeEngine/Source/BsScriptGUIRenderTexture.cpp
  33. 2 2
      SBansheeEngine/Source/BsScriptGUIScrollArea.cpp
  34. 185 185
      SBansheeEngine/Source/BsScriptGUISlider.cpp
  35. 2 2
      SBansheeEngine/Source/BsScriptGUITexture.cpp
  36. 2 2
      SBansheeEngine/Source/BsScriptGUIToggle.cpp
  37. 0 1
      TODO.txt

+ 2 - 2
MBansheeEngine/GUI/GUIButton.cs

@@ -85,7 +85,7 @@ namespace BansheeEngine
         /// <param name="color">Tint to apply to the element.</param>
         public void SetTint(Color color)
         {
-            Internal_SetTint(mCachedPtr, color);
+            Internal_SetTint(mCachedPtr, ref color);
         }
 
         /// <summary>
@@ -132,6 +132,6 @@ namespace BansheeEngine
         private static extern void Internal_SetContent(IntPtr nativeInstance, GUIContent content);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
     }
 }

+ 16 - 6
MBansheeEngine/GUI/GUIElement.cs

@@ -42,8 +42,13 @@ namespace BansheeEngine
         /// </summary>
         public Rect2I Bounds
         {
-            get { return Internal_GetBounds(mCachedPtr); }
-            set { Internal_SetBounds(mCachedPtr, value); }
+            get
+            {
+                Rect2I bounds;
+                Internal_GetBounds(mCachedPtr, out bounds);
+                return bounds;
+            }
+            set { Internal_SetBounds(mCachedPtr, ref value); }
         }
 
         /// <summary>
@@ -51,7 +56,12 @@ namespace BansheeEngine
         /// </summary>
         public Rect2I VisualBounds
         {
-            get { return Internal_GetVisualBounds(mCachedPtr); }
+            get
+            {
+                Rect2I bounds;
+                Internal_GetVisualBounds(mCachedPtr, out bounds);
+                return bounds;
+            }
         }
 
         /// <summary>
@@ -241,13 +251,13 @@ namespace BansheeEngine
         private static extern void Internal_ResetDimensions(IntPtr nativeInstance);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern Rect2I Internal_GetBounds(IntPtr nativeInstance);
+        private static extern void Internal_GetBounds(IntPtr nativeInstance, out Rect2I value);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetBounds(IntPtr nativeInstance, Rect2I value);
+        private static extern void Internal_SetBounds(IntPtr nativeInstance, ref Rect2I value);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern Rect2I Internal_GetVisualBounds(IntPtr nativeInstance);
+        private static extern void Internal_GetVisualBounds(IntPtr nativeInstance, out Rect2I value);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetContextMenu(IntPtr nativeInstance, IntPtr contextMenu);

+ 16 - 16
MBansheeEngine/GUI/GUIElementStyle.cs

@@ -117,7 +117,7 @@ namespace BansheeEngine
         public GUIElementStateStyle Normal
         {
             get { GUIElementStateStyle value; Internal_GetNormal(mCachedPtr, out value); return value; }
-            set { Internal_SetNormal(mCachedPtr, value); }
+            set { Internal_SetNormal(mCachedPtr, ref value); }
         }
 
         /// <summary>
@@ -126,7 +126,7 @@ namespace BansheeEngine
         public GUIElementStateStyle Hover
         {
             get { GUIElementStateStyle value; Internal_GetHover(mCachedPtr, out value); return value; }
-            set { Internal_SetHover(mCachedPtr, value); }
+            set { Internal_SetHover(mCachedPtr, ref value); }
         }
 
         /// <summary>
@@ -135,7 +135,7 @@ namespace BansheeEngine
         public GUIElementStateStyle Active
         {
             get { GUIElementStateStyle value; Internal_GetActive(mCachedPtr, out value); return value; }
-            set { Internal_SetActive(mCachedPtr, value); }
+            set { Internal_SetActive(mCachedPtr, ref value); }
         }
 
         /// <summary>
@@ -144,7 +144,7 @@ namespace BansheeEngine
         public GUIElementStateStyle Focused
         {
             get { GUIElementStateStyle value; Internal_GetFocused(mCachedPtr, out value); return value; }
-            set { Internal_SetFocused(mCachedPtr, value); }
+            set { Internal_SetFocused(mCachedPtr, ref value); }
         }
 
 
@@ -154,7 +154,7 @@ namespace BansheeEngine
         public GUIElementStateStyle NormalOn
         {
             get { GUIElementStateStyle value; Internal_GetNormalOn(mCachedPtr, out value); return value; }
-            set { Internal_SetNormalOn(mCachedPtr, value); }
+            set { Internal_SetNormalOn(mCachedPtr, ref value); }
         }
 
         /// <summary>
@@ -163,7 +163,7 @@ namespace BansheeEngine
         public GUIElementStateStyle HoverOn
         {
             get { GUIElementStateStyle value; Internal_GetHoverOn(mCachedPtr, out value); return value; }
-            set { Internal_SetHoverOn(mCachedPtr, value); }
+            set { Internal_SetHoverOn(mCachedPtr, ref value); }
         }
 
         /// <summary>
@@ -172,7 +172,7 @@ namespace BansheeEngine
         public GUIElementStateStyle ActiveOn
         {
             get { GUIElementStateStyle value; Internal_GetActiveOn(mCachedPtr, out value); return value; }
-            set { Internal_SetActiveOn(mCachedPtr, value); }
+            set { Internal_SetActiveOn(mCachedPtr, ref value); }
         }
 
         /// <summary>
@@ -181,7 +181,7 @@ namespace BansheeEngine
         public GUIElementStateStyle FocusedOn
         {
             get { GUIElementStateStyle value; Internal_GetFocusedOn(mCachedPtr, out value); return value; }
-            set { Internal_SetFocusedOn(mCachedPtr, value); }
+            set { Internal_SetFocusedOn(mCachedPtr, ref value); }
         }
 
 
@@ -336,43 +336,43 @@ namespace BansheeEngine
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_GetNormal(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern void Internal_SetNormal(IntPtr nativeInstance, GUIElementStateStyle value);
+        private static extern void Internal_SetNormal(IntPtr nativeInstance, ref GUIElementStateStyle value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_GetHover(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern void Internal_SetHover(IntPtr nativeInstance, GUIElementStateStyle value);
+        private static extern void Internal_SetHover(IntPtr nativeInstance, ref GUIElementStateStyle value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_GetActive(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern void Internal_SetActive(IntPtr nativeInstance, GUIElementStateStyle value);
+        private static extern void Internal_SetActive(IntPtr nativeInstance, ref GUIElementStateStyle value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_GetFocused(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern void Internal_SetFocused(IntPtr nativeInstance, GUIElementStateStyle value);
+        private static extern void Internal_SetFocused(IntPtr nativeInstance, ref GUIElementStateStyle value);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_GetNormalOn(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern void Internal_SetNormalOn(IntPtr nativeInstance, GUIElementStateStyle value);
+        private static extern void Internal_SetNormalOn(IntPtr nativeInstance, ref GUIElementStateStyle value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_GetHoverOn(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern void Internal_SetHoverOn(IntPtr nativeInstance, GUIElementStateStyle value);
+        private static extern void Internal_SetHoverOn(IntPtr nativeInstance, ref GUIElementStateStyle value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_GetActiveOn(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern void Internal_SetActiveOn(IntPtr nativeInstance, GUIElementStateStyle value);
+        private static extern void Internal_SetActiveOn(IntPtr nativeInstance, ref GUIElementStateStyle value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_GetFocusedOn(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern void Internal_SetFocusedOn(IntPtr nativeInstance, GUIElementStateStyle value);
+        private static extern void Internal_SetFocusedOn(IntPtr nativeInstance, ref GUIElementStateStyle value);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)] 

+ 2 - 2
MBansheeEngine/GUI/GUILabel.cs

@@ -60,7 +60,7 @@ namespace BansheeEngine
         /// <param name="color">Tint to apply to the element.</param>
         public void SetTint(Color color)
         {
-            Internal_SetTint(mCachedPtr, color);
+            Internal_SetTint(mCachedPtr, ref color);
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
@@ -71,6 +71,6 @@ namespace BansheeEngine
         private static extern void Internal_SetContent(IntPtr nativeInstance, GUIContent content);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
     }
 }

+ 2 - 2
MBansheeEngine/GUI/GUIListBox.cs

@@ -90,7 +90,7 @@ namespace BansheeEngine
         /// <param name="color">Tint to apply to the element.</param>
         public void SetTint(Color color)
         {
-            Internal_SetTint(mCachedPtr, color);
+            Internal_SetTint(mCachedPtr, ref color);
         }
 
         /// <summary>
@@ -122,6 +122,6 @@ namespace BansheeEngine
         private static extern void Internal_SetElementStates(IntPtr nativeInstance, bool[] states);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
     }
 }

+ 66 - 66
MBansheeEngine/GUI/GUIProgressBar.cs

@@ -1,66 +1,66 @@
-using System;
-using System.Runtime.CompilerServices;
-
-namespace BansheeEngine
-{
-    /// <summary>
-    /// GUI element containing a background image and a fill image that is scaled depending on the percentage set by the 
-    /// caller.
-    /// </summary>
-    public sealed class GUIProgressBar : GUIElement
-    {
-        /// <summary>
-        /// Value that controls the width of the progress bar fill image. Range [0, 1].
-        /// </summary>
-        public float Percent
-        {
-            get { return Internal_GetPercent(mCachedPtr); }
-            set { Internal_SetPercent(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Creates a new progress bar element.
-        /// </summary>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIProgressBar(string style, params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, style, options);
-        }
-
-        /// <summary>
-        /// Creates a new progress bar element.
-        /// </summary>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        public GUIProgressBar(string style = "")
-        {
-            Internal_CreateInstance(this, style, new GUIOption[0]);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIProgressBar instance, string style, GUIOption[] options);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetPercent(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetPercent(IntPtr nativeInstance, float percent);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+
+namespace BansheeEngine
+{
+    /// <summary>
+    /// GUI element containing a background image and a fill image that is scaled depending on the percentage set by the 
+    /// caller.
+    /// </summary>
+    public sealed class GUIProgressBar : GUIElement
+    {
+        /// <summary>
+        /// Value that controls the width of the progress bar fill image. Range [0, 1].
+        /// </summary>
+        public float Percent
+        {
+            get { return Internal_GetPercent(mCachedPtr); }
+            set { Internal_SetPercent(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Creates a new progress bar element.
+        /// </summary>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIProgressBar(string style, params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, style, options);
+        }
+
+        /// <summary>
+        /// Creates a new progress bar element.
+        /// </summary>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        public GUIProgressBar(string style = "")
+        {
+            Internal_CreateInstance(this, style, new GUIOption[0]);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUIProgressBar instance, string style, GUIOption[] options);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_GetPercent(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetPercent(IntPtr nativeInstance, float percent);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+}

+ 87 - 87
MBansheeEngine/GUI/GUIRenderTexture.cs

@@ -1,87 +1,87 @@
-using System;
-using System.Runtime.CompilerServices;
-
-namespace BansheeEngine
-{
-    /// <summary>
-    /// Allows you to display a render texture in the GUI. Has the same functionality as GUITexture, but also forwards any 
-    /// input to underlying GUI elements being rendered on the provided render texture.
-    /// </summary>
-    public sealed class GUIRenderTexture : GUIElement
-    {
-        private RenderTexture2D renderTexture;
-
-        /// <summary>
-        /// Render texture that is displayed on the GUI element.
-        /// </summary>
-        public RenderTexture2D RenderTexture
-        {
-            get
-            {
-                return renderTexture;
-            }
-
-            set
-            {
-                IntPtr texturePtr = IntPtr.Zero;
-                if (value != null)
-                    texturePtr = value.GetCachedPtr();
-
-                renderTexture = value;
-                Internal_SetTexture(mCachedPtr, texturePtr);
-            }
-        }
-
-        /// <summary>
-        /// Creates a new render texture element.
-        /// </summary>
-        /// <param name="texture">Render texture to display in the element.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIRenderTexture(RenderTexture2D texture, string style, params GUIOption[] options)
-        {
-            IntPtr texturePtr = IntPtr.Zero;
-            if (texture != null)
-                texturePtr = texture.GetCachedPtr();
-
-            Internal_CreateInstance(this, texturePtr, style, options);
-        }
-
-        /// <summary>
-        /// Creates a new render texture element.
-        /// </summary>
-        /// <param name="texture">Render texture to display in the element.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIRenderTexture(RenderTexture2D texture, params GUIOption[] options)
-        {
-            IntPtr texturePtr = IntPtr.Zero;
-            if (texture != null)
-                texturePtr = texture.GetCachedPtr();
-
-            Internal_CreateInstance(this, texturePtr, "", options);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIRenderTexture instance, IntPtr texture,
-            string style, GUIOption[] options);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTexture(IntPtr nativeInstance, IntPtr texture);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+
+namespace BansheeEngine
+{
+    /// <summary>
+    /// Allows you to display a render texture in the GUI. Has the same functionality as GUITexture, but also forwards any 
+    /// input to underlying GUI elements being rendered on the provided render texture.
+    /// </summary>
+    public sealed class GUIRenderTexture : GUIElement
+    {
+        private RenderTexture2D renderTexture;
+
+        /// <summary>
+        /// Render texture that is displayed on the GUI element.
+        /// </summary>
+        public RenderTexture2D RenderTexture
+        {
+            get
+            {
+                return renderTexture;
+            }
+
+            set
+            {
+                IntPtr texturePtr = IntPtr.Zero;
+                if (value != null)
+                    texturePtr = value.GetCachedPtr();
+
+                renderTexture = value;
+                Internal_SetTexture(mCachedPtr, texturePtr);
+            }
+        }
+
+        /// <summary>
+        /// Creates a new render texture element.
+        /// </summary>
+        /// <param name="texture">Render texture to display in the element.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIRenderTexture(RenderTexture2D texture, string style, params GUIOption[] options)
+        {
+            IntPtr texturePtr = IntPtr.Zero;
+            if (texture != null)
+                texturePtr = texture.GetCachedPtr();
+
+            Internal_CreateInstance(this, texturePtr, style, options);
+        }
+
+        /// <summary>
+        /// Creates a new render texture element.
+        /// </summary>
+        /// <param name="texture">Render texture to display in the element.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIRenderTexture(RenderTexture2D texture, params GUIOption[] options)
+        {
+            IntPtr texturePtr = IntPtr.Zero;
+            if (texture != null)
+                texturePtr = texture.GetCachedPtr();
+
+            Internal_CreateInstance(this, texturePtr, "", options);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUIRenderTexture instance, IntPtr texture,
+            string style, GUIOption[] options);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTexture(IntPtr nativeInstance, IntPtr texture);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+}

+ 7 - 2
MBansheeEngine/GUI/GUIScrollArea.cs

@@ -54,7 +54,12 @@ namespace BansheeEngine
         /// </summary>
         public Rect2I ContentBounds
         {
-            get { return Internal_GetContentBounds(mCachedPtr); }
+            get
+            {
+                Rect2I bounds;
+                Internal_GetContentBounds(mCachedPtr, out bounds);
+                return bounds;
+            }
         }
 
         /// <summary>
@@ -165,7 +170,7 @@ namespace BansheeEngine
             string scrollBarStyle, string scrollAreaStyle, params GUIOption[] options);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern Rect2I Internal_GetContentBounds(IntPtr nativeInstance);
+        private static extern void Internal_GetContentBounds(IntPtr nativeInstance, out Rect2I value);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern float Internal_GetHorzScroll(IntPtr nativeInstance);

+ 245 - 245
MBansheeEngine/GUI/GUISlider.cs

@@ -1,245 +1,245 @@
-using System;
-using System.Runtime.CompilerServices;
-
-namespace BansheeEngine
-{
-    /// <summary>
-    /// A GUI element that represents a horizontal slider with a draggable handle.
-    /// </summary>
-    public sealed class GUISliderH : GUIElement
-    {
-        public delegate void OnChangedDelegate(float percent);
-
-        /// <summary>
-        /// Triggered when the slider handle moves. Provided parameter represents
-        /// the position of the handle, in percent ranging [0, 1].
-        /// </summary>
-        public event OnChangedDelegate OnChanged;
-
-        /// <summary>
-        /// Returns the position of the slider handle, in percent ranging [0, 1].
-        /// </summary>
-        public float Percent
-        {
-            get { return Internal_GetPercent(mCachedPtr); }
-            set { Internal_SetPercent(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Returns the position of the slider handle, in range determined by <see cref="SetRange"/>. If range is not defined
-        /// set to [0, 1] this is equivalent of <see cref="Percent"/>.
-        /// </summary>
-        public float Value
-        {
-            get { return Internal_GetValue(mCachedPtr); }
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Creates a new horizontal slider.
-        /// </summary>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUISliderH(string style, params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, style, options);
-        }
-
-        /// <summary>
-        /// Creates a new vertical slider.
-        /// </summary>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        public GUISliderH(string style = "")
-        {
-            Internal_CreateInstance(this, style, new GUIOption[0]);
-        }
-
-        /// <summary>
-        /// Sets a range that will input field values will be clamped to. Set to large negative/positive values if clamping
-        /// is not required.
-        /// </summary>
-        /// <param name="min">Minimum boundary of the range to clamp values to.</param>
-        /// <param name="max">Maximum boundary of the range to clamp values to.</param>
-        public void SetRange(float min, float max)
-        {
-            Internal_SetRange(mCachedPtr, min, max);
-        }
-
-        /// <summary>
-        /// Sets a step value that determines the minimal increment the slider can be increased or decreased by.
-        /// </summary>
-        /// <param name="step">Step value in percent if range is not defined, otherwise in same units as the range.</param>
-        public void SetStep(float step)
-        {
-            Internal_SetStep(mCachedPtr, step);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Triggered by the native interop object when the slider handle is moved.
-        /// </summary>
-        /// <param name="percent">New position of the slider handle, in percent ranging [0, 1].</param>
-        private void DoOnChanged(float percent)
-        {
-            if (OnChanged != null)
-                OnChanged(percent);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUISliderH instance, string style, GUIOption[] options);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetPercent(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetPercent(IntPtr nativeInstance, float percent);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetValue(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, float percent);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetRange(IntPtr nativeInstance, float min, float max);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetStep(IntPtr nativeInstance, float step);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-
-    /// <summary>
-    /// A GUI element that represents a vertical slider with a draggable handle.
-    /// </summary>
-    public sealed class GUISliderV : GUIElement
-    {
-        public delegate void OnChangedDelegate(float percent);
-
-        /// <summary>
-        /// Triggered when the slider handle moves. Provided parameter represents
-        /// the position of the handle, in percent ranging [0, 1].
-        /// </summary>
-        public event OnChangedDelegate OnChanged;
-
-        /// <summary>
-        /// Returns the position of the slider handle, in percent ranging [0, 1].
-        /// </summary>
-        public float Percent
-        {
-            get { return Internal_GetPercent(mCachedPtr); }
-            set { Internal_SetPercent(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Returns the position of the slider handle, in range determined by <see cref="SetRange"/>. If range is not defined
-        /// set to [0, 1] this is equivalent of <see cref="Percent"/>.
-        /// </summary>
-        public float Value
-        {
-            get { return Internal_GetValue(mCachedPtr); }
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Creates a new vertical slider.
-        /// </summary>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUISliderV(string style, params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, style, options);
-        }
-
-        /// <summary>
-        /// Creates a new vertical slider.
-        /// </summary>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        public GUISliderV(string style = "")
-        {
-            Internal_CreateInstance(this, style, new GUIOption[0]);
-        }
-
-        /// <summary>
-        /// Sets a range that will input field values will be clamped to. Set to large negative/positive values if clamping
-        /// is not required.
-        /// </summary>
-        /// <param name="min">Minimum boundary of the range to clamp values to.</param>
-        /// <param name="max">Maximum boundary of the range to clamp values to.</param>
-        public void SetRange(float min, float max)
-        {
-            Internal_SetRange(mCachedPtr, min, max);
-        }
-
-        /// <summary>
-        /// Sets a step value that determines the minimal increment the slider can be increased or decreased by.
-        /// </summary>
-        /// <param name="step">Step value in percent if range is not defined, otherwise in same units as the range.</param>
-        public void SetStep(float step)
-        {
-            Internal_SetStep(mCachedPtr, step);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Triggered by the native interop object when the slider handle is moved.
-        /// </summary>
-        /// <param name="percent">New position of the slider handle, in percent ranging [0, 1].</param>
-        private void DoOnChanged(float percent)
-        {
-            if (OnChanged != null)
-                OnChanged(percent);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUISliderV instance, string style, GUIOption[] options);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetPercent(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetPercent(IntPtr nativeInstance, float percent);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetValue(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, float percent);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetRange(IntPtr nativeInstance, float min, float max);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetStep(IntPtr nativeInstance, float step);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+
+namespace BansheeEngine
+{
+    /// <summary>
+    /// A GUI element that represents a horizontal slider with a draggable handle.
+    /// </summary>
+    public sealed class GUISliderH : GUIElement
+    {
+        public delegate void OnChangedDelegate(float percent);
+
+        /// <summary>
+        /// Triggered when the slider handle moves. Provided parameter represents
+        /// the position of the handle, in percent ranging [0, 1].
+        /// </summary>
+        public event OnChangedDelegate OnChanged;
+
+        /// <summary>
+        /// Returns the position of the slider handle, in percent ranging [0, 1].
+        /// </summary>
+        public float Percent
+        {
+            get { return Internal_GetPercent(mCachedPtr); }
+            set { Internal_SetPercent(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Returns the position of the slider handle, in range determined by <see cref="SetRange"/>. If range is not defined
+        /// set to [0, 1] this is equivalent of <see cref="Percent"/>.
+        /// </summary>
+        public float Value
+        {
+            get { return Internal_GetValue(mCachedPtr); }
+            set { Internal_SetValue(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Creates a new horizontal slider.
+        /// </summary>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUISliderH(string style, params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, style, options);
+        }
+
+        /// <summary>
+        /// Creates a new vertical slider.
+        /// </summary>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        public GUISliderH(string style = "")
+        {
+            Internal_CreateInstance(this, style, new GUIOption[0]);
+        }
+
+        /// <summary>
+        /// Sets a range that will input field values will be clamped to. Set to large negative/positive values if clamping
+        /// is not required.
+        /// </summary>
+        /// <param name="min">Minimum boundary of the range to clamp values to.</param>
+        /// <param name="max">Maximum boundary of the range to clamp values to.</param>
+        public void SetRange(float min, float max)
+        {
+            Internal_SetRange(mCachedPtr, min, max);
+        }
+
+        /// <summary>
+        /// Sets a step value that determines the minimal increment the slider can be increased or decreased by.
+        /// </summary>
+        /// <param name="step">Step value in percent if range is not defined, otherwise in same units as the range.</param>
+        public void SetStep(float step)
+        {
+            Internal_SetStep(mCachedPtr, step);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Triggered by the native interop object when the slider handle is moved.
+        /// </summary>
+        /// <param name="percent">New position of the slider handle, in percent ranging [0, 1].</param>
+        private void DoOnChanged(float percent)
+        {
+            if (OnChanged != null)
+                OnChanged(percent);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUISliderH instance, string style, GUIOption[] options);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_GetPercent(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetPercent(IntPtr nativeInstance, float percent);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_GetValue(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, float percent);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetRange(IntPtr nativeInstance, float min, float max);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetStep(IntPtr nativeInstance, float step);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+
+    /// <summary>
+    /// A GUI element that represents a vertical slider with a draggable handle.
+    /// </summary>
+    public sealed class GUISliderV : GUIElement
+    {
+        public delegate void OnChangedDelegate(float percent);
+
+        /// <summary>
+        /// Triggered when the slider handle moves. Provided parameter represents
+        /// the position of the handle, in percent ranging [0, 1].
+        /// </summary>
+        public event OnChangedDelegate OnChanged;
+
+        /// <summary>
+        /// Returns the position of the slider handle, in percent ranging [0, 1].
+        /// </summary>
+        public float Percent
+        {
+            get { return Internal_GetPercent(mCachedPtr); }
+            set { Internal_SetPercent(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Returns the position of the slider handle, in range determined by <see cref="SetRange"/>. If range is not defined
+        /// set to [0, 1] this is equivalent of <see cref="Percent"/>.
+        /// </summary>
+        public float Value
+        {
+            get { return Internal_GetValue(mCachedPtr); }
+            set { Internal_SetValue(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Creates a new vertical slider.
+        /// </summary>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUISliderV(string style, params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, style, options);
+        }
+
+        /// <summary>
+        /// Creates a new vertical slider.
+        /// </summary>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        public GUISliderV(string style = "")
+        {
+            Internal_CreateInstance(this, style, new GUIOption[0]);
+        }
+
+        /// <summary>
+        /// Sets a range that will input field values will be clamped to. Set to large negative/positive values if clamping
+        /// is not required.
+        /// </summary>
+        /// <param name="min">Minimum boundary of the range to clamp values to.</param>
+        /// <param name="max">Maximum boundary of the range to clamp values to.</param>
+        public void SetRange(float min, float max)
+        {
+            Internal_SetRange(mCachedPtr, min, max);
+        }
+
+        /// <summary>
+        /// Sets a step value that determines the minimal increment the slider can be increased or decreased by.
+        /// </summary>
+        /// <param name="step">Step value in percent if range is not defined, otherwise in same units as the range.</param>
+        public void SetStep(float step)
+        {
+            Internal_SetStep(mCachedPtr, step);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Triggered by the native interop object when the slider handle is moved.
+        /// </summary>
+        /// <param name="percent">New position of the slider handle, in percent ranging [0, 1].</param>
+        private void DoOnChanged(float percent)
+        {
+            if (OnChanged != null)
+                OnChanged(percent);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUISliderV instance, string style, GUIOption[] options);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_GetPercent(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetPercent(IntPtr nativeInstance, float percent);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_GetValue(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, float percent);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetRange(IntPtr nativeInstance, float min, float max);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetStep(IntPtr nativeInstance, float step);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+}

+ 2 - 2
MBansheeEngine/GUI/GUITextBox.cs

@@ -82,7 +82,7 @@ namespace BansheeEngine
         /// <param name="color">Tint to apply to the element.</param>
         public void SetTint(Color color)
         {
-            Internal_SetTint(mCachedPtr, color);
+            Internal_SetTint(mCachedPtr, ref color);
         }
 
         /// <summary>
@@ -114,6 +114,6 @@ namespace BansheeEngine
         private static extern void Internal_GetText(IntPtr nativeInstance, out string text);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
     }
 }

+ 2 - 2
MBansheeEngine/GUI/GUITexture.cs

@@ -163,7 +163,7 @@ namespace BansheeEngine
         /// <param name="color">Tint to apply to the element.</param>
         public void SetTint(Color color)
         {
-            Internal_SetTint(mCachedPtr, color);
+            Internal_SetTint(mCachedPtr, ref color);
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
@@ -174,6 +174,6 @@ namespace BansheeEngine
         private static extern void Internal_SetTexture(IntPtr nativeInstance, SpriteTexture texture);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
     }
 }

+ 2 - 2
MBansheeEngine/GUI/GUIToggle.cs

@@ -124,7 +124,7 @@ namespace BansheeEngine
         /// <param name="color">Tint to apply to the element.</param>
         public void SetTint(Color color)
         {
-            Internal_SetTint(mCachedPtr, color);
+            Internal_SetTint(mCachedPtr, ref color);
         }
 
         /// <summary>
@@ -187,6 +187,6 @@ namespace BansheeEngine
         private static extern void Internal_SetValue(IntPtr nativeInstance, bool value);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
     }
 }

+ 1 - 1
SBansheeEngine/Include/BsScriptGUIButton.h

@@ -42,7 +42,7 @@ namespace BansheeEngine
 		/************************************************************************/
 		static void internal_createInstance(MonoObject* instance, MonoObject* content, MonoString* style, MonoArray* guiOptions);
 		static void internal_setContent(ScriptGUIButton* nativeInstance, MonoObject* content);
-		static void internal_setTint(ScriptGUIButton* nativeInstance, Color color);
+		static void internal_setTint(ScriptGUIButton* nativeInstance, Color* color);
 
 		typedef void (__stdcall *OnClickThunkDef) (MonoObject*, MonoException**);
 		typedef void (__stdcall *OnDoubleClickThunkDef) (MonoObject*, MonoException**);

+ 162 - 162
SBansheeEngine/Include/BsScriptGUIElement.h

@@ -1,163 +1,163 @@
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsGUIOptions.h"
-#include "BsGUIElementBase.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for all elements inheriting from
-	 *			GUIElementBase.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIElementBaseTBase : public ScriptObjectBase
-	{
-	public:
-		ScriptGUIElementBaseTBase(MonoObject* instance);
-		virtual ~ScriptGUIElementBaseTBase() {}
-
-		/**
-		 * @brief	Returns the underlying GUIElementBase wrapped by this object.
-		 */
-		GUIElementBase* getGUIElement() const { return (GUIElementBase*)mElement; }
-
-		/**
-		 * @brief	Destroys the underlying GUIElementBase.
-		 */
-		virtual void destroy() = 0;
-
-		/**
-		 * @brief	Checks have we destroyed the underlying GUIElementBase.
-		 */
-		bool isDestroyed() const { return mIsDestroyed; }
-
-		/**
-		 * @brief	Returns the parent interop object for a GUI layout or a GUI panel.
-		 */
-		ScriptGUILayout* getParent() const { return mParent; }
-
-		/**
-		 * @brief	Sets an interop object for a GUI layout or a panel as this object's parent.
-		 */
-		void setParent(ScriptGUILayout* parent) { mParent = parent; }
-
-	protected:
-		/**
-		 * @brief	Initializes the interop object with a previously initialized GUI
-		 *			element. You must call this before using this object.
-		 */
-		void initialize(GUIElementBase* element);
-
-		/**
-		 * @copydoc	ScriptObjectBase::_onManagedInstanceDeleted
-		 */
-		virtual void _onManagedInstanceDeleted() override;
-
-		/**
-		 * @brief	Triggered when the focus changes for the underlying GUIElementBase.
-		 */
-		static void onFocusChanged(MonoObject* instance, bool focus);
-
-		bool mIsDestroyed;
-		GUIElementBase* mElement;
-		ScriptGUILayout* mParent;
-	};
-
-	/**
-	 * @brief	A more specialized implementation of ScriptGUIElementBaseTBase that
-	 *			references a specific GUI element type instead of the generic GUIElementBase.
-	 */
-	template <class Type>
-	class TScriptGUIElementBase : public ScriptObject<Type, ScriptGUIElementBaseTBase>
-	{
-	public:
-		virtual ~TScriptGUIElementBase() {}
-
-	protected:
-		TScriptGUIElementBase(MonoObject* instance, GUIElementBase* element)
-			:ScriptObject(instance)
-		{ 
-			initialize(element);
-		}
-	};
-
-	/**
-	 * @brief	Interop class between C++ & CLR for all elements inheriting from
-	 *			GUIElement.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIElementTBase : public ScriptGUIElementBaseTBase
-	{
-	public:
-		ScriptGUIElementTBase(MonoObject* instance);
-		virtual ~ScriptGUIElementTBase() {}
-
-		/**
-		 * @copydoc	ScriptGUIElementBaseTBase::destroy
-		 */
-		virtual void destroy() override;
-	};
-
-	/**
-	 * @brief	A more specialized implementation of ScriptGUIElementTBase that
-	 *			references a specific GUI element type instead of the generic GUIElement.
-	 */
-	template <class Type>
-	class TScriptGUIElement : public ScriptObject<Type, ScriptGUIElementTBase>
-	{
-	public:
-		virtual ~TScriptGUIElement() {}
-
-	protected:
-		TScriptGUIElement(MonoObject* instance, GUIElementBase* element)
-			:ScriptObject(instance)
-		{
-			initialize(element);
-		}
-	};
-
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIElement. This includes only base
-	 *			methods belonging directly to GUIElement while specific GUI element 
-	 *			implementations have their own interop classes.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIElement : public ScriptObject<ScriptGUIElement>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIElement")
-
-	private:
-		ScriptGUIElement(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_destroy(ScriptGUIElementBaseTBase* nativeInstance);
-		static void internal_setVisible(ScriptGUIElementBaseTBase* nativeInstance, bool visible);
-		static void internal_setActive(ScriptGUIElementBaseTBase* nativeInstance, bool active);
-		static void internal_setDisabled(ScriptGUIElementBaseTBase* nativeInstance, bool disabled);
-		static void internal_setFocus(ScriptGUIElementBaseTBase* nativeInstance, bool focus);
-		static bool internal_getVisible(ScriptGUIElementBaseTBase* nativeInstance);
-		static bool internal_getActive(ScriptGUIElementBaseTBase* nativeInstance);
-		static bool internal_getDisabled(ScriptGUIElementBaseTBase* nativeInstance);
-		static MonoObject* internal_getParent(ScriptGUIElementBaseTBase* nativeInstance);
-		static Rect2I internal_getBounds(ScriptGUIElementBaseTBase* nativeInstance);
-		static void internal_setBounds(ScriptGUIElementBaseTBase* nativeInstance, Rect2I bounds);
-		static Rect2I internal_getVisibleBounds(ScriptGUIElementBaseTBase* nativeInstance);
-		static void internal_SetPosition(ScriptGUIElementBaseTBase* nativeInstance, INT32 x, INT32 y);
-		static void internal_SetWidth(ScriptGUIElementBaseTBase* nativeInstance, UINT32 width);
-		static void internal_SetFlexibleWidth(ScriptGUIElementBaseTBase* nativeInstance, UINT32 minWidth, UINT32 maxWidth);
-		static void internal_SetHeight(ScriptGUIElementBaseTBase* nativeInstance, UINT32 height);
-		static void internal_SetFlexibleHeight(ScriptGUIElementBaseTBase* nativeInstance, UINT32 minHeight, UINT32 maxHeight);
-		static void internal_SetContextMenu(ScriptGUIElementBaseTBase* nativeInstance, ScriptContextMenu* contextMenu);
-		static void internal_ResetDimensions(ScriptGUIElementBaseTBase* nativeInstance);
-		static MonoString* internal_GetStyle(ScriptGUIElementBaseTBase* nativeInstance);
-		static void internal_SetStyle(ScriptGUIElementBaseTBase* nativeInstance, MonoString* style);
-
-		typedef void(__stdcall *OnFocusChangedThunkDef) (MonoObject*, MonoException**);
-
-	public:
-		static OnFocusChangedThunkDef onFocusGainedThunk;
-		static OnFocusChangedThunkDef onFocusLostThunk;
-	};
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsGUIOptions.h"
+#include "BsGUIElementBase.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for all elements inheriting from
+	 *			GUIElementBase.
+	 */
+	class BS_SCR_BE_EXPORT ScriptGUIElementBaseTBase : public ScriptObjectBase
+	{
+	public:
+		ScriptGUIElementBaseTBase(MonoObject* instance);
+		virtual ~ScriptGUIElementBaseTBase() {}
+
+		/**
+		 * @brief	Returns the underlying GUIElementBase wrapped by this object.
+		 */
+		GUIElementBase* getGUIElement() const { return (GUIElementBase*)mElement; }
+
+		/**
+		 * @brief	Destroys the underlying GUIElementBase.
+		 */
+		virtual void destroy() = 0;
+
+		/**
+		 * @brief	Checks have we destroyed the underlying GUIElementBase.
+		 */
+		bool isDestroyed() const { return mIsDestroyed; }
+
+		/**
+		 * @brief	Returns the parent interop object for a GUI layout or a GUI panel.
+		 */
+		ScriptGUILayout* getParent() const { return mParent; }
+
+		/**
+		 * @brief	Sets an interop object for a GUI layout or a panel as this object's parent.
+		 */
+		void setParent(ScriptGUILayout* parent) { mParent = parent; }
+
+	protected:
+		/**
+		 * @brief	Initializes the interop object with a previously initialized GUI
+		 *			element. You must call this before using this object.
+		 */
+		void initialize(GUIElementBase* element);
+
+		/**
+		 * @copydoc	ScriptObjectBase::_onManagedInstanceDeleted
+		 */
+		virtual void _onManagedInstanceDeleted() override;
+
+		/**
+		 * @brief	Triggered when the focus changes for the underlying GUIElementBase.
+		 */
+		static void onFocusChanged(MonoObject* instance, bool focus);
+
+		bool mIsDestroyed;
+		GUIElementBase* mElement;
+		ScriptGUILayout* mParent;
+	};
+
+	/**
+	 * @brief	A more specialized implementation of ScriptGUIElementBaseTBase that
+	 *			references a specific GUI element type instead of the generic GUIElementBase.
+	 */
+	template <class Type>
+	class TScriptGUIElementBase : public ScriptObject<Type, ScriptGUIElementBaseTBase>
+	{
+	public:
+		virtual ~TScriptGUIElementBase() {}
+
+	protected:
+		TScriptGUIElementBase(MonoObject* instance, GUIElementBase* element)
+			:ScriptObject(instance)
+		{ 
+			initialize(element);
+		}
+	};
+
+	/**
+	 * @brief	Interop class between C++ & CLR for all elements inheriting from
+	 *			GUIElement.
+	 */
+	class BS_SCR_BE_EXPORT ScriptGUIElementTBase : public ScriptGUIElementBaseTBase
+	{
+	public:
+		ScriptGUIElementTBase(MonoObject* instance);
+		virtual ~ScriptGUIElementTBase() {}
+
+		/**
+		 * @copydoc	ScriptGUIElementBaseTBase::destroy
+		 */
+		virtual void destroy() override;
+	};
+
+	/**
+	 * @brief	A more specialized implementation of ScriptGUIElementTBase that
+	 *			references a specific GUI element type instead of the generic GUIElement.
+	 */
+	template <class Type>
+	class TScriptGUIElement : public ScriptObject<Type, ScriptGUIElementTBase>
+	{
+	public:
+		virtual ~TScriptGUIElement() {}
+
+	protected:
+		TScriptGUIElement(MonoObject* instance, GUIElementBase* element)
+			:ScriptObject(instance)
+		{
+			initialize(element);
+		}
+	};
+
+	/**
+	 * @brief	Interop class between C++ & CLR for GUIElement. This includes only base
+	 *			methods belonging directly to GUIElement while specific GUI element 
+	 *			implementations have their own interop classes.
+	 */
+	class BS_SCR_BE_EXPORT ScriptGUIElement : public ScriptObject<ScriptGUIElement>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIElement")
+
+	private:
+		ScriptGUIElement(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_destroy(ScriptGUIElementBaseTBase* nativeInstance);
+		static void internal_setVisible(ScriptGUIElementBaseTBase* nativeInstance, bool visible);
+		static void internal_setActive(ScriptGUIElementBaseTBase* nativeInstance, bool active);
+		static void internal_setDisabled(ScriptGUIElementBaseTBase* nativeInstance, bool disabled);
+		static void internal_setFocus(ScriptGUIElementBaseTBase* nativeInstance, bool focus);
+		static bool internal_getVisible(ScriptGUIElementBaseTBase* nativeInstance);
+		static bool internal_getActive(ScriptGUIElementBaseTBase* nativeInstance);
+		static bool internal_getDisabled(ScriptGUIElementBaseTBase* nativeInstance);
+		static MonoObject* internal_getParent(ScriptGUIElementBaseTBase* nativeInstance);
+		static void internal_getBounds(ScriptGUIElementBaseTBase* nativeInstance, Rect2I* bounds);
+		static void internal_setBounds(ScriptGUIElementBaseTBase* nativeInstance, Rect2I* bounds);
+		static void internal_getVisibleBounds(ScriptGUIElementBaseTBase* nativeInstance, Rect2I* bounds);
+		static void internal_SetPosition(ScriptGUIElementBaseTBase* nativeInstance, INT32 x, INT32 y);
+		static void internal_SetWidth(ScriptGUIElementBaseTBase* nativeInstance, UINT32 width);
+		static void internal_SetFlexibleWidth(ScriptGUIElementBaseTBase* nativeInstance, UINT32 minWidth, UINT32 maxWidth);
+		static void internal_SetHeight(ScriptGUIElementBaseTBase* nativeInstance, UINT32 height);
+		static void internal_SetFlexibleHeight(ScriptGUIElementBaseTBase* nativeInstance, UINT32 minHeight, UINT32 maxHeight);
+		static void internal_SetContextMenu(ScriptGUIElementBaseTBase* nativeInstance, ScriptContextMenu* contextMenu);
+		static void internal_ResetDimensions(ScriptGUIElementBaseTBase* nativeInstance);
+		static MonoString* internal_GetStyle(ScriptGUIElementBaseTBase* nativeInstance);
+		static void internal_SetStyle(ScriptGUIElementBaseTBase* nativeInstance, MonoString* style);
+
+		typedef void(__stdcall *OnFocusChangedThunkDef) (MonoObject*, MonoException**);
+
+	public:
+		static OnFocusChangedThunkDef onFocusGainedThunk;
+		static OnFocusChangedThunkDef onFocusLostThunk;
+	};
 }

+ 11 - 11
SBansheeEngine/Include/BsScriptGUIElementStyle.h

@@ -63,29 +63,29 @@ namespace BansheeEngine
 		static void internal_SetWordWrap(ScriptGUIElementStyle* nativeInstance, bool value);
 
 		static void internal_GetNormal(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetNormal(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value);
+		static void internal_SetNormal(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
 		static void internal_GetHover(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetHover(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value);
+		static void internal_SetHover(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
 		static void internal_GetActive(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetActive(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value);
+		static void internal_SetActive(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
 		static void internal_GetFocused(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetFocused(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value);
+		static void internal_SetFocused(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
 
 		static void internal_GetNormalOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetNormalOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value);
+		static void internal_SetNormalOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
 		static void internal_GetHoverOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetHoverOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value);
+		static void internal_SetHoverOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
 		static void internal_GetActiveOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetActiveOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value);
+		static void internal_SetActiveOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
 		static void internal_GetFocusedOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetFocusedOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value);
+		static void internal_SetFocusedOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
 
 		static void internal_GetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
-		static void internal_SetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset value);
+		static void internal_SetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
 		static void internal_GetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
-		static void internal_SetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset value);
+		static void internal_SetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
 		static void internal_GetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
-		static void internal_SetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset value);
+		static void internal_SetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
 
 		static void internal_GetWidth(ScriptGUIElementStyle* nativeInstance, UINT32* value);
 		static void internal_SetWidth(ScriptGUIElementStyle* nativeInstance, UINT32 value);

+ 1 - 1
SBansheeEngine/Include/BsScriptGUIInputBox.h

@@ -33,7 +33,7 @@ namespace BansheeEngine
 		static void internal_createInstance(MonoObject* instance, bool multiline, MonoString* style, MonoArray* guiOptions);
 		static void internal_setText(ScriptGUIInputBox* nativeInstance, MonoString* text);
 		static void internal_getText(ScriptGUIInputBox* nativeInstance, MonoString** text);
-		static void internal_setTint(ScriptGUIInputBox* nativeInstance, Color color);
+		static void internal_setTint(ScriptGUIInputBox* nativeInstance, Color* color);
 
 		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, MonoString*, MonoException**);
 		typedef void(__stdcall *OnConfirmedThunkDef) (MonoObject*, MonoException**);

+ 1 - 1
SBansheeEngine/Include/BsScriptGUILabel.h

@@ -21,6 +21,6 @@ namespace BansheeEngine
 		/************************************************************************/
 		static void internal_createInstance(MonoObject* instance, MonoObject* content, MonoString* style, MonoArray* guiOptions);
 		static void internal_setContent(ScriptGUILabel* nativeInstance, MonoObject* content);
-		static void internal_setTint(ScriptGUILabel* nativeInstance, Color color);
+		static void internal_setTint(ScriptGUILabel* nativeInstance, Color* color);
 	};
 }

+ 1 - 1
SBansheeEngine/Include/BsScriptGUIListBox.h

@@ -27,7 +27,7 @@ namespace BansheeEngine
 		/************************************************************************/
 		static void internal_createInstance(MonoObject* instance, MonoArray* elements, bool multiselect, MonoString* style, MonoArray* guiOptions);
 		static void internal_setElements(ScriptGUIListBox* nativeInstance, MonoArray* elements);
-		static void internal_setTint(ScriptGUIListBox* nativeInstance, Color color);
+		static void internal_setTint(ScriptGUIListBox* nativeInstance, Color* color);
 		static void internal_selectElement(ScriptGUIListBox* nativeInstance, int idx);
 		static void internal_deselectElement(ScriptGUIListBox* nativeInstance, int idx);
 		static MonoArray* internal_getElementStates(ScriptGUIListBox* nativeInstance);

+ 26 - 26
SBansheeEngine/Include/BsScriptGUIProgressBar.h

@@ -1,27 +1,27 @@
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIProgressBar. 
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIProgressBar : public TScriptGUIElement <ScriptGUIProgressBar>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIProgressBar")
-
-	private:
-		ScriptGUIProgressBar(MonoObject* instance, GUIProgressBar* progressBar);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions);
-		static void internal_setPercent(ScriptGUIProgressBar* nativeInstance, float percent);
-		static float internal_getPercent(ScriptGUIProgressBar* nativeInstance);
-		static void internal_setTint(ScriptGUIProgressBar* nativeInstance, Color color);
-	};
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUIProgressBar. 
+	 */
+	class BS_SCR_BE_EXPORT ScriptGUIProgressBar : public TScriptGUIElement <ScriptGUIProgressBar>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIProgressBar")
+
+	private:
+		ScriptGUIProgressBar(MonoObject* instance, GUIProgressBar* progressBar);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions);
+		static void internal_setPercent(ScriptGUIProgressBar* nativeInstance, float percent);
+		static float internal_getPercent(ScriptGUIProgressBar* nativeInstance);
+		static void internal_setTint(ScriptGUIProgressBar* nativeInstance, Color* color);
+	};
 }

+ 26 - 26
SBansheeEngine/Include/BsScriptGUIRenderTexture.h

@@ -1,27 +1,27 @@
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIRenderTexture. 
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIRenderTexture : public TScriptGUIElement < ScriptGUIRenderTexture >
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIRenderTexture")
-
-	private:
-		ScriptGUIRenderTexture(MonoObject* instance, GUIRenderTexture* texture);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, ScriptRenderTexture2D* texture,
-			MonoString* style, MonoArray* guiOptions);
-		static void internal_setTexture(ScriptGUIRenderTexture* nativeInstance, ScriptRenderTexture2D* texture);
-		static void internal_setTint(ScriptGUIRenderTexture* nativeInstance, Color color);
-	};
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUIRenderTexture. 
+	 */
+	class BS_SCR_BE_EXPORT ScriptGUIRenderTexture : public TScriptGUIElement < ScriptGUIRenderTexture >
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIRenderTexture")
+
+	private:
+		ScriptGUIRenderTexture(MonoObject* instance, GUIRenderTexture* texture);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, ScriptRenderTexture2D* texture,
+			MonoString* style, MonoArray* guiOptions);
+		static void internal_setTexture(ScriptGUIRenderTexture* nativeInstance, ScriptRenderTexture2D* texture);
+		static void internal_setTint(ScriptGUIRenderTexture* nativeInstance, Color* color);
+	};
 }

+ 1 - 1
SBansheeEngine/Include/BsScriptGUIScrollArea.h

@@ -43,7 +43,7 @@ namespace BansheeEngine
 		/************************************************************************/
 		static void internal_createInstance(MonoObject* instance, ScrollBarType vertBarType, ScrollBarType horzBarType, 
 			MonoString* scrollBarStyle, MonoString* scrollAreaStyle, MonoArray* guiOptions);
-		static Rect2I internal_getContentBounds(ScriptGUIScrollArea* nativeInstance);
+		static void internal_getContentBounds(ScriptGUIScrollArea* nativeInstance, Rect2I* bounds);
 		static float internal_getHorzScroll(ScriptGUIScrollArea* nativeInstance);
 		static void internal_setHorzScroll(ScriptGUIScrollArea* nativeInstance, float value);
 		static float internal_getVertScroll(ScriptGUIScrollArea* nativeInstance);

+ 70 - 70
SBansheeEngine/Include/BsScriptGUISlider.h

@@ -1,71 +1,71 @@
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUISliderH. 
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUISliderH : public TScriptGUIElement<ScriptGUISliderH>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUISliderH")
-
-	private:
-		ScriptGUISliderH(MonoObject* instance, GUISliderHorz* slider);
-
-		/**
-		 * @brief	Triggered when the native slider is moved.
-		 */
-		static void onChanged(MonoObject* instance, float percent);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions);
-		static void internal_setPercent(ScriptGUISliderH* nativeInstance, float percent);
-		static float internal_getPercent(ScriptGUISliderH* nativeInstance);
-		static float internal_getValue(ScriptGUISliderH* nativeInstance);
-		static void internal_setValue(ScriptGUISliderH* nativeInstance, float percent);
-		static void internal_setRange(ScriptGUISliderH* nativeInstance, float min, float max);
-		static void internal_setStep(ScriptGUISliderH* nativeInstance, float step);
-		static void internal_setTint(ScriptGUISliderH* nativeInstance, Color color);
-
-		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, float, MonoException**);
-		static OnChangedThunkDef onChangedThunk;
-	};
-
-	/**
-	 * @brief	Interop class between C++ & CLR for GUISliderV. 
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUISliderV : public TScriptGUIElement<ScriptGUISliderV>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUISliderV")
-
-	private:
-		ScriptGUISliderV(MonoObject* instance, GUISliderVert* slider);
-
-		/**
-		 * @brief	Triggered when the native slider is moved.
-		 */
-		static void onChanged(MonoObject* instance, float percent);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions);
-		static void internal_setPercent(ScriptGUISliderV* nativeInstance, float percent);
-		static float internal_getPercent(ScriptGUISliderV* nativeInstance);
-		static float internal_getValue(ScriptGUISliderV* nativeInstance);
-		static void internal_setValue(ScriptGUISliderV* nativeInstance, float percent);
-		static void internal_setRange(ScriptGUISliderV* nativeInstance, float min, float max);
-		static void internal_setStep(ScriptGUISliderV* nativeInstance, float step);
-		static void internal_setTint(ScriptGUISliderV* nativeInstance, Color color);
-
-		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, float, MonoException**);
-		static OnChangedThunkDef onChangedThunk;
-	};
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUISliderH. 
+	 */
+	class BS_SCR_BE_EXPORT ScriptGUISliderH : public TScriptGUIElement<ScriptGUISliderH>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUISliderH")
+
+	private:
+		ScriptGUISliderH(MonoObject* instance, GUISliderHorz* slider);
+
+		/**
+		 * @brief	Triggered when the native slider is moved.
+		 */
+		static void onChanged(MonoObject* instance, float percent);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions);
+		static void internal_setPercent(ScriptGUISliderH* nativeInstance, float percent);
+		static float internal_getPercent(ScriptGUISliderH* nativeInstance);
+		static float internal_getValue(ScriptGUISliderH* nativeInstance);
+		static void internal_setValue(ScriptGUISliderH* nativeInstance, float percent);
+		static void internal_setRange(ScriptGUISliderH* nativeInstance, float min, float max);
+		static void internal_setStep(ScriptGUISliderH* nativeInstance, float step);
+		static void internal_setTint(ScriptGUISliderH* nativeInstance, Color* color);
+
+		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, float, MonoException**);
+		static OnChangedThunkDef onChangedThunk;
+	};
+
+	/**
+	 * @brief	Interop class between C++ & CLR for GUISliderV. 
+	 */
+	class BS_SCR_BE_EXPORT ScriptGUISliderV : public TScriptGUIElement<ScriptGUISliderV>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUISliderV")
+
+	private:
+		ScriptGUISliderV(MonoObject* instance, GUISliderVert* slider);
+
+		/**
+		 * @brief	Triggered when the native slider is moved.
+		 */
+		static void onChanged(MonoObject* instance, float percent);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions);
+		static void internal_setPercent(ScriptGUISliderV* nativeInstance, float percent);
+		static float internal_getPercent(ScriptGUISliderV* nativeInstance);
+		static float internal_getValue(ScriptGUISliderV* nativeInstance);
+		static void internal_setValue(ScriptGUISliderV* nativeInstance, float percent);
+		static void internal_setRange(ScriptGUISliderV* nativeInstance, float min, float max);
+		static void internal_setStep(ScriptGUISliderV* nativeInstance, float step);
+		static void internal_setTint(ScriptGUISliderV* nativeInstance, Color* color);
+
+		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, float, MonoException**);
+		static OnChangedThunkDef onChangedThunk;
+	};
 }

+ 1 - 1
SBansheeEngine/Include/BsScriptGUITexture.h

@@ -23,6 +23,6 @@ namespace BansheeEngine
 		static void internal_createInstance(MonoObject* instance, MonoObject* texture, 
 			GUIImageScaleMode scale, bool transparent, MonoString* style, MonoArray* guiOptions);
 		static void internal_setTexture(ScriptGUITexture* nativeInstance, MonoObject* texture);
-		static void internal_setTint(ScriptGUITexture* nativeInstance, Color color);
+		static void internal_setTint(ScriptGUITexture* nativeInstance, Color* color);
 	};
 }

+ 1 - 1
SBansheeEngine/Include/BsScriptGUIToggle.h

@@ -49,7 +49,7 @@ namespace BansheeEngine
 		static void internal_setContent(ScriptGUIToggle* nativeInstance, MonoObject* content);
 		static bool internal_getValue(ScriptGUIToggle* nativeInstance);
 		static void internal_setValue(ScriptGUIToggle* nativeInstance, bool value);
-		static void internal_setTint(ScriptGUIToggle* nativeInstance, Color color);
+		static void internal_setTint(ScriptGUIToggle* nativeInstance, Color* color);
 
 		typedef void (__stdcall *OnClickThunkDef) (MonoObject*, MonoException**);
 		typedef void (__stdcall *OnHoverThunkDef) (MonoObject*, MonoException**);

+ 2 - 2
SBansheeEngine/Source/BsScriptGUIButton.cpp

@@ -66,10 +66,10 @@ namespace BansheeEngine
 		button->setContent(nativeContent);
 	}
 
-	void ScriptGUIButton::internal_setTint(ScriptGUIButton* nativeInstance, Color color)
+	void ScriptGUIButton::internal_setTint(ScriptGUIButton* nativeInstance, Color* color)
 	{
 		GUIButton* button = (GUIButton*)nativeInstance->getGUIElement();
-		button->setTint(color);
+		button->setTint(*color);
 	}
 
 	void ScriptGUIButton::onClick(MonoObject* instance)

+ 311 - 305
SBansheeEngine/Source/BsScriptGUIElement.cpp

@@ -1,306 +1,312 @@
-#include "BsScriptGUIElement.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsMonoUtil.h"
-#include "BsGUIElement.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptContextMenu.h"
-#include "BsGUIElement.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUIElementBaseTBase::ScriptGUIElementBaseTBase(MonoObject* instance)
-		:ScriptObjectBase(instance), mIsDestroyed(false), mElement(nullptr), mParent(nullptr)
-	{ }
-
-	void ScriptGUIElementBaseTBase::initialize(GUIElementBase* element)
-	{
-		mElement = element;
-
-		if (mElement != nullptr && mElement->_getType() == GUIElementBase::Type::Element)
-		{
-			GUIElement* guiElem = static_cast<GUIElement*>(element);
-			guiElem->onFocusChanged.connect(std::bind(&ScriptGUIElementBaseTBase::onFocusChanged, mManagedInstance, _1));
-		}
-	}
-
-	void ScriptGUIElementBaseTBase::onFocusChanged(MonoObject* instance, bool focus)
-	{
-		if (focus)
-			MonoUtil::invokeThunk(ScriptGUIElement::onFocusGainedThunk, instance);
-		else
-			MonoUtil::invokeThunk(ScriptGUIElement::onFocusLostThunk, instance);
-	}
-
-	void ScriptGUIElementBaseTBase::_onManagedInstanceDeleted()
-	{
-		destroy();
-
-		ScriptObjectBase::_onManagedInstanceDeleted();
-	}
-
-	ScriptGUIElementTBase::ScriptGUIElementTBase(MonoObject* instance)
-		:ScriptGUIElementBaseTBase(instance)
-	{
-
-	}
-
-	void ScriptGUIElementTBase::destroy()
-	{
-		if(!mIsDestroyed)
-		{
-			if (mParent != nullptr)
-				mParent->removeChild(this);
-
-			if (mElement->_getType() == GUIElementBase::Type::Element)
-			{
-				GUIElement::destroy((GUIElement*)mElement);
-				mElement = nullptr;
-
-				mIsDestroyed = true;
-			}
-		}
-	}
-
-	ScriptGUIElement::OnFocusChangedThunkDef ScriptGUIElement::onFocusGainedThunk;
-	ScriptGUIElement::OnFocusChangedThunkDef ScriptGUIElement::onFocusLostThunk;
-
-	ScriptGUIElement::ScriptGUIElement(MonoObject* instance)
-		:ScriptObject(instance)
-	{
-
-	}
-
-	void ScriptGUIElement::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_Destroy", &ScriptGUIElement::internal_destroy);
-		metaData.scriptClass->addInternalCall("Internal_SetVisible", &ScriptGUIElement::internal_setVisible);
-		metaData.scriptClass->addInternalCall("Internal_SetActive", &ScriptGUIElement::internal_setActive);
-		metaData.scriptClass->addInternalCall("Internal_SetDisabled", &ScriptGUIElement::internal_setDisabled);
-		metaData.scriptClass->addInternalCall("Internal_GetVisible", &ScriptGUIElement::internal_getVisible);
-		metaData.scriptClass->addInternalCall("Internal_GetActive", &ScriptGUIElement::internal_getActive);
-		metaData.scriptClass->addInternalCall("Internal_GetDisabled", &ScriptGUIElement::internal_getDisabled);
-		metaData.scriptClass->addInternalCall("Internal_SetFocus", &ScriptGUIElement::internal_setFocus);
-		metaData.scriptClass->addInternalCall("Internal_GetParent", &ScriptGUIElement::internal_getParent);
-		metaData.scriptClass->addInternalCall("Internal_GetBounds", &ScriptGUIElement::internal_getBounds);
-		metaData.scriptClass->addInternalCall("Internal_SetBounds", &ScriptGUIElement::internal_setBounds);
-		metaData.scriptClass->addInternalCall("Internal_GetVisibleBounds", &ScriptGUIElement::internal_getVisibleBounds);
-		metaData.scriptClass->addInternalCall("Internal_SetPosition", &ScriptGUIElement::internal_SetPosition);
-		metaData.scriptClass->addInternalCall("Internal_SetWidth", &ScriptGUIElement::internal_SetWidth);
-		metaData.scriptClass->addInternalCall("Internal_SetFlexibleWidth", &ScriptGUIElement::internal_SetFlexibleWidth);
-		metaData.scriptClass->addInternalCall("Internal_SetHeight", &ScriptGUIElement::internal_SetHeight);
-		metaData.scriptClass->addInternalCall("Internal_SetFlexibleHeight", &ScriptGUIElement::internal_SetFlexibleHeight);
-		metaData.scriptClass->addInternalCall("Internal_ResetDimensions", &ScriptGUIElement::internal_ResetDimensions);
-		metaData.scriptClass->addInternalCall("Internal_SetContextMenu", &ScriptGUIElement::internal_SetContextMenu);
-		metaData.scriptClass->addInternalCall("Internal_GetStyle", &ScriptGUIElement::internal_GetStyle);
-		metaData.scriptClass->addInternalCall("Internal_SetStyle", &ScriptGUIElement::internal_SetStyle);
-
-		onFocusGainedThunk = (OnFocusChangedThunkDef)metaData.scriptClass->getMethod("Internal_OnFocusGained", 0)->getThunk();
-		onFocusLostThunk = (OnFocusChangedThunkDef)metaData.scriptClass->getMethod("Internal_OnFocusLost", 0)->getThunk();
-	}
-
-	void ScriptGUIElement::internal_destroy(ScriptGUIElementBaseTBase* nativeInstance)
-	{
-		nativeInstance->destroy();
-	}
-
-	void ScriptGUIElement::internal_setVisible(ScriptGUIElementBaseTBase* nativeInstance, bool visible)
-	{
-		if (nativeInstance->isDestroyed())
-			return;
-
-		nativeInstance->getGUIElement()->setVisible(visible);
-	}
-
-	void ScriptGUIElement::internal_setActive(ScriptGUIElementBaseTBase* nativeInstance, bool enabled)
-	{
-		if (nativeInstance->isDestroyed())
-			return;
-
-		nativeInstance->getGUIElement()->setActive(enabled);
-	}
-
-	void ScriptGUIElement::internal_setDisabled(ScriptGUIElementBaseTBase* nativeInstance, bool disabled)
-	{
-		if (nativeInstance->isDestroyed())
-			return;
-
-		nativeInstance->getGUIElement()->setDisabled(disabled);
-	}
-
-	void ScriptGUIElement::internal_setFocus(ScriptGUIElementBaseTBase* nativeInstance, bool focus)
-	{
-		if (nativeInstance->isDestroyed())
-			return;
-
-		GUIElementBase* guiElemBase = nativeInstance->getGUIElement();
-		if (guiElemBase->_getType() == GUIElementBase::Type::Element)
-		{
-			GUIElement* guiElem = static_cast<GUIElement*>(guiElemBase);
-			guiElem->setFocus(focus);
-		}		
-	}
-
-	bool ScriptGUIElement::internal_getVisible(ScriptGUIElementBaseTBase* nativeInstance)
-	{
-		if (nativeInstance->isDestroyed())
-			return false;
-
-		GUIElementBase* guiElemBase = nativeInstance->getGUIElement();
-		return guiElemBase->_isVisible();
-	}
-
-	bool ScriptGUIElement::internal_getActive(ScriptGUIElementBaseTBase* nativeInstance)
-	{
-		if (nativeInstance->isDestroyed())
-			return false;
-
-		GUIElementBase* guiElemBase = nativeInstance->getGUIElement();
-		return guiElemBase->_isActive();
-	}
-
-	bool ScriptGUIElement::internal_getDisabled(ScriptGUIElementBaseTBase* nativeInstance)
-	{
-		if (nativeInstance->isDestroyed())
-			return false;
-
-		GUIElementBase* guiElemBase = nativeInstance->getGUIElement();
-		return guiElemBase->_isDisabled();
-	}
-
-	MonoObject* ScriptGUIElement::internal_getParent(ScriptGUIElementBaseTBase* nativeInstance)
-	{
-		if (nativeInstance->isDestroyed())
-			return nullptr;
-
-		if (nativeInstance->getParent() != nullptr)
-			return nativeInstance->getParent()->getManagedInstance();
-
-		return nullptr;
-	}
-
-	Rect2I ScriptGUIElement::internal_getBounds(ScriptGUIElementBaseTBase* nativeInstance)
-	{
-		if (nativeInstance->isDestroyed())
-			return Rect2I();
-
-		return nativeInstance->getGUIElement()->getBounds();
-	}
-
-	void ScriptGUIElement::internal_setBounds(ScriptGUIElementBaseTBase* nativeInstance, Rect2I bounds)
-	{
-		if (nativeInstance->isDestroyed())
-			return;
-
-		nativeInstance->getGUIElement()->setPosition(bounds.x, bounds.y);
-		nativeInstance->getGUIElement()->setWidth(bounds.width);
-		nativeInstance->getGUIElement()->setHeight(bounds.height);
-	}
-
-	Rect2I ScriptGUIElement::internal_getVisibleBounds(ScriptGUIElementBaseTBase* nativeInstance)
-	{
-		if (nativeInstance->isDestroyed())
-			return Rect2I();
-
-		return nativeInstance->getGUIElement()->getVisibleBounds();
-	}
-
-	void ScriptGUIElement::internal_SetPosition(ScriptGUIElementBaseTBase* nativeInstance, INT32 x, INT32 y)
-	{
-		if (nativeInstance->isDestroyed())
-			return;
-
-		nativeInstance->getGUIElement()->setPosition(x, y);
-	}
-
-	void ScriptGUIElement::internal_SetWidth(ScriptGUIElementBaseTBase* nativeInstance, UINT32 width)
-	{
-		if (nativeInstance->isDestroyed())
-			return;
-
-		nativeInstance->getGUIElement()->setWidth(width);
-	}
-
-	void ScriptGUIElement::internal_SetFlexibleWidth(ScriptGUIElementBaseTBase* nativeInstance, UINT32 minWidth, UINT32 maxWidth)
-	{
-		if (nativeInstance->isDestroyed())
-			return;
-
-		nativeInstance->getGUIElement()->setFlexibleWidth(minWidth, maxWidth);
-	}
-
-	void ScriptGUIElement::internal_SetHeight(ScriptGUIElementBaseTBase* nativeInstance, UINT32 height)
-	{
-		if (nativeInstance->isDestroyed())
-			return;
-
-		nativeInstance->getGUIElement()->setHeight(height);
-	}
-
-	void ScriptGUIElement::internal_SetFlexibleHeight(ScriptGUIElementBaseTBase* nativeInstance, UINT32 minHeight, UINT32 maxHeight)
-	{
-		if (nativeInstance->isDestroyed())
-			return;
-
-		nativeInstance->getGUIElement()->setFlexibleHeight(minHeight, maxHeight);
-	}
-
-	void ScriptGUIElement::internal_ResetDimensions(ScriptGUIElementBaseTBase* nativeInstance)
-	{
-		if (nativeInstance->isDestroyed())
-			return;
-
-		nativeInstance->getGUIElement()->resetDimensions();
-	}
-
-	void ScriptGUIElement::internal_SetContextMenu(ScriptGUIElementBaseTBase* nativeInstance, ScriptContextMenu* contextMenu)
-	{
-		if (nativeInstance->isDestroyed())
-			return;
-
-		GUIElementBase* guiElemBase = nativeInstance->getGUIElement();
-		if (guiElemBase->_getType() == GUIElementBase::Type::Element)
-		{
-			GUIElement* guiElem = static_cast<GUIElement*>(guiElemBase);
-
-			GUIContextMenuPtr nativeContextMenu;
-			if (contextMenu != nullptr)
-				nativeContextMenu = contextMenu->getInternal();
-
-			guiElem->setContextMenu(nativeContextMenu);
-		}
-	}
-
-	MonoString* ScriptGUIElement::internal_GetStyle(ScriptGUIElementBaseTBase* nativeInstance)
-	{
-		if (!nativeInstance->isDestroyed())
-		{
-			GUIElementBase* guiElemBase = nativeInstance->getGUIElement();
-			if (guiElemBase->_getType() == GUIElementBase::Type::Element)
-			{
-				GUIElement* guiElem = static_cast<GUIElement*>(guiElemBase);
-				return MonoUtil::stringToMono(guiElem->getStyleName());
-			}
-		}
-
-		return MonoUtil::stringToMono(StringUtil::BLANK);
-	}
-
-	void ScriptGUIElement::internal_SetStyle(ScriptGUIElementBaseTBase* nativeInstance, MonoString* style)
-	{
-		if (!nativeInstance->isDestroyed())
-		{
-			GUIElementBase* guiElemBase = nativeInstance->getGUIElement();
-			if (guiElemBase->_getType() == GUIElementBase::Type::Element)
-			{
-				GUIElement* guiElem = static_cast<GUIElement*>(guiElemBase);
-				guiElem->setStyle(MonoUtil::monoToString(style));
-			}
-		}
-	}
+#include "BsScriptGUIElement.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsMonoUtil.h"
+#include "BsGUIElement.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptContextMenu.h"
+#include "BsGUIElement.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUIElementBaseTBase::ScriptGUIElementBaseTBase(MonoObject* instance)
+		:ScriptObjectBase(instance), mIsDestroyed(false), mElement(nullptr), mParent(nullptr)
+	{ }
+
+	void ScriptGUIElementBaseTBase::initialize(GUIElementBase* element)
+	{
+		mElement = element;
+
+		if (mElement != nullptr && mElement->_getType() == GUIElementBase::Type::Element)
+		{
+			GUIElement* guiElem = static_cast<GUIElement*>(element);
+			guiElem->onFocusChanged.connect(std::bind(&ScriptGUIElementBaseTBase::onFocusChanged, mManagedInstance, _1));
+		}
+	}
+
+	void ScriptGUIElementBaseTBase::onFocusChanged(MonoObject* instance, bool focus)
+	{
+		if (focus)
+			MonoUtil::invokeThunk(ScriptGUIElement::onFocusGainedThunk, instance);
+		else
+			MonoUtil::invokeThunk(ScriptGUIElement::onFocusLostThunk, instance);
+	}
+
+	void ScriptGUIElementBaseTBase::_onManagedInstanceDeleted()
+	{
+		destroy();
+
+		ScriptObjectBase::_onManagedInstanceDeleted();
+	}
+
+	ScriptGUIElementTBase::ScriptGUIElementTBase(MonoObject* instance)
+		:ScriptGUIElementBaseTBase(instance)
+	{
+
+	}
+
+	void ScriptGUIElementTBase::destroy()
+	{
+		if(!mIsDestroyed)
+		{
+			if (mParent != nullptr)
+				mParent->removeChild(this);
+
+			if (mElement->_getType() == GUIElementBase::Type::Element)
+			{
+				GUIElement::destroy((GUIElement*)mElement);
+				mElement = nullptr;
+
+				mIsDestroyed = true;
+			}
+		}
+	}
+
+	ScriptGUIElement::OnFocusChangedThunkDef ScriptGUIElement::onFocusGainedThunk;
+	ScriptGUIElement::OnFocusChangedThunkDef ScriptGUIElement::onFocusLostThunk;
+
+	ScriptGUIElement::ScriptGUIElement(MonoObject* instance)
+		:ScriptObject(instance)
+	{
+
+	}
+
+	void ScriptGUIElement::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_Destroy", &ScriptGUIElement::internal_destroy);
+		metaData.scriptClass->addInternalCall("Internal_SetVisible", &ScriptGUIElement::internal_setVisible);
+		metaData.scriptClass->addInternalCall("Internal_SetActive", &ScriptGUIElement::internal_setActive);
+		metaData.scriptClass->addInternalCall("Internal_SetDisabled", &ScriptGUIElement::internal_setDisabled);
+		metaData.scriptClass->addInternalCall("Internal_GetVisible", &ScriptGUIElement::internal_getVisible);
+		metaData.scriptClass->addInternalCall("Internal_GetActive", &ScriptGUIElement::internal_getActive);
+		metaData.scriptClass->addInternalCall("Internal_GetDisabled", &ScriptGUIElement::internal_getDisabled);
+		metaData.scriptClass->addInternalCall("Internal_SetFocus", &ScriptGUIElement::internal_setFocus);
+		metaData.scriptClass->addInternalCall("Internal_GetParent", &ScriptGUIElement::internal_getParent);
+		metaData.scriptClass->addInternalCall("Internal_GetBounds", &ScriptGUIElement::internal_getBounds);
+		metaData.scriptClass->addInternalCall("Internal_SetBounds", &ScriptGUIElement::internal_setBounds);
+		metaData.scriptClass->addInternalCall("Internal_GetVisibleBounds", &ScriptGUIElement::internal_getVisibleBounds);
+		metaData.scriptClass->addInternalCall("Internal_SetPosition", &ScriptGUIElement::internal_SetPosition);
+		metaData.scriptClass->addInternalCall("Internal_SetWidth", &ScriptGUIElement::internal_SetWidth);
+		metaData.scriptClass->addInternalCall("Internal_SetFlexibleWidth", &ScriptGUIElement::internal_SetFlexibleWidth);
+		metaData.scriptClass->addInternalCall("Internal_SetHeight", &ScriptGUIElement::internal_SetHeight);
+		metaData.scriptClass->addInternalCall("Internal_SetFlexibleHeight", &ScriptGUIElement::internal_SetFlexibleHeight);
+		metaData.scriptClass->addInternalCall("Internal_ResetDimensions", &ScriptGUIElement::internal_ResetDimensions);
+		metaData.scriptClass->addInternalCall("Internal_SetContextMenu", &ScriptGUIElement::internal_SetContextMenu);
+		metaData.scriptClass->addInternalCall("Internal_GetStyle", &ScriptGUIElement::internal_GetStyle);
+		metaData.scriptClass->addInternalCall("Internal_SetStyle", &ScriptGUIElement::internal_SetStyle);
+
+		onFocusGainedThunk = (OnFocusChangedThunkDef)metaData.scriptClass->getMethod("Internal_OnFocusGained", 0)->getThunk();
+		onFocusLostThunk = (OnFocusChangedThunkDef)metaData.scriptClass->getMethod("Internal_OnFocusLost", 0)->getThunk();
+	}
+
+	void ScriptGUIElement::internal_destroy(ScriptGUIElementBaseTBase* nativeInstance)
+	{
+		nativeInstance->destroy();
+	}
+
+	void ScriptGUIElement::internal_setVisible(ScriptGUIElementBaseTBase* nativeInstance, bool visible)
+	{
+		if (nativeInstance->isDestroyed())
+			return;
+
+		nativeInstance->getGUIElement()->setVisible(visible);
+	}
+
+	void ScriptGUIElement::internal_setActive(ScriptGUIElementBaseTBase* nativeInstance, bool enabled)
+	{
+		if (nativeInstance->isDestroyed())
+			return;
+
+		nativeInstance->getGUIElement()->setActive(enabled);
+	}
+
+	void ScriptGUIElement::internal_setDisabled(ScriptGUIElementBaseTBase* nativeInstance, bool disabled)
+	{
+		if (nativeInstance->isDestroyed())
+			return;
+
+		nativeInstance->getGUIElement()->setDisabled(disabled);
+	}
+
+	void ScriptGUIElement::internal_setFocus(ScriptGUIElementBaseTBase* nativeInstance, bool focus)
+	{
+		if (nativeInstance->isDestroyed())
+			return;
+
+		GUIElementBase* guiElemBase = nativeInstance->getGUIElement();
+		if (guiElemBase->_getType() == GUIElementBase::Type::Element)
+		{
+			GUIElement* guiElem = static_cast<GUIElement*>(guiElemBase);
+			guiElem->setFocus(focus);
+		}		
+	}
+
+	bool ScriptGUIElement::internal_getVisible(ScriptGUIElementBaseTBase* nativeInstance)
+	{
+		if (nativeInstance->isDestroyed())
+			return false;
+
+		GUIElementBase* guiElemBase = nativeInstance->getGUIElement();
+		return guiElemBase->_isVisible();
+	}
+
+	bool ScriptGUIElement::internal_getActive(ScriptGUIElementBaseTBase* nativeInstance)
+	{
+		if (nativeInstance->isDestroyed())
+			return false;
+
+		GUIElementBase* guiElemBase = nativeInstance->getGUIElement();
+		return guiElemBase->_isActive();
+	}
+
+	bool ScriptGUIElement::internal_getDisabled(ScriptGUIElementBaseTBase* nativeInstance)
+	{
+		if (nativeInstance->isDestroyed())
+			return false;
+
+		GUIElementBase* guiElemBase = nativeInstance->getGUIElement();
+		return guiElemBase->_isDisabled();
+	}
+
+	MonoObject* ScriptGUIElement::internal_getParent(ScriptGUIElementBaseTBase* nativeInstance)
+	{
+		if (nativeInstance->isDestroyed())
+			return nullptr;
+
+		if (nativeInstance->getParent() != nullptr)
+			return nativeInstance->getParent()->getManagedInstance();
+
+		return nullptr;
+	}
+
+	void ScriptGUIElement::internal_getBounds(ScriptGUIElementBaseTBase* nativeInstance, Rect2I* bounds)
+	{
+		if (nativeInstance->isDestroyed())
+		{
+			*bounds = Rect2I();
+			return;
+		}
+
+		*bounds = nativeInstance->getGUIElement()->getBounds();
+	}
+
+	void ScriptGUIElement::internal_setBounds(ScriptGUIElementBaseTBase* nativeInstance, Rect2I* bounds)
+	{
+		if (nativeInstance->isDestroyed())
+			return;
+
+		nativeInstance->getGUIElement()->setPosition(bounds->x, bounds->y);
+		nativeInstance->getGUIElement()->setWidth(bounds->width);
+		nativeInstance->getGUIElement()->setHeight(bounds->height);
+	}
+
+	void ScriptGUIElement::internal_getVisibleBounds(ScriptGUIElementBaseTBase* nativeInstance, Rect2I* bounds)
+	{
+		if (nativeInstance->isDestroyed())
+		{
+			*bounds = Rect2I();
+			return;
+		}
+
+		*bounds = nativeInstance->getGUIElement()->getVisibleBounds();
+	}
+
+	void ScriptGUIElement::internal_SetPosition(ScriptGUIElementBaseTBase* nativeInstance, INT32 x, INT32 y)
+	{
+		if (nativeInstance->isDestroyed())
+			return;
+
+		nativeInstance->getGUIElement()->setPosition(x, y);
+	}
+
+	void ScriptGUIElement::internal_SetWidth(ScriptGUIElementBaseTBase* nativeInstance, UINT32 width)
+	{
+		if (nativeInstance->isDestroyed())
+			return;
+
+		nativeInstance->getGUIElement()->setWidth(width);
+	}
+
+	void ScriptGUIElement::internal_SetFlexibleWidth(ScriptGUIElementBaseTBase* nativeInstance, UINT32 minWidth, UINT32 maxWidth)
+	{
+		if (nativeInstance->isDestroyed())
+			return;
+
+		nativeInstance->getGUIElement()->setFlexibleWidth(minWidth, maxWidth);
+	}
+
+	void ScriptGUIElement::internal_SetHeight(ScriptGUIElementBaseTBase* nativeInstance, UINT32 height)
+	{
+		if (nativeInstance->isDestroyed())
+			return;
+
+		nativeInstance->getGUIElement()->setHeight(height);
+	}
+
+	void ScriptGUIElement::internal_SetFlexibleHeight(ScriptGUIElementBaseTBase* nativeInstance, UINT32 minHeight, UINT32 maxHeight)
+	{
+		if (nativeInstance->isDestroyed())
+			return;
+
+		nativeInstance->getGUIElement()->setFlexibleHeight(minHeight, maxHeight);
+	}
+
+	void ScriptGUIElement::internal_ResetDimensions(ScriptGUIElementBaseTBase* nativeInstance)
+	{
+		if (nativeInstance->isDestroyed())
+			return;
+
+		nativeInstance->getGUIElement()->resetDimensions();
+	}
+
+	void ScriptGUIElement::internal_SetContextMenu(ScriptGUIElementBaseTBase* nativeInstance, ScriptContextMenu* contextMenu)
+	{
+		if (nativeInstance->isDestroyed())
+			return;
+
+		GUIElementBase* guiElemBase = nativeInstance->getGUIElement();
+		if (guiElemBase->_getType() == GUIElementBase::Type::Element)
+		{
+			GUIElement* guiElem = static_cast<GUIElement*>(guiElemBase);
+
+			GUIContextMenuPtr nativeContextMenu;
+			if (contextMenu != nullptr)
+				nativeContextMenu = contextMenu->getInternal();
+
+			guiElem->setContextMenu(nativeContextMenu);
+		}
+	}
+
+	MonoString* ScriptGUIElement::internal_GetStyle(ScriptGUIElementBaseTBase* nativeInstance)
+	{
+		if (!nativeInstance->isDestroyed())
+		{
+			GUIElementBase* guiElemBase = nativeInstance->getGUIElement();
+			if (guiElemBase->_getType() == GUIElementBase::Type::Element)
+			{
+				GUIElement* guiElem = static_cast<GUIElement*>(guiElemBase);
+				return MonoUtil::stringToMono(guiElem->getStyleName());
+			}
+		}
+
+		return MonoUtil::stringToMono(StringUtil::BLANK);
+	}
+
+	void ScriptGUIElement::internal_SetStyle(ScriptGUIElementBaseTBase* nativeInstance, MonoString* style)
+	{
+		if (!nativeInstance->isDestroyed())
+		{
+			GUIElementBase* guiElemBase = nativeInstance->getGUIElement();
+			if (guiElemBase->_getType() == GUIElementBase::Type::Element)
+			{
+				GUIElement* guiElem = static_cast<GUIElement*>(guiElemBase);
+				guiElem->setStyle(MonoUtil::monoToString(style));
+			}
+		}
+	}
 }

+ 22 - 22
SBansheeEngine/Source/BsScriptGUIElementStyle.cpp

@@ -197,9 +197,9 @@ namespace BansheeEngine
 		*value = ScriptGUIElementStateStyle::toManaged(nativeInstance->mElementStyle.normal);
 	}
 
-	void ScriptGUIElementStyle::internal_SetNormal(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value)
+	void ScriptGUIElementStyle::internal_SetNormal(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value)
 	{
-		nativeInstance->mElementStyle.normal = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle.normal = ScriptGUIElementStateStyle::toNative(*value);
 	}
 
 	void ScriptGUIElementStyle::internal_GetHover(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value)
@@ -207,9 +207,9 @@ namespace BansheeEngine
 		*value = ScriptGUIElementStateStyle::toManaged(nativeInstance->mElementStyle.hover);
 	}
 
-	void ScriptGUIElementStyle::internal_SetHover(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value)
+	void ScriptGUIElementStyle::internal_SetHover(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value)
 	{
-		nativeInstance->mElementStyle.hover = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle.hover = ScriptGUIElementStateStyle::toNative(*value);
 	}
 
 	void ScriptGUIElementStyle::internal_GetActive(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value)
@@ -217,9 +217,9 @@ namespace BansheeEngine
 		*value = ScriptGUIElementStateStyle::toManaged(nativeInstance->mElementStyle.active);
 	}
 
-	void ScriptGUIElementStyle::internal_SetActive(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value)
+	void ScriptGUIElementStyle::internal_SetActive(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value)
 	{
-		nativeInstance->mElementStyle.active = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle.active = ScriptGUIElementStateStyle::toNative(*value);
 	}
 
 	void ScriptGUIElementStyle::internal_GetFocused(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value)
@@ -227,9 +227,9 @@ namespace BansheeEngine
 		*value = ScriptGUIElementStateStyle::toManaged(nativeInstance->mElementStyle.focused);
 	}
 
-	void ScriptGUIElementStyle::internal_SetFocused(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value)
+	void ScriptGUIElementStyle::internal_SetFocused(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value)
 	{
-		nativeInstance->mElementStyle.focused = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle.focused = ScriptGUIElementStateStyle::toNative(*value);
 	}
 
 	void ScriptGUIElementStyle::internal_GetNormalOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value)
@@ -237,9 +237,9 @@ namespace BansheeEngine
 		*value = ScriptGUIElementStateStyle::toManaged(nativeInstance->mElementStyle.normalOn);
 	}
 
-	void ScriptGUIElementStyle::internal_SetNormalOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value)
+	void ScriptGUIElementStyle::internal_SetNormalOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value)
 	{
-		nativeInstance->mElementStyle.normalOn = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle.normalOn = ScriptGUIElementStateStyle::toNative(*value);
 	}
 
 	void ScriptGUIElementStyle::internal_GetHoverOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value)
@@ -247,9 +247,9 @@ namespace BansheeEngine
 		*value = ScriptGUIElementStateStyle::toManaged(nativeInstance->mElementStyle.hoverOn);
 	}
 
-	void ScriptGUIElementStyle::internal_SetHoverOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value)
+	void ScriptGUIElementStyle::internal_SetHoverOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value)
 	{
-		nativeInstance->mElementStyle.hoverOn = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle.hoverOn = ScriptGUIElementStateStyle::toNative(*value);
 	}
 
 	void ScriptGUIElementStyle::internal_GetActiveOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value)
@@ -257,9 +257,9 @@ namespace BansheeEngine
 		*value = ScriptGUIElementStateStyle::toManaged(nativeInstance->mElementStyle.activeOn);
 	}
 
-	void ScriptGUIElementStyle::internal_SetActiveOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value)
+	void ScriptGUIElementStyle::internal_SetActiveOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value)
 	{
-		nativeInstance->mElementStyle.activeOn = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle.activeOn = ScriptGUIElementStateStyle::toNative(*value);
 	}
 
 	void ScriptGUIElementStyle::internal_GetFocusedOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value)
@@ -267,9 +267,9 @@ namespace BansheeEngine
 		*value = ScriptGUIElementStateStyle::toManaged(nativeInstance->mElementStyle.focusedOn);
 	}
 
-	void ScriptGUIElementStyle::internal_SetFocusedOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct value)
+	void ScriptGUIElementStyle::internal_SetFocusedOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value)
 	{
-		nativeInstance->mElementStyle.focusedOn = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle.focusedOn = ScriptGUIElementStateStyle::toNative(*value);
 	}
 
 	void ScriptGUIElementStyle::internal_GetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset* value)
@@ -277,9 +277,9 @@ namespace BansheeEngine
 		*value = nativeInstance->mElementStyle.border;
 	}
 
-	void ScriptGUIElementStyle::internal_SetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset value)
+	void ScriptGUIElementStyle::internal_SetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset* value)
 	{
-		nativeInstance->mElementStyle.border = value;
+		nativeInstance->mElementStyle.border = *value;
 	}
 
 	void ScriptGUIElementStyle::internal_GetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset* value)
@@ -287,9 +287,9 @@ namespace BansheeEngine
 		*value = nativeInstance->mElementStyle.margins;
 	}
 
-	void ScriptGUIElementStyle::internal_SetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset value)
+	void ScriptGUIElementStyle::internal_SetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset* value)
 	{
-		nativeInstance->mElementStyle.margins = value;
+		nativeInstance->mElementStyle.margins = *value;
 	}
 
 	void ScriptGUIElementStyle::internal_GetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset* value)
@@ -297,9 +297,9 @@ namespace BansheeEngine
 		*value = nativeInstance->mElementStyle.contentOffset;
 	}
 
-	void ScriptGUIElementStyle::internal_SetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset value)
+	void ScriptGUIElementStyle::internal_SetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset* value)
 	{
-		nativeInstance->mElementStyle.contentOffset = value;
+		nativeInstance->mElementStyle.contentOffset = *value;
 	}
 
 	void ScriptGUIElementStyle::internal_GetWidth(ScriptGUIElementStyle* nativeInstance, UINT32* value)

+ 2 - 2
SBansheeEngine/Source/BsScriptGUIInputBox.cpp

@@ -57,10 +57,10 @@ namespace BansheeEngine
 		inputBox->setText(MonoUtil::monoToWString(text));
 	}
 
-	void ScriptGUIInputBox::internal_setTint(ScriptGUIInputBox* nativeInstance, Color color)
+	void ScriptGUIInputBox::internal_setTint(ScriptGUIInputBox* nativeInstance, Color* color)
 	{
 		GUIInputBox* inputBox = (GUIInputBox*)nativeInstance->getGUIElement();
-		inputBox->setTint(color);
+		inputBox->setTint(*color);
 	}
 
 	void ScriptGUIInputBox::onChanged(MonoObject* instance, const WString& newValue)

+ 2 - 2
SBansheeEngine/Source/BsScriptGUILabel.cpp

@@ -50,9 +50,9 @@ namespace BansheeEngine
 		label->setContent(nativeContent);
 	}
 
-	void ScriptGUILabel::internal_setTint(ScriptGUILabel* nativeInstance, Color color)
+	void ScriptGUILabel::internal_setTint(ScriptGUILabel* nativeInstance, Color* color)
 	{
 		GUILabel* label = (GUILabel*)nativeInstance->getGUIElement();
-		label->setTint(color);
+		label->setTint(*color);
 	}
 }

+ 2 - 2
SBansheeEngine/Source/BsScriptGUIListBox.cpp

@@ -89,10 +89,10 @@ namespace BansheeEngine
 		listBox->setElements(nativeElements);
 	}
 
-	void ScriptGUIListBox::internal_setTint(ScriptGUIListBox* nativeInstance, Color color)
+	void ScriptGUIListBox::internal_setTint(ScriptGUIListBox* nativeInstance, Color* color)
 	{
 		GUIListBox* listBox = (GUIListBox*)nativeInstance->getGUIElement();
-		listBox->setTint(color);
+		listBox->setTint(*color);
 	}
 
 	void ScriptGUIListBox::internal_selectElement(ScriptGUIListBox* nativeInstance, int idx)

+ 63 - 63
SBansheeEngine/Source/BsScriptGUIProgressBar.cpp

@@ -1,64 +1,64 @@
-#include "BsScriptGUIProgressBar.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
-#include "BsMonoUtil.h"
-#include "BsGUILayout.h"
-#include "BsGUIProgressBar.h"
-#include "BsGUIOptions.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUIProgressBar::ScriptGUIProgressBar(MonoObject* instance, GUIProgressBar* progressBar)
-		:TScriptGUIElement(instance, progressBar)
-	{
-
-	}
-
-	void ScriptGUIProgressBar::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIProgressBar::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_SetPercent", &ScriptGUIProgressBar::internal_setPercent);
-		metaData.scriptClass->addInternalCall("Internal_GetPercent", &ScriptGUIProgressBar::internal_getPercent);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIProgressBar::internal_setTint);
-	}
-
-	void ScriptGUIProgressBar::internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		GUIProgressBar* progressBar = GUIProgressBar::create(options, toString(MonoUtil::monoToWString(style)));
-		ScriptGUIProgressBar* nativeInstance = new (bs_alloc<ScriptGUIProgressBar>()) ScriptGUIProgressBar(instance, progressBar);
-	}
-
-	void ScriptGUIProgressBar::internal_setPercent(ScriptGUIProgressBar* nativeInstance, float percent)
-	{
-		GUIProgressBar* progressBar = (GUIProgressBar*)nativeInstance->getGUIElement();
-		progressBar->setPercent(percent);
-	}
-
-	float ScriptGUIProgressBar::internal_getPercent(ScriptGUIProgressBar* nativeInstance)
-	{
-		GUIProgressBar* progressBar = (GUIProgressBar*)nativeInstance->getGUIElement();
-		return progressBar->getPercent();
-	}
-
-	void ScriptGUIProgressBar::internal_setTint(ScriptGUIProgressBar* nativeInstance, Color color)
-	{
-		GUIProgressBar* progressBar = (GUIProgressBar*)nativeInstance->getGUIElement();
-		progressBar->setTint(color);
-	}
+#include "BsScriptGUIProgressBar.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsSpriteTexture.h"
+#include "BsMonoUtil.h"
+#include "BsGUILayout.h"
+#include "BsGUIProgressBar.h"
+#include "BsGUIOptions.h"
+#include "BsScriptGUIElementStyle.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUIProgressBar::ScriptGUIProgressBar(MonoObject* instance, GUIProgressBar* progressBar)
+		:TScriptGUIElement(instance, progressBar)
+	{
+
+	}
+
+	void ScriptGUIProgressBar::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIProgressBar::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_SetPercent", &ScriptGUIProgressBar::internal_setPercent);
+		metaData.scriptClass->addInternalCall("Internal_GetPercent", &ScriptGUIProgressBar::internal_getPercent);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIProgressBar::internal_setTint);
+	}
+
+	void ScriptGUIProgressBar::internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		GUIProgressBar* progressBar = GUIProgressBar::create(options, toString(MonoUtil::monoToWString(style)));
+		ScriptGUIProgressBar* nativeInstance = new (bs_alloc<ScriptGUIProgressBar>()) ScriptGUIProgressBar(instance, progressBar);
+	}
+
+	void ScriptGUIProgressBar::internal_setPercent(ScriptGUIProgressBar* nativeInstance, float percent)
+	{
+		GUIProgressBar* progressBar = (GUIProgressBar*)nativeInstance->getGUIElement();
+		progressBar->setPercent(percent);
+	}
+
+	float ScriptGUIProgressBar::internal_getPercent(ScriptGUIProgressBar* nativeInstance)
+	{
+		GUIProgressBar* progressBar = (GUIProgressBar*)nativeInstance->getGUIElement();
+		return progressBar->getPercent();
+	}
+
+	void ScriptGUIProgressBar::internal_setTint(ScriptGUIProgressBar* nativeInstance, Color* color)
+	{
+		GUIProgressBar* progressBar = (GUIProgressBar*)nativeInstance->getGUIElement();
+		progressBar->setTint(*color);
+	}
 }

+ 64 - 64
SBansheeEngine/Source/BsScriptGUIRenderTexture.cpp

@@ -1,65 +1,65 @@
-#include "BsScriptGUIRenderTexture.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsSpriteTexture.h"
-#include "BsMonoUtil.h"
-#include "BsGUILayout.h"
-#include "BsGUIRenderTexture.h"
-#include "BsGUIOptions.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-#include "BsScriptRenderTexture2D.h"
-
-namespace BansheeEngine
-{
-	ScriptGUIRenderTexture::ScriptGUIRenderTexture(MonoObject* instance, GUIRenderTexture* texture)
-		:TScriptGUIElement(instance, texture)
-	{
-
-	}
-
-	void ScriptGUIRenderTexture::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIRenderTexture::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_SetTexture", &ScriptGUIRenderTexture::internal_setTexture);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIRenderTexture::internal_setTint);
-	}
-
-	void ScriptGUIRenderTexture::internal_createInstance(MonoObject* instance, 
-		ScriptRenderTexture2D* texture, MonoString* style, MonoArray* guiOptions)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		RenderTexturePtr renderTexture;
-		if (texture != nullptr)
-			renderTexture = texture->getRenderTexture();
-
-		GUIRenderTexture* guiTexture = GUIRenderTexture::create(renderTexture, options, toString(MonoUtil::monoToWString(style)));
-
-		ScriptGUIRenderTexture* nativeInstance = new (bs_alloc<ScriptGUIRenderTexture>()) ScriptGUIRenderTexture(instance, guiTexture);
-	}
-
-	void ScriptGUIRenderTexture::internal_setTexture(ScriptGUIRenderTexture* nativeInstance, ScriptRenderTexture2D* texture)
-	{
-		RenderTexturePtr renderTexture;
-		if (texture != nullptr)
-			renderTexture = texture->getRenderTexture();
-
-		GUIRenderTexture* guiTexture = (GUIRenderTexture*)nativeInstance->getGUIElement();
-		guiTexture->setRenderTexture(renderTexture);
-	}
-
-	void ScriptGUIRenderTexture::internal_setTint(ScriptGUIRenderTexture* nativeInstance, Color color)
-	{
-		GUIRenderTexture* guiTexture = (GUIRenderTexture*)nativeInstance->getGUIElement();
-		guiTexture->setTint(color);
-	}
+#include "BsScriptGUIRenderTexture.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsSpriteTexture.h"
+#include "BsMonoUtil.h"
+#include "BsGUILayout.h"
+#include "BsGUIRenderTexture.h"
+#include "BsGUIOptions.h"
+#include "BsScriptGUIElementStyle.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+#include "BsScriptRenderTexture2D.h"
+
+namespace BansheeEngine
+{
+	ScriptGUIRenderTexture::ScriptGUIRenderTexture(MonoObject* instance, GUIRenderTexture* texture)
+		:TScriptGUIElement(instance, texture)
+	{
+
+	}
+
+	void ScriptGUIRenderTexture::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIRenderTexture::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_SetTexture", &ScriptGUIRenderTexture::internal_setTexture);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIRenderTexture::internal_setTint);
+	}
+
+	void ScriptGUIRenderTexture::internal_createInstance(MonoObject* instance, 
+		ScriptRenderTexture2D* texture, MonoString* style, MonoArray* guiOptions)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		RenderTexturePtr renderTexture;
+		if (texture != nullptr)
+			renderTexture = texture->getRenderTexture();
+
+		GUIRenderTexture* guiTexture = GUIRenderTexture::create(renderTexture, options, toString(MonoUtil::monoToWString(style)));
+
+		ScriptGUIRenderTexture* nativeInstance = new (bs_alloc<ScriptGUIRenderTexture>()) ScriptGUIRenderTexture(instance, guiTexture);
+	}
+
+	void ScriptGUIRenderTexture::internal_setTexture(ScriptGUIRenderTexture* nativeInstance, ScriptRenderTexture2D* texture)
+	{
+		RenderTexturePtr renderTexture;
+		if (texture != nullptr)
+			renderTexture = texture->getRenderTexture();
+
+		GUIRenderTexture* guiTexture = (GUIRenderTexture*)nativeInstance->getGUIElement();
+		guiTexture->setRenderTexture(renderTexture);
+	}
+
+	void ScriptGUIRenderTexture::internal_setTint(ScriptGUIRenderTexture* nativeInstance, Color* color)
+	{
+		GUIRenderTexture* guiTexture = (GUIRenderTexture*)nativeInstance->getGUIElement();
+		guiTexture->setTint(*color);
+	}
 }

+ 2 - 2
SBansheeEngine/Source/BsScriptGUIScrollArea.cpp

@@ -82,10 +82,10 @@ namespace BansheeEngine
 		ScriptGUIScrollArea* nativeInstance = new (bs_alloc<ScriptGUIScrollArea>()) ScriptGUIScrollArea(instance, guiScrollArea);
 	}
 
-	Rect2I ScriptGUIScrollArea::internal_getContentBounds(ScriptGUIScrollArea* nativeInstance)
+	void ScriptGUIScrollArea::internal_getContentBounds(ScriptGUIScrollArea* nativeInstance, Rect2I* bounds)
 	{
 		GUIScrollArea* guiScrollArea = static_cast<GUIScrollArea*>(nativeInstance->getGUIElement());
-		return guiScrollArea->getContentBounds();
+		*bounds = guiScrollArea->getContentBounds();
 	}
 
 	float ScriptGUIScrollArea::internal_getHorzScroll(ScriptGUIScrollArea* nativeInstance)

+ 185 - 185
SBansheeEngine/Source/BsScriptGUISlider.cpp

@@ -1,186 +1,186 @@
-#include "BsScriptGUISlider.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
-#include "BsMonoUtil.h"
-#include "BsGUILayout.h"
-#include "BsGUISlider.h"
-#include "BsGUIOptions.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUISliderH::OnChangedThunkDef ScriptGUISliderH::onChangedThunk;
-
-	ScriptGUISliderH::ScriptGUISliderH(MonoObject* instance, GUISliderHorz* slider)
-		:TScriptGUIElement(instance, slider)
-	{
-
-	}
-
-	void ScriptGUISliderH::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUISliderH::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_SetPercent", &ScriptGUISliderH::internal_setPercent);
-		metaData.scriptClass->addInternalCall("Internal_GetPercent", &ScriptGUISliderH::internal_getPercent);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUISliderH::internal_setTint);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUISliderH::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUISliderH::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_SetRange", &ScriptGUISliderH::internal_setRange);
-		metaData.scriptClass->addInternalCall("Internal_SetStep", &ScriptGUISliderH::internal_setStep);
-
-		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("DoOnChanged", 1)->getThunk();
-	}
-
-	void ScriptGUISliderH::internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		GUISliderHorz* guiSlider = GUISliderHorz::create(options, toString(MonoUtil::monoToWString(style)));
-		guiSlider->onChanged.connect(std::bind(&ScriptGUISliderH::onChanged, instance, _1));
-
-		ScriptGUISliderH* nativeInstance = new (bs_alloc<ScriptGUISliderH>()) ScriptGUISliderH(instance, guiSlider);
-	}
-
-	void ScriptGUISliderH::internal_setPercent(ScriptGUISliderH* nativeInstance, float percent)
-	{
-		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
-		slider->setPercent(percent);
-	}
-
-	float ScriptGUISliderH::internal_getPercent(ScriptGUISliderH* nativeInstance)
-	{
-		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
-		return slider->getPercent();
-	}
-
-	float ScriptGUISliderH::internal_getValue(ScriptGUISliderH* nativeInstance)
-	{
-		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
-		return slider->getValue();
-	}
-
-	void ScriptGUISliderH::internal_setValue(ScriptGUISliderH* nativeInstance, float percent)
-	{
-		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
-		return slider->setValue(percent);
-	}
-
-	void ScriptGUISliderH::internal_setRange(ScriptGUISliderH* nativeInstance, float min, float max)
-	{
-		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
-		return slider->setRange(min, max);
-	}
-
-	void ScriptGUISliderH::internal_setStep(ScriptGUISliderH* nativeInstance, float step)
-	{
-		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
-		return slider->setStep(step);
-	}
-
-	void ScriptGUISliderH::internal_setTint(ScriptGUISliderH* nativeInstance, Color color)
-	{
-		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
-		slider->setTint(color);
-	}
-
-	void ScriptGUISliderH::onChanged(MonoObject* instance, float percent)
-	{
-		MonoUtil::invokeThunk(onChangedThunk, instance, percent);
-	}
-
-	ScriptGUISliderV::OnChangedThunkDef ScriptGUISliderV::onChangedThunk;
-
-	ScriptGUISliderV::ScriptGUISliderV(MonoObject* instance, GUISliderVert* slider)
-		:TScriptGUIElement(instance, slider)
-	{
-
-	}
-
-	void ScriptGUISliderV::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUISliderV::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_SetPercent", &ScriptGUISliderV::internal_setPercent);
-		metaData.scriptClass->addInternalCall("Internal_GetPercent", &ScriptGUISliderV::internal_getPercent);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUISliderV::internal_setTint);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUISliderV::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUISliderV::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_SetRange", &ScriptGUISliderV::internal_setRange);
-		metaData.scriptClass->addInternalCall("Internal_SetStep", &ScriptGUISliderV::internal_setStep);
-
-		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("DoOnChanged", 1)->getThunk();
-	}
-
-	void ScriptGUISliderV::internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		GUISliderVert* guiSlider = GUISliderVert::create(options, toString(MonoUtil::monoToWString(style)));
-		guiSlider->onChanged.connect(std::bind(&ScriptGUISliderV::onChanged, instance, _1));
-
-		ScriptGUISliderV* nativeInstance = new (bs_alloc<ScriptGUISliderV>()) ScriptGUISliderV(instance, guiSlider);
-	}
-
-	void ScriptGUISliderV::internal_setPercent(ScriptGUISliderV* nativeInstance, float percent)
-	{
-		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
-		slider->setPercent(percent);
-	}
-
-	float ScriptGUISliderV::internal_getPercent(ScriptGUISliderV* nativeInstance)
-	{
-		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
-		return slider->getPercent();
-	}
-
-	float ScriptGUISliderV::internal_getValue(ScriptGUISliderV* nativeInstance)
-	{
-		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
-		return slider->getValue();
-	}
-
-	void ScriptGUISliderV::internal_setValue(ScriptGUISliderV* nativeInstance, float percent)
-	{
-		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
-		return slider->setValue(percent);
-	}
-
-	void ScriptGUISliderV::internal_setRange(ScriptGUISliderV* nativeInstance, float min, float max)
-	{
-		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
-		return slider->setRange(min, max);
-	}
-
-	void ScriptGUISliderV::internal_setStep(ScriptGUISliderV* nativeInstance, float step)
-	{
-		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
-		return slider->setStep(step);
-	}
-
-	void ScriptGUISliderV::internal_setTint(ScriptGUISliderV* nativeInstance, Color color)
-	{
-		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
-		slider->setTint(color);
-	}
-
-	void ScriptGUISliderV::onChanged(MonoObject* instance, float percent)
-	{
-		MonoUtil::invokeThunk(onChangedThunk, instance, percent);
-	}
+#include "BsScriptGUISlider.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsSpriteTexture.h"
+#include "BsMonoUtil.h"
+#include "BsGUILayout.h"
+#include "BsGUISlider.h"
+#include "BsGUIOptions.h"
+#include "BsScriptGUIElementStyle.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUISliderH::OnChangedThunkDef ScriptGUISliderH::onChangedThunk;
+
+	ScriptGUISliderH::ScriptGUISliderH(MonoObject* instance, GUISliderHorz* slider)
+		:TScriptGUIElement(instance, slider)
+	{
+
+	}
+
+	void ScriptGUISliderH::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUISliderH::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_SetPercent", &ScriptGUISliderH::internal_setPercent);
+		metaData.scriptClass->addInternalCall("Internal_GetPercent", &ScriptGUISliderH::internal_getPercent);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUISliderH::internal_setTint);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUISliderH::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUISliderH::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_SetRange", &ScriptGUISliderH::internal_setRange);
+		metaData.scriptClass->addInternalCall("Internal_SetStep", &ScriptGUISliderH::internal_setStep);
+
+		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("DoOnChanged", 1)->getThunk();
+	}
+
+	void ScriptGUISliderH::internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		GUISliderHorz* guiSlider = GUISliderHorz::create(options, toString(MonoUtil::monoToWString(style)));
+		guiSlider->onChanged.connect(std::bind(&ScriptGUISliderH::onChanged, instance, _1));
+
+		ScriptGUISliderH* nativeInstance = new (bs_alloc<ScriptGUISliderH>()) ScriptGUISliderH(instance, guiSlider);
+	}
+
+	void ScriptGUISliderH::internal_setPercent(ScriptGUISliderH* nativeInstance, float percent)
+	{
+		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
+		slider->setPercent(percent);
+	}
+
+	float ScriptGUISliderH::internal_getPercent(ScriptGUISliderH* nativeInstance)
+	{
+		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
+		return slider->getPercent();
+	}
+
+	float ScriptGUISliderH::internal_getValue(ScriptGUISliderH* nativeInstance)
+	{
+		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
+		return slider->getValue();
+	}
+
+	void ScriptGUISliderH::internal_setValue(ScriptGUISliderH* nativeInstance, float percent)
+	{
+		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
+		return slider->setValue(percent);
+	}
+
+	void ScriptGUISliderH::internal_setRange(ScriptGUISliderH* nativeInstance, float min, float max)
+	{
+		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
+		return slider->setRange(min, max);
+	}
+
+	void ScriptGUISliderH::internal_setStep(ScriptGUISliderH* nativeInstance, float step)
+	{
+		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
+		return slider->setStep(step);
+	}
+
+	void ScriptGUISliderH::internal_setTint(ScriptGUISliderH* nativeInstance, Color* color)
+	{
+		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
+		slider->setTint(*color);
+	}
+
+	void ScriptGUISliderH::onChanged(MonoObject* instance, float percent)
+	{
+		MonoUtil::invokeThunk(onChangedThunk, instance, percent);
+	}
+
+	ScriptGUISliderV::OnChangedThunkDef ScriptGUISliderV::onChangedThunk;
+
+	ScriptGUISliderV::ScriptGUISliderV(MonoObject* instance, GUISliderVert* slider)
+		:TScriptGUIElement(instance, slider)
+	{
+
+	}
+
+	void ScriptGUISliderV::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUISliderV::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_SetPercent", &ScriptGUISliderV::internal_setPercent);
+		metaData.scriptClass->addInternalCall("Internal_GetPercent", &ScriptGUISliderV::internal_getPercent);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUISliderV::internal_setTint);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUISliderV::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUISliderV::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_SetRange", &ScriptGUISliderV::internal_setRange);
+		metaData.scriptClass->addInternalCall("Internal_SetStep", &ScriptGUISliderV::internal_setStep);
+
+		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("DoOnChanged", 1)->getThunk();
+	}
+
+	void ScriptGUISliderV::internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		GUISliderVert* guiSlider = GUISliderVert::create(options, toString(MonoUtil::monoToWString(style)));
+		guiSlider->onChanged.connect(std::bind(&ScriptGUISliderV::onChanged, instance, _1));
+
+		ScriptGUISliderV* nativeInstance = new (bs_alloc<ScriptGUISliderV>()) ScriptGUISliderV(instance, guiSlider);
+	}
+
+	void ScriptGUISliderV::internal_setPercent(ScriptGUISliderV* nativeInstance, float percent)
+	{
+		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
+		slider->setPercent(percent);
+	}
+
+	float ScriptGUISliderV::internal_getPercent(ScriptGUISliderV* nativeInstance)
+	{
+		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
+		return slider->getPercent();
+	}
+
+	float ScriptGUISliderV::internal_getValue(ScriptGUISliderV* nativeInstance)
+	{
+		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
+		return slider->getValue();
+	}
+
+	void ScriptGUISliderV::internal_setValue(ScriptGUISliderV* nativeInstance, float percent)
+	{
+		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
+		return slider->setValue(percent);
+	}
+
+	void ScriptGUISliderV::internal_setRange(ScriptGUISliderV* nativeInstance, float min, float max)
+	{
+		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
+		return slider->setRange(min, max);
+	}
+
+	void ScriptGUISliderV::internal_setStep(ScriptGUISliderV* nativeInstance, float step)
+	{
+		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
+		return slider->setStep(step);
+	}
+
+	void ScriptGUISliderV::internal_setTint(ScriptGUISliderV* nativeInstance, Color* color)
+	{
+		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
+		slider->setTint(*color);
+	}
+
+	void ScriptGUISliderV::onChanged(MonoObject* instance, float percent)
+	{
+		MonoUtil::invokeThunk(onChangedThunk, instance, percent);
+	}
 }

+ 2 - 2
SBansheeEngine/Source/BsScriptGUITexture.cpp

@@ -57,9 +57,9 @@ namespace BansheeEngine
 		guiTexture->setTexture(nativeTexture);
 	}
 
-	void ScriptGUITexture::internal_setTint(ScriptGUITexture* nativeInstance, Color color)
+	void ScriptGUITexture::internal_setTint(ScriptGUITexture* nativeInstance, Color* color)
 	{
 		GUITexture* guiTexture = (GUITexture*)nativeInstance->getGUIElement();
-		guiTexture->setTint(color);
+		guiTexture->setTint(*color);
 	}
 }

+ 2 - 2
SBansheeEngine/Source/BsScriptGUIToggle.cpp

@@ -100,10 +100,10 @@ namespace BansheeEngine
 			toggle->toggleOff();
 	}
 
-	void ScriptGUIToggle::internal_setTint(ScriptGUIToggle* nativeInstance, Color color)
+	void ScriptGUIToggle::internal_setTint(ScriptGUIToggle* nativeInstance, Color* color)
 	{
 		GUIToggle* toggle = (GUIToggle*)nativeInstance->getGUIElement();
-		toggle->setTint(color);
+		toggle->setTint(*color);
 	}
 
 	void ScriptGUIToggle::onClick(MonoObject* instance)

+ 0 - 1
TODO.txt

@@ -19,7 +19,6 @@ Optional:
   - There should be a CmdRecordSO equivalent for resources (probably)
   - Add commands for breaking or reverting a scene object 
   - Test & finalize undo/redo system
- - Crash when adding a new directional light and then shutting down (also crash when just deleting a directional light)
  - Test VS 2015 Community as code editor (possibly also move the code to VS 2015)
  - Drag and drop of a mesh into Hierarchy doesn't instantiate it
  - Drag and dropping a prefab onto the scene (or hierarchy) should work the same as with meshes