Browse Source

More Script work

Marko Pintera 12 years ago
parent
commit
48ec9be49d
35 changed files with 1272 additions and 50 deletions
  1. 10 0
      BansheeEngine/BansheeEngine.vcxproj
  2. 30 0
      BansheeEngine/BansheeEngine.vcxproj.filters
  3. 4 0
      BansheeEngine/Include/BsPrerequisites.h
  4. 4 2
      BansheeEngine/Include/BsScriptClass.h
  5. 27 0
      BansheeEngine/Include/BsScriptFont.h
  6. 36 0
      BansheeEngine/Include/BsScriptGUIElementStateStyle.h
  7. 109 0
      BansheeEngine/Include/BsScriptGUIElementStyle.h
  8. 4 1
      BansheeEngine/Include/BsScriptMethod.h
  9. 23 8
      BansheeEngine/Include/BsScriptObject.h
  10. 23 0
      BansheeEngine/Include/BsScriptProperty.h
  11. 25 0
      BansheeEngine/Include/BsScriptSpriteTexture.h
  12. 3 3
      BansheeEngine/Include/BsScriptTexture2D.h
  13. 21 1
      BansheeEngine/Source/BsScriptClass.cpp
  14. 1 1
      BansheeEngine/Source/BsScriptField.cpp
  15. 48 0
      BansheeEngine/Source/BsScriptFont.cpp
  16. 102 0
      BansheeEngine/Source/BsScriptGUIElementStateStyle.cpp
  17. 353 0
      BansheeEngine/Source/BsScriptGUIElementStyle.cpp
  18. 1 1
      BansheeEngine/Source/BsScriptGUIWidget.cpp
  19. 6 1
      BansheeEngine/Source/BsScriptMethod.cpp
  20. 27 0
      BansheeEngine/Source/BsScriptProperty.cpp
  21. 44 0
      BansheeEngine/Source/BsScriptSpriteTexture.cpp
  22. 10 10
      BansheeEngine/Source/BsScriptTexture2D.cpp
  23. 8 0
      CSharpWrap.txt
  24. 1 1
      CamelotClient/Source/BsScriptModalWindow.cpp
  25. 1 0
      MBansheeEditor/EditorApplication.cs
  26. 1 0
      MBansheeEditor/Program.cs
  27. 11 2
      MBansheeEngine/Font.cs
  28. 38 0
      MBansheeEngine/GUIElementStateStyle.cs
  29. 275 0
      MBansheeEngine/GUIElementStyle.cs
  30. 0 8
      MBansheeEngine/GUIWidget.cs
  31. 2 0
      MBansheeEngine/MBansheeEngine.csproj
  32. 4 1
      MBansheeEngine/Program.cs
  33. 9 0
      MBansheeEngine/ScriptObject.cs
  34. 11 2
      MBansheeEngine/SpriteTexture.cs
  35. 0 8
      MBansheeEngine/Texture2D.cs

+ 10 - 0
BansheeEngine/BansheeEngine.vcxproj

@@ -228,6 +228,9 @@
   <ItemGroup>
   <ItemGroup>
     <ClInclude Include="Include\BsApplication.h" />
     <ClInclude Include="Include\BsApplication.h" />
     <ClInclude Include="Include\BsScriptComponent.h" />
     <ClInclude Include="Include\BsScriptComponent.h" />
+    <ClInclude Include="Include\BsScriptFont.h" />
+    <ClInclude Include="Include\BsScriptGUIElementStateStyle.h" />
+    <ClInclude Include="Include\BsScriptGUIElementStyle.h" />
     <ClInclude Include="Include\BsScriptGUIWidget.h" />
     <ClInclude Include="Include\BsScriptGUIWidget.h" />
     <ClInclude Include="Include\BsDrawHelper3D.h" />
     <ClInclude Include="Include\BsDrawHelper3D.h" />
     <ClInclude Include="Include\BsDrawHelperTemplate.h" />
     <ClInclude Include="Include\BsDrawHelperTemplate.h" />
@@ -288,6 +291,8 @@
     <ClInclude Include="Include\BsScriptManager.h" />
     <ClInclude Include="Include\BsScriptManager.h" />
     <ClInclude Include="Include\BsScriptMethod.h" />
     <ClInclude Include="Include\BsScriptMethod.h" />
     <ClInclude Include="Include\BsScriptObject.h" />
     <ClInclude Include="Include\BsScriptObject.h" />
+    <ClInclude Include="Include\BsScriptProperty.h" />
+    <ClInclude Include="Include\BsScriptSpriteTexture.h" />
     <ClInclude Include="Include\BsScriptTexture2D.h" />
     <ClInclude Include="Include\BsScriptTexture2D.h" />
     <ClInclude Include="Include\BsSprite.h" />
     <ClInclude Include="Include\BsSprite.h" />
     <ClInclude Include="Include\BsSpriteTexture.h" />
     <ClInclude Include="Include\BsSpriteTexture.h" />
@@ -355,10 +360,15 @@
     <ClCompile Include="Source\BsScriptClass.cpp" />
     <ClCompile Include="Source\BsScriptClass.cpp" />
     <ClCompile Include="Source\BsScriptComponent.cpp" />
     <ClCompile Include="Source\BsScriptComponent.cpp" />
     <ClCompile Include="Source\BsScriptField.cpp" />
     <ClCompile Include="Source\BsScriptField.cpp" />
+    <ClCompile Include="Source\BsScriptFont.cpp" />
+    <ClCompile Include="Source\BsScriptGUIElementStateStyle.cpp" />
+    <ClCompile Include="Source\BsScriptGUIElementStyle.cpp" />
     <ClCompile Include="Source\BsScriptGUIWidget.cpp" />
     <ClCompile Include="Source\BsScriptGUIWidget.cpp" />
     <ClCompile Include="Source\BsScriptManager.cpp" />
     <ClCompile Include="Source\BsScriptManager.cpp" />
     <ClCompile Include="Source\BsScriptMethod.cpp" />
     <ClCompile Include="Source\BsScriptMethod.cpp" />
     <ClCompile Include="Source\BsScriptMeta.cpp" />
     <ClCompile Include="Source\BsScriptMeta.cpp" />
+    <ClCompile Include="Source\BsScriptProperty.cpp" />
+    <ClCompile Include="Source\BsScriptSpriteTexture.cpp" />
     <ClCompile Include="Source\BsScriptTexture2D.cpp" />
     <ClCompile Include="Source\BsScriptTexture2D.cpp" />
     <ClCompile Include="Source\BsSprite.cpp" />
     <ClCompile Include="Source\BsSprite.cpp" />
     <ClCompile Include="Source\BsSpriteTexture.cpp" />
     <ClCompile Include="Source\BsSpriteTexture.cpp" />

+ 30 - 0
BansheeEngine/BansheeEngine.vcxproj.filters

@@ -276,6 +276,21 @@
     <ClInclude Include="Include\BsScriptComponent.h">
     <ClInclude Include="Include\BsScriptComponent.h">
       <Filter>Header Files\Script</Filter>
       <Filter>Header Files\Script</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="Include\BsScriptProperty.h">
+      <Filter>Header Files\Script</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsScriptGUIElementStyle.h">
+      <Filter>Header Files\Script</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsScriptSpriteTexture.h">
+      <Filter>Header Files\Script</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsScriptFont.h">
+      <Filter>Header Files\Script</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsScriptGUIElementStateStyle.h">
+      <Filter>Header Files\Script</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsGUIElement.cpp">
     <ClCompile Include="Source\BsGUIElement.cpp">
@@ -485,5 +500,20 @@
     <ClCompile Include="Source\BsScriptComponent.cpp">
     <ClCompile Include="Source\BsScriptComponent.cpp">
       <Filter>Source Files\Script</Filter>
       <Filter>Source Files\Script</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="Source\BsScriptProperty.cpp">
+      <Filter>Source Files\Script</Filter>
+    </ClCompile>
+    <ClCompile Include="Source\BsScriptGUIElementStyle.cpp">
+      <Filter>Source Files\Script</Filter>
+    </ClCompile>
+    <ClCompile Include="Source\BsScriptFont.cpp">
+      <Filter>Source Files\Script</Filter>
+    </ClCompile>
+    <ClCompile Include="Source\BsScriptSpriteTexture.cpp">
+      <Filter>Source Files\Script</Filter>
+    </ClCompile>
+    <ClCompile Include="Source\BsScriptGUIElementStateStyle.cpp">
+      <Filter>Source Files\Script</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 4 - 0
BansheeEngine/Include/BsPrerequisites.h

@@ -69,6 +69,10 @@ namespace BansheeEngine
 	class ScriptClass;
 	class ScriptClass;
 	class ScriptMethod;
 	class ScriptMethod;
 	class ScriptField;
 	class ScriptField;
+	class ScriptProperty;
+	class ScriptFont;
+	class ScriptSpriteTexture;
+	class ScriptTexture2D;
 
 
 	// 2D
 	// 2D
 	class TextSprite;
 	class TextSprite;

+ 4 - 2
BansheeEngine/Include/BsScriptClass.h

@@ -29,8 +29,9 @@ namespace BansheeEngine
 		~ScriptClass();
 		~ScriptClass();
 
 
 		ScriptMethod& getMethod(const CM::String& name, CM::UINT32 numParams = 0);
 		ScriptMethod& getMethod(const CM::String& name, CM::UINT32 numParams = 0);
-		ScriptField& getField(const CM::String name);
-		
+		ScriptField& getField(const CM::String& name);
+		ScriptProperty& getProperty(const CM::String& name);
+
 		MonoObject* invokeMethod(const CM::String& name, MonoObject* instance = nullptr, void** params = nullptr, CM::UINT32 numParams = 0);
 		MonoObject* invokeMethod(const CM::String& name, MonoObject* instance = nullptr, void** params = nullptr, CM::UINT32 numParams = 0);
 		void addInternalCall(const CM::String& name, const void* method);
 		void addInternalCall(const CM::String& name, const void* method);
 
 
@@ -45,5 +46,6 @@ namespace BansheeEngine
 
 
 		CM::UnorderedMap<MethodId, ScriptMethod*, MethodId::Hash, MethodId::Equals>::type mMethods; 
 		CM::UnorderedMap<MethodId, ScriptMethod*, MethodId::Hash, MethodId::Equals>::type mMethods; 
 		CM::UnorderedMap<CM::String, ScriptField*>::type mFields; 
 		CM::UnorderedMap<CM::String, ScriptField*>::type mFields; 
+		CM::UnorderedMap<CM::String, ScriptProperty*>::type mProperties;
 	};
 	};
 }
 }

+ 27 - 0
BansheeEngine/Include/BsScriptFont.h

@@ -0,0 +1,27 @@
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsScriptObject.h"
+#include "CmFont.h"
+
+namespace BansheeEngine
+{
+	class BS_EXPORT ScriptFont : public ScriptObject<ScriptFont>
+	{
+	public:
+		static void initMetaData();
+
+		virtual void* getNative() const;
+		const CM::HFont& getInternalFont() const { return mFont; }
+
+	private:
+		static void internal_createInstanceExternal(MonoObject* instance, const CM::HFont& font);
+		static void internal_destroyInstance(ScriptFont* nativeInstance);
+
+		static void initRuntimeData();
+
+		ScriptFont(const CM::HFont& font);
+
+		CM::HFont mFont;
+	};
+}

+ 36 - 0
BansheeEngine/Include/BsScriptGUIElementStateStyle.h

@@ -0,0 +1,36 @@
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsGUIElementStyle.h"
+
+namespace BansheeEngine
+{
+	class BS_EXPORT ScriptGUIElementStateStyle : public ScriptObject<ScriptGUIElementStateStyle>
+	{
+	public:
+		~ScriptGUIElementStateStyle();
+
+		static void initMetaData();
+
+	private:
+		static void internal_createInstance(MonoObject* instance);
+		static void internal_createInstanceExternal(MonoObject* instance, GUIElementStyle::GUIElementStateStyle* externalStateStyle);
+		static void internal_destroyInstance(ScriptGUIElementStateStyle* nativeInstance);
+
+		static void initRuntimeData();
+
+		static void internal_GetTexture(ScriptGUIElementStateStyle* nativeInstance, MonoObject* value);
+		static void internal_SetTexture(ScriptGUIElementStateStyle* nativeInstance, ScriptSpriteTexture* value);
+
+		static void internal_GetTextColor(ScriptGUIElementStateStyle* nativeInstance, CM::Color* value);
+		static void internal_SetTextColor(ScriptGUIElementStateStyle* nativeInstance, CM::Color* value);
+
+		ScriptGUIElementStateStyle();
+		ScriptGUIElementStateStyle(GUIElementStyle::GUIElementStateStyle* externalStyle);
+
+		GUIElementStyle::GUIElementStateStyle* mElementStateStyle;
+		ScriptSpriteTexture* mSpriteTexture;
+		bool mOwnsStyle;
+	};
+}

+ 109 - 0
BansheeEngine/Include/BsScriptGUIElementStyle.h

@@ -0,0 +1,109 @@
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsScriptObject.h"
+
+namespace BansheeEngine
+{
+	class BS_EXPORT ScriptGUIElementStyle : public ScriptObject<ScriptGUIElementStyle>
+	{
+	public:
+		~ScriptGUIElementStyle();
+
+		static void initMetaData();
+
+	private:
+		static void internal_createInstance(MonoObject* instance, MonoString* name);
+		static void internal_createInstanceExternal(MonoObject* instance, MonoString* name, GUIElementStyle* externalStyle);
+		static void internal_destroyInstance(ScriptGUIElementStyle* nativeInstance);
+
+		static void initRuntimeData();
+
+		/*static MonoObject* internal_GetFont(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetFont(ScriptGUIElementStyle* nativeInstance, ScriptFont* value);
+
+		static int internal_GetFontSize(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetFontSize(ScriptGUIElementStyle* nativeInstance, int value);
+
+		static int internal_GetTextHorzAlign(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetTextHorzAlign(ScriptGUIElementStyle* nativeInstance, int value);
+
+		static int internal_GetTextVertAlign(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetTextVertAlign(ScriptGUIElementStyle* nativeInstance, int value);
+
+		static int internal_GetImagePosition(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetImagePosition(ScriptGUIElementStyle* nativeInstance, int value);
+
+		static bool internal_GetWordWrap(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetWordWrap(ScriptGUIElementStyle* nativeInstance, bool value);
+
+
+		static MonoObject* internal_GetNormal(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetNormal(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
+
+		static MonoObject* internal_GetHover(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetHover(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
+
+		static MonoObject* internal_GetActive(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetActive(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
+
+		static MonoObject* internal_GetFocused(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetFocused(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
+
+
+		static MonoObject* internal_GetNormalOn(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetNormalOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
+
+		static MonoObject* internal_GetHoverOn(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetHoverOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
+
+		static MonoObject* internal_GetActiveOn(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetActiveOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
+
+		static MonoObject* internal_GetFocusedOn(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetFocusedOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
+
+
+		static RectOffset internal_GetBorder(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset value);
+
+		static RectOffset internal_GetMargins(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset value);
+
+		static RectOffset internal_GetContentOffset(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset value);
+
+
+		static INT32 internal_GetWidth(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetWidth(ScriptGUIElementStyle* nativeInstance, INT32 value);
+
+		static INT32 internal_GetHeight(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetHeight(ScriptGUIElementStyle* nativeInstance, INT32 value);
+
+		static INT32 internal_GetMinWidth(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetMinWidth(ScriptGUIElementStyle* nativeInstance, INT32 value);
+
+		static INT32 internal_GetMaxWidth(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetMaxWidth(ScriptGUIElementStyle* nativeInstance, INT32 value);
+
+		static INT32 internal_GetMinHeight(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetMinHeight(ScriptGUIElementStyle* nativeInstance, INT32 value);
+
+		static INT32 internal_GetMaxHeight(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetMaxHeight(ScriptGUIElementStyle* nativeInstance, INT32 value);
+
+		static bool internal_GetFixedWidth(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetFixedWidth(ScriptGUIElementStyle* nativeInstance, bool value);
+
+		static bool internal_GetFixedHeight(ScriptGUIElementStyle* nativeInstance);
+		static void internal_SetFixedHeight(ScriptGUIElementStyle* nativeInstance, bool value);*/
+
+		ScriptGUIElementStyle(const CM::String& name);
+		ScriptGUIElementStyle(const CM::String& name, GUIElementStyle* externalStyle);
+
+		CM::String mName;
+		GUIElementStyle* mElementStyle;
+		ScriptFont* mFont;
+		bool mOwnsStyle;
+	};
+}

+ 4 - 1
BansheeEngine/Include/BsScriptMethod.h

@@ -16,10 +16,13 @@ namespace BansheeEngine
 		 *
 		 *
 		 * @note	This is the fastest way of calling managed code.
 		 * @note	This is the fastest way of calling managed code.
 		 */
 		 */
-		void* getThunk();
+		void* getThunk() const;
+
+		CM::String getName() const;
 
 
 	private:
 	private:
 		friend class ScriptClass;
 		friend class ScriptClass;
+		friend class ScriptProperty;
 
 
 		ScriptMethod(MonoMethod* method);
 		ScriptMethod(MonoMethod* method);
 
 

+ 23 - 8
BansheeEngine/Include/BsScriptObject.h

@@ -27,7 +27,7 @@ namespace BansheeEngine
 	{
 	{
 	public:
 	public:
 		ScriptObject()
 		ScriptObject()
-			:mInstanceCreated(false)
+			:mManagedInstance(nullptr)
 		{	
 		{	
 			// Compiler will only generate code for stuff that is directly used, including static data members,
 			// Compiler will only generate code for stuff that is directly used, including static data members,
 			// so we fool it here like we're using the class directly. Otherwise compiler won't generate the code for the member
 			// so we fool it here like we're using the class directly. Otherwise compiler won't generate the code for the member
@@ -37,29 +37,44 @@ namespace BansheeEngine
 
 
 		virtual ~ScriptObject() 
 		virtual ~ScriptObject() 
 		{
 		{
-			if(mInstanceCreated)
+			if(mManagedInstance != nullptr)
 				CM_EXCEPT(InvalidStateException, "Script object is being destroyed without its instance previously being released.");
 				CM_EXCEPT(InvalidStateException, "Script object is being destroyed without its instance previously being released.");
 		}
 		}
 
 
+		MonoObject* getManagedInstance() const { return mManagedInstance; }
+		virtual void* getNative() const { return nullptr; }
+
 	protected:
 	protected:
 		static ScriptMeta metaData;
 		static ScriptMeta metaData;
 
 
-		bool mInstanceCreated;
+		MonoObject* mManagedInstance;
 
 
-		void createInstance()
+		void createInstance(MonoObject* instance)
 		{
 		{
-			if(mInstanceCreated)
+			if(mManagedInstance != nullptr)
 				CM_EXCEPT(InvalidStateException, "Trying to instantiate an already instantiated script object.");
 				CM_EXCEPT(InvalidStateException, "Trying to instantiate an already instantiated script object.");
 
 
-			mInstanceCreated = true;
+			mManagedInstance = instance;
 		}
 		}
 
 
 		void destroyInstance()
 		void destroyInstance()
 		{
 		{
-			if(!mInstanceCreated)
+			if(mManagedInstance == nullptr)
 				return;
 				return;
 
 
-			mInstanceCreated = false;
+			mManagedInstance = nullptr;
+		}
+
+		template <class Type2>
+		static void throwIfInstancesDontMatch(ScriptObject<Type2>* lhs, void* rhs)
+		{
+#if CM_DEBUG_MODE
+			if((lhs == nullptr && rhs != nullptr) || (rhs == nullptr && lhs != nullptr) || lhs->getNative() != rhs)
+			{
+				CM_EXCEPT(InvalidStateException, "Native and script instance do not match. This usually happens when you modify a native object " \
+					" that is also being referenced from script code. You should only modify such objects directly from script code.");
+			}
+#endif
 		}
 		}
 
 
 	private:
 	private:

+ 23 - 0
BansheeEngine/Include/BsScriptProperty.h

@@ -0,0 +1,23 @@
+#pragma once
+
+#include "BsPrerequisites.h"
+#include <mono/jit/jit.h>
+
+namespace BansheeEngine
+{
+	class BS_EXPORT ScriptProperty
+	{
+	public:
+		MonoObject* get(MonoObject* instance) const;
+		void set(MonoObject* instance, MonoObject* value) const;
+
+	private:
+		friend class ScriptClass;
+
+		ScriptProperty(MonoProperty* monoProp);
+
+		MonoProperty* mProperty;
+		MonoMethod* mGetMethod;
+		MonoMethod* mSetMethod;
+	};
+}

+ 25 - 0
BansheeEngine/Include/BsScriptSpriteTexture.h

@@ -0,0 +1,25 @@
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsScriptObject.h"
+
+namespace BansheeEngine
+{
+	class BS_EXPORT ScriptSpriteTexture : public ScriptObject<ScriptSpriteTexture>
+	{
+	public:
+		static void initMetaData();
+
+		const SpriteTexturePtr& getInternalTexture() const { return mTexture; }
+
+	private:
+		static void internal_createInstance(MonoObject* instance);
+		static void internal_destroyInstance(ScriptSpriteTexture* nativeInstance);
+
+		static void initRuntimeData();
+
+		ScriptSpriteTexture(const SpriteTexturePtr& texture);
+
+		SpriteTexturePtr mTexture;
+	};
+}

+ 3 - 3
BansheeEngine/Include/BsScriptTexture2D.h

@@ -6,18 +6,18 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	class BS_EXPORT ScriptTexture : public ScriptObject<ScriptTexture>
+	class BS_EXPORT ScriptTexture2D : public ScriptObject<ScriptTexture2D>
 	{
 	{
 	public:
 	public:
 		static void initMetaData();
 		static void initMetaData();
 
 
 	private:
 	private:
 		static void internal_createInstance(MonoObject* instance, CM::UINT32 format, CM::UINT32 width, CM::UINT32 height, bool hasMipmaps, bool gammaCorrection);
 		static void internal_createInstance(MonoObject* instance, CM::UINT32 format, CM::UINT32 width, CM::UINT32 height, bool hasMipmaps, bool gammaCorrection);
-		static void internal_destroyInstance(ScriptTexture* nativeInstance);
+		static void internal_destroyInstance(ScriptTexture2D* nativeInstance);
 
 
 		static void initRuntimeData();
 		static void initRuntimeData();
 
 
-		ScriptTexture(const CM::HTexture& texture);
+		ScriptTexture2D(const CM::HTexture& texture);
 
 
 		CM::HTexture mTexture;
 		CM::HTexture mTexture;
 	};
 	};

+ 21 - 1
BansheeEngine/Source/BsScriptClass.cpp

@@ -1,6 +1,7 @@
 #include "BsScriptClass.h"
 #include "BsScriptClass.h"
 #include "BsScriptMethod.h"
 #include "BsScriptMethod.h"
 #include "BsScriptField.h"
 #include "BsScriptField.h"
+#include "BsScriptProperty.h"
 #include "BsScriptManager.h"
 #include "BsScriptManager.h"
 #include "CmUtil.h"
 #include "CmUtil.h"
 #include "CmException.h"
 #include "CmException.h"
@@ -71,7 +72,7 @@ namespace BansheeEngine
 		return *newMethod;
 		return *newMethod;
 	}
 	}
 
 
-	ScriptField& ScriptClass::getField(const String name)
+	ScriptField& ScriptClass::getField(const String& name)
 	{
 	{
 		auto iterFind = mFields.find(name);
 		auto iterFind = mFields.find(name);
 		if(iterFind != mFields.end())
 		if(iterFind != mFields.end())
@@ -90,6 +91,25 @@ namespace BansheeEngine
 		return *newField;
 		return *newField;
 	}
 	}
 
 
+	ScriptProperty& ScriptClass::getProperty(const String& name)
+	{
+		auto iterFind = mProperties.find(name);
+		if(iterFind != mProperties.end())
+			return *iterFind->second;
+
+		MonoProperty* property = mono_class_get_property_from_name(mClass, name.c_str());
+		if(property == nullptr)
+		{
+			String fullPropertyName = mFullName + "::" + name;
+			CM_EXCEPT(InvalidParametersException, "Cannot get Mono property: " + fullPropertyName);
+		}
+
+		ScriptProperty* newProperty = new (cm_alloc<ScriptProperty>()) ScriptProperty(property);
+		mProperties[name] = newProperty;
+
+		return *newProperty;
+	}
+
 	MonoObject* ScriptClass::invokeMethod(const String& name, MonoObject* instance, void** params, UINT32 numParams)
 	MonoObject* ScriptClass::invokeMethod(const String& name, MonoObject* instance, void** params, UINT32 numParams)
 	{
 	{
 		return getMethod(name, numParams).invoke(instance, params);
 		return getMethod(name, numParams).invoke(instance, params);

+ 1 - 1
BansheeEngine/Source/BsScriptField.cpp

@@ -12,7 +12,7 @@ namespace BansheeEngine
 
 
 	void* ScriptField::getValue(MonoObject* instance)
 	void* ScriptField::getValue(MonoObject* instance)
 	{
 	{
-		void* value;
+		void* value = nullptr;
 		mono_field_get_value(instance, mField, value);
 		mono_field_get_value(instance, mField, value);
 		return value;
 		return value;
 	}
 	}

+ 48 - 0
BansheeEngine/Source/BsScriptFont.cpp

@@ -0,0 +1,48 @@
+#include "BsScriptFont.h"
+#include "BsScriptMeta.h"
+#include "BsScriptField.h"
+#include "BsScriptClass.h"
+#include "BsScriptManager.h"
+#include "BsSpriteTexture.h"
+
+using namespace CamelotFramework;
+
+namespace BansheeEngine
+{
+	ScriptFont::ScriptFont(const CM::HFont& font)
+		:mFont(font)
+	{
+
+	}
+
+	void ScriptFont::initMetaData()
+	{
+		metaData = ScriptMeta("MBansheeEngine", "BansheeEngine", "Font", &ScriptFont::initRuntimeData);
+
+		ScriptManager::registerScriptType(&metaData);
+	}
+
+	void* ScriptFont::getNative() const
+	{
+		return (void*)mFont.get();
+	}
+
+	void ScriptFont::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_DestroyInstance", &ScriptFont::internal_destroyInstance);
+	}
+
+	void ScriptFont::internal_createInstanceExternal(MonoObject* instance, const CM::HFont& font)
+	{
+		ScriptFont* nativeInstance = new (cm_alloc<ScriptFont>()) ScriptFont(font);
+		nativeInstance->createInstance(instance);
+
+		metaData.thisPtrField->setValue(instance, nativeInstance);
+	}
+
+	void ScriptFont::internal_destroyInstance(ScriptFont* nativeInstance)
+	{
+		nativeInstance->destroyInstance();
+		cm_delete(nativeInstance);
+	}
+}

+ 102 - 0
BansheeEngine/Source/BsScriptGUIElementStateStyle.cpp

@@ -0,0 +1,102 @@
+#include "BsScriptGUIElementStateStyle.h"
+#include "BsScriptMeta.h"
+#include "BsScriptField.h"
+#include "BsScriptClass.h"
+#include "BsScriptManager.h"
+#include "BsScriptSpriteTexture.h"
+#include "CmException.h"
+#include "BsGUIElementStyle.h"
+
+using namespace CamelotFramework;
+
+namespace BansheeEngine
+{
+	ScriptGUIElementStateStyle::ScriptGUIElementStateStyle()
+		:mElementStateStyle(cm_new<GUIElementStyle::GUIElementStateStyle>()), mSpriteTexture(nullptr), mOwnsStyle(true)
+	{
+
+	}
+
+	ScriptGUIElementStateStyle::ScriptGUIElementStateStyle(GUIElementStyle::GUIElementStateStyle* externalStyle)
+		: mElementStateStyle(externalStyle), mSpriteTexture(nullptr), mOwnsStyle(false)
+	{
+
+	}
+
+	ScriptGUIElementStateStyle::~ScriptGUIElementStateStyle()
+	{
+		if(mOwnsStyle)
+			cm_delete(mElementStateStyle);
+	}
+
+	void ScriptGUIElementStateStyle::initMetaData()
+	{
+		metaData = ScriptMeta("MBansheeEngine", "BansheeEngine", "GUIElementStateStyle", &ScriptGUIElementStateStyle::initRuntimeData);
+
+		ScriptManager::registerScriptType(&metaData);
+	}
+
+	void ScriptGUIElementStateStyle::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIElementStateStyle::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_DestroyInstance", &ScriptGUIElementStateStyle::internal_destroyInstance);
+
+		metaData.scriptClass->addInternalCall("Internal_GetTexture", &ScriptGUIElementStateStyle::internal_GetTexture);
+		metaData.scriptClass->addInternalCall("Internal_SetTexture", &ScriptGUIElementStateStyle::internal_SetTexture);
+
+		metaData.scriptClass->addInternalCall("Internal_GetTextColor", &ScriptGUIElementStateStyle::internal_GetTextColor);
+		metaData.scriptClass->addInternalCall("Internal_SetTextColor", &ScriptGUIElementStateStyle::internal_SetTextColor);
+	}
+
+	void ScriptGUIElementStateStyle::internal_createInstance(MonoObject* instance)
+	{
+		ScriptGUIElementStateStyle* nativeInstance = new (cm_alloc<ScriptGUIElementStateStyle>()) ScriptGUIElementStateStyle();
+		nativeInstance->createInstance(instance);
+
+		metaData.thisPtrField->setValue(instance, nativeInstance);
+	}
+
+	void ScriptGUIElementStateStyle::internal_createInstanceExternal(MonoObject* instance, GUIElementStyle::GUIElementStateStyle* externalStyle)
+	{
+		ScriptGUIElementStateStyle* nativeInstance = new (cm_alloc<ScriptGUIElementStateStyle>()) ScriptGUIElementStateStyle(externalStyle);
+		nativeInstance->createInstance(instance);
+
+		metaData.thisPtrField->setValue(instance, nativeInstance);
+	}
+
+	void ScriptGUIElementStateStyle::internal_destroyInstance(ScriptGUIElementStateStyle* nativeInstance)
+	{
+		nativeInstance->destroyInstance();
+		cm_delete(nativeInstance);
+	}
+
+	void ScriptGUIElementStateStyle::internal_GetTexture(ScriptGUIElementStateStyle* nativeInstance, MonoObject* value)
+	{
+		throwIfInstancesDontMatch(nativeInstance->mSpriteTexture, nativeInstance->mElementStateStyle->texture.get());
+
+		if(nativeInstance->mSpriteTexture != nullptr)
+		{
+			value = nativeInstance->mSpriteTexture->getManagedInstance();
+			return;
+		}
+
+		value = nullptr;
+		return;
+	}
+
+	void ScriptGUIElementStateStyle::internal_SetTexture(ScriptGUIElementStateStyle* nativeInstance, ScriptSpriteTexture* value)
+	{
+		nativeInstance->mElementStateStyle->texture = value->getInternalTexture();
+	}
+
+
+	void ScriptGUIElementStateStyle::internal_GetTextColor(ScriptGUIElementStateStyle* nativeInstance, Color* value)
+	{
+		value = &nativeInstance->mElementStateStyle->textColor;
+	}
+
+	void ScriptGUIElementStateStyle::internal_SetTextColor(ScriptGUIElementStateStyle* nativeInstance, Color* value)
+	{
+		nativeInstance->mElementStateStyle->textColor = *value;
+	}
+}

+ 353 - 0
BansheeEngine/Source/BsScriptGUIElementStyle.cpp

@@ -0,0 +1,353 @@
+#include "BsScriptGUIElementStyle.h"
+#include "BsScriptMeta.h"
+#include "BsScriptField.h"
+#include "BsScriptClass.h"
+#include "BsScriptManager.h"
+#include "BsScriptFont.h"
+#include "CmException.h"
+#include "BsGUIElementStyle.h"
+
+using namespace CamelotFramework;
+
+namespace BansheeEngine
+{
+	ScriptGUIElementStyle::ScriptGUIElementStyle(const String& name)
+		:mName(name), mElementStyle(cm_new<GUIElementStyle>()), mFont(nullptr), mOwnsStyle(true)
+	{
+
+	}
+
+	ScriptGUIElementStyle::ScriptGUIElementStyle(const String& name, GUIElementStyle* externalStyle)
+		:mName(name), mElementStyle(externalStyle), mFont(nullptr), mOwnsStyle(false)
+	{
+
+	}
+
+	ScriptGUIElementStyle::~ScriptGUIElementStyle()
+	{
+		if(mOwnsStyle)
+			cm_delete(mElementStyle);
+	}
+
+	void ScriptGUIElementStyle::initMetaData()
+	{
+		metaData = ScriptMeta("MBansheeEngine", "BansheeEngine", "GUIElementStyle", &ScriptGUIElementStyle::initRuntimeData);
+
+		ScriptManager::registerScriptType(&metaData);
+	}
+
+	void ScriptGUIElementStyle::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIElementStyle::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_DestroyInstance", &ScriptGUIElementStyle::internal_destroyInstance);
+	}
+
+	void ScriptGUIElementStyle::internal_createInstance(MonoObject* instance, MonoString* name)
+	{
+		char* nativeName = mono_string_to_utf8(name);
+		String styleName(nativeName);
+		free(nativeName);
+
+		ScriptGUIElementStyle* nativeInstance = new (cm_alloc<ScriptGUIElementStyle>()) ScriptGUIElementStyle(styleName);
+		nativeInstance->createInstance(instance);
+
+		metaData.thisPtrField->setValue(instance, nativeInstance);
+	}
+
+	void ScriptGUIElementStyle::internal_createInstanceExternal(MonoObject* instance, MonoString* name, GUIElementStyle* externalStyle)
+	{
+		char* nativeName = mono_string_to_utf8(name);
+		String styleName(nativeName);
+		free(nativeName);
+
+		ScriptGUIElementStyle* nativeInstance = new (cm_alloc<ScriptGUIElementStyle>()) ScriptGUIElementStyle(styleName, externalStyle);
+		nativeInstance->createInstance(instance);
+
+		metaData.thisPtrField->setValue(instance, nativeInstance);
+	}
+
+	void ScriptGUIElementStyle::internal_destroyInstance(ScriptGUIElementStyle* nativeInstance)
+	{
+		nativeInstance->destroyInstance();
+		cm_delete(nativeInstance);
+	}
+
+	/*MonoObject* ScriptGUIElementStyle::internal_GetFont(ScriptGUIElementStyle* nativeInstance)
+	{
+		throwIfInstancesDontMatch(nativeInstance->mFont, nativeInstance->mElementStyle->font.get());
+
+		if(nativeInstance->mFont != nullptr)
+			return nativeInstance->mFont->getManagedInstance();
+
+		return nullptr;
+	}
+
+	void ScriptGUIElementStyle::internal_SetFont(ScriptGUIElementStyle* nativeInstance, ScriptFont* value)
+	{
+		nativeInstance->mElementStyle->font = value->getInternalFont();
+	}
+
+
+	int ScriptGUIElementStyle::internal_GetFontSize(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetFontSize(ScriptGUIElementStyle* nativeInstance, int value)
+	{
+
+	}
+
+
+	int ScriptGUIElementStyle::internal_GetTextHorzAlign(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetTextHorzAlign(ScriptGUIElementStyle* nativeInstance, int value)
+	{
+
+	}
+
+
+	int ScriptGUIElementStyle::internal_GetTextVertAlign(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetTextVertAlign(ScriptGUIElementStyle* nativeInstance, int value)
+	{
+
+	}
+
+
+	int ScriptGUIElementStyle::internal_GetImagePosition(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetImagePosition(ScriptGUIElementStyle* nativeInstance, int value)
+	{
+
+	}
+
+
+	bool ScriptGUIElementStyle::internal_GetWordWrap(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetWordWrap(ScriptGUIElementStyle* nativeInstance, bool value)
+	{
+
+	}
+
+
+	MonoObject* ScriptGUIElementStyle::internal_GetNormal(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetNormal(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
+	{
+
+	}
+
+
+	MonoObject* ScriptGUIElementStyle::internal_GetHover(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetHover(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
+	{
+
+	}
+
+
+	MonoObject* ScriptGUIElementStyle::internal_GetActive(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetActive(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
+	{
+
+	}
+
+
+	MonoObject* ScriptGUIElementStyle::internal_GetFocused(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetFocused(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
+	{
+
+	}
+
+
+	MonoObject* ScriptGUIElementStyle::internal_GetNormalOn(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetNormalOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
+	{
+
+	}
+
+
+	MonoObject* ScriptGUIElementStyle::internal_GetHoverOn(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetHoverOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
+	{
+
+	}
+
+
+	MonoObject* ScriptGUIElementStyle::internal_GetActiveOn(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetActiveOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
+	{
+
+	}
+
+
+	MonoObject* ScriptGUIElementStyle::internal_GetFocusedOn(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetFocusedOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
+	{
+
+	}
+
+
+	RectOffset ScriptGUIElementStyle::internal_GetBorder(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset value)
+	{
+
+	}
+
+
+	RectOffset ScriptGUIElementStyle::internal_GetMargins(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset value)
+	{
+
+	}
+
+
+	RectOffset ScriptGUIElementStyle::internal_GetContentOffset(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset value)
+	{
+
+	}
+
+
+	INT32 ScriptGUIElementStyle::internal_GetWidth(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetWidth(ScriptGUIElementStyle* nativeInstance, INT32 value)
+	{
+
+	}
+
+
+	INT32 ScriptGUIElementStyle::internal_GetHeight(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetHeight(ScriptGUIElementStyle* nativeInstance, INT32 value)
+	{
+
+	}
+
+
+	INT32 ScriptGUIElementStyle::internal_GetMinWidth(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetMinWidth(ScriptGUIElementStyle* nativeInstance, INT32 value)
+	{
+
+	}
+
+
+	INT32 ScriptGUIElementStyle::internal_GetMaxWidth(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetMaxWidth(ScriptGUIElementStyle* nativeInstance, INT32 value)
+	{
+
+	}
+
+
+	INT32 ScriptGUIElementStyle::internal_GetMinHeight(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetMinHeight(ScriptGUIElementStyle* nativeInstance, INT32 value)
+	{
+
+	}
+
+
+	INT32 ScriptGUIElementStyle::internal_GetMaxHeight(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetMaxHeight(ScriptGUIElementStyle* nativeInstance, INT32 value)
+	{
+
+	}
+
+
+	bool ScriptGUIElementStyle::internal_GetFixedWidth(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetFixedWidth(ScriptGUIElementStyle* nativeInstance, bool value)
+	{
+
+	}
+
+
+	bool ScriptGUIElementStyle::internal_GetFixedHeight(ScriptGUIElementStyle* nativeInstance)
+	{
+
+	}
+
+	void ScriptGUIElementStyle::internal_SetFixedHeight(ScriptGUIElementStyle* nativeInstance, bool value)
+	{
+
+	}*/
+}

+ 1 - 1
BansheeEngine/Source/BsScriptGUIWidget.cpp

@@ -37,7 +37,7 @@ namespace BansheeEngine
 		sceneObject->addComponent<ScriptComponent>(instance);
 		sceneObject->addComponent<ScriptComponent>(instance);
 
 
 		ScriptGUIWidget* nativeInstance = new (cm_alloc<ScriptGUIWidget>()) ScriptGUIWidget(widget);
 		ScriptGUIWidget* nativeInstance = new (cm_alloc<ScriptGUIWidget>()) ScriptGUIWidget(widget);
-		nativeInstance->createInstance();
+		nativeInstance->createInstance(instance);
 
 
 		metaData.thisPtrField->setValue(instance, nativeInstance);
 		metaData.thisPtrField->setValue(instance, nativeInstance);
 	}
 	}

+ 6 - 1
BansheeEngine/Source/BsScriptMethod.cpp

@@ -16,8 +16,13 @@ namespace BansheeEngine
 		return mono_runtime_invoke(mMethod, instance, params, nullptr);
 		return mono_runtime_invoke(mMethod, instance, params, nullptr);
 	}		
 	}		
 
 
-	void* ScriptMethod::getThunk()
+	void* ScriptMethod::getThunk() const
 	{
 	{
 		return mThunk;
 		return mThunk;
 	}
 	}
+
+	String ScriptMethod::getName() const
+	{
+		return String(mono_method_get_name(mMethod));
+	}
 }
 }

+ 27 - 0
BansheeEngine/Source/BsScriptProperty.cpp

@@ -0,0 +1,27 @@
+#include "BsScriptProperty.h"
+#include "BsScriptObject.h"
+#include "BsScriptMethod.h"
+
+using namespace CamelotFramework;
+
+namespace BansheeEngine
+{
+	ScriptProperty::ScriptProperty(MonoProperty* monoProp)
+		:mProperty(monoProp)
+	{
+		mGetMethod = mono_property_get_get_method(mProperty);
+		mSetMethod = mono_property_get_set_method(mProperty);
+	}
+
+	MonoObject* ScriptProperty::get(MonoObject* instance) const
+	{
+		return mono_runtime_invoke(mGetMethod, instance, nullptr, nullptr);
+	}
+
+	void ScriptProperty::set(MonoObject* instance, MonoObject* value) const
+	{
+		void* args[1];
+		args[0] = value;
+		mono_runtime_invoke(mSetMethod, instance, args, nullptr);
+	}	
+}

+ 44 - 0
BansheeEngine/Source/BsScriptSpriteTexture.cpp

@@ -0,0 +1,44 @@
+#include "BsScriptSpriteTexture.h"
+#include "BsScriptMeta.h"
+#include "BsScriptField.h"
+#include "BsScriptClass.h"
+#include "BsScriptManager.h"
+#include "BsSpriteTexture.h"
+
+using namespace CamelotFramework;
+
+namespace BansheeEngine
+{
+	ScriptSpriteTexture::ScriptSpriteTexture(const SpriteTexturePtr& texture)
+		:mTexture(texture)
+	{
+
+	}
+
+	void ScriptSpriteTexture::initMetaData()
+	{
+		metaData = ScriptMeta("MBansheeEngine", "BansheeEngine", "SpriteTexture", &ScriptSpriteTexture::initRuntimeData);
+
+		ScriptManager::registerScriptType(&metaData);
+	}
+
+	void ScriptSpriteTexture::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptSpriteTexture::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_DestroyInstance", &ScriptSpriteTexture::internal_destroyInstance);
+	}
+
+	void ScriptSpriteTexture::internal_createInstance(MonoObject* instance)
+	{
+		ScriptSpriteTexture* nativeInstance = new (cm_alloc<ScriptSpriteTexture>()) ScriptSpriteTexture(nullptr); // TODO - DUMMY CODE!
+		nativeInstance->createInstance(instance);
+
+		metaData.thisPtrField->setValue(instance, nativeInstance);
+	}
+
+	void ScriptSpriteTexture::internal_destroyInstance(ScriptSpriteTexture* nativeInstance)
+	{
+		nativeInstance->destroyInstance();
+		cm_delete(nativeInstance);
+	}
+}

+ 10 - 10
BansheeEngine/Source/BsScriptTexture2D.cpp

@@ -11,26 +11,26 @@ using namespace CamelotFramework;
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	ScriptTexture::ScriptTexture(const CM::HTexture& texture)
+	ScriptTexture2D::ScriptTexture2D(const CM::HTexture& texture)
 		:mTexture(texture)
 		:mTexture(texture)
 	{
 	{
 
 
 	}
 	}
 
 
-	void ScriptTexture::initMetaData()
+	void ScriptTexture2D::initMetaData()
 	{
 	{
-		metaData = ScriptMeta("MBansheeEngine", "BansheeEngine", "Texture2D", &ScriptTexture::initRuntimeData);
+		metaData = ScriptMeta("MBansheeEngine", "BansheeEngine", "Texture2D", &ScriptTexture2D::initRuntimeData);
 
 
 		ScriptManager::registerScriptType(&metaData);
 		ScriptManager::registerScriptType(&metaData);
 	}
 	}
 
 
-	void ScriptTexture::initRuntimeData()
+	void ScriptTexture2D::initRuntimeData()
 	{
 	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptTexture::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_DestroyInstance", &ScriptTexture::internal_destroyInstance);
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptTexture2D::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_DestroyInstance", &ScriptTexture2D::internal_destroyInstance);
 	}
 	}
 
 
-	void ScriptTexture::internal_createInstance(MonoObject* instance, CM::UINT32 format, CM::UINT32 width, CM::UINT32 height, bool hasMipmaps, bool gammaCorrection)
+	void ScriptTexture2D::internal_createInstance(MonoObject* instance, CM::UINT32 format, CM::UINT32 width, CM::UINT32 height, bool hasMipmaps, bool gammaCorrection)
 	{
 	{
 		PixelFormat texFormat = PF_R8G8B8;
 		PixelFormat texFormat = PF_R8G8B8;
 		switch(format)
 		switch(format)
@@ -51,13 +51,13 @@ namespace BansheeEngine
 
 
 		HTexture texture = Texture::create(TEX_TYPE_2D, width, height, numMips, texFormat, TU_STATIC, gammaCorrection);
 		HTexture texture = Texture::create(TEX_TYPE_2D, width, height, numMips, texFormat, TU_STATIC, gammaCorrection);
 
 
-		ScriptTexture* nativeInstance = new (cm_alloc<ScriptTexture>()) ScriptTexture(texture);
-		nativeInstance->createInstance();
+		ScriptTexture2D* nativeInstance = new (cm_alloc<ScriptTexture2D>()) ScriptTexture2D(texture);
+		nativeInstance->createInstance(instance);
 
 
 		metaData.thisPtrField->setValue(instance, nativeInstance);
 		metaData.thisPtrField->setValue(instance, nativeInstance);
 	}
 	}
 
 
-	void ScriptTexture::internal_destroyInstance(ScriptTexture* nativeInstance)
+	void ScriptTexture2D::internal_destroyInstance(ScriptTexture2D* nativeInstance)
 	{
 	{
 		nativeInstance->destroyInstance();
 		nativeInstance->destroyInstance();
 		cm_delete(nativeInstance);
 		cm_delete(nativeInstance);

+ 8 - 0
CSharpWrap.txt

@@ -139,6 +139,14 @@ When loading resources I need to be able to load both project resources and engi
  - They're all loaded from a special folder that is set in EditorApplication
  - They're all loaded from a special folder that is set in EditorApplication
 
 
 
 
+IMMEDIATE TODO:
+ - Finish up ScriptGUIElementstyle.cpp
+ - Add ScriptGUIElementStateStyle
+
+Should I make sprite texture a resource?
+ - Quite probably, and will need to replace any Ptr references with handle references. I want the user
+   to be able to reference the resource in multiple locations and then he can easily edit the SpriteTexture as needed.
+
  BsApplication::getPrimaryViewport is not implemented
  BsApplication::getPrimaryViewport is not implemented
 
 
 ----------------------------
 ----------------------------

+ 1 - 1
CamelotClient/Source/BsScriptModalWindow.cpp

@@ -56,7 +56,7 @@ namespace BansheeEditor
 	void ScriptModalWindow::internal_createInstance(MonoObject* instance, INT32 left, INT32 top, UINT32 width, UINT32 height)
 	void ScriptModalWindow::internal_createInstance(MonoObject* instance, INT32 left, INT32 top, UINT32 width, UINT32 height)
 	{
 	{
 		ScriptModalWindow* nativeInstance = new (cm_alloc<ScriptModalWindow>()) ScriptModalWindow(left, top, width, height);
 		ScriptModalWindow* nativeInstance = new (cm_alloc<ScriptModalWindow>()) ScriptModalWindow(left, top, width, height);
-		nativeInstance->createInstance();
+		nativeInstance->createInstance(instance);
 
 
 		metaData.thisPtrField->setValue(instance, nativeInstance);
 		metaData.thisPtrField->setValue(instance, nativeInstance);
 	}
 	}

+ 1 - 0
MBansheeEditor/EditorApplication.cs

@@ -5,5 +5,6 @@ namespace BansheeEditor
 {
 {
     public class EditorApplication
     public class EditorApplication
     {
     {
+        
     }
     }
 }
 }

+ 1 - 0
MBansheeEditor/Program.cs

@@ -13,6 +13,7 @@ namespace BansheeEditor
 
 
             // TODO - A class to manipulate menu items
             // TODO - A class to manipulate menu items
 
 
+            ModalWindow mw = new ModalWindow(0, 0, 0, 0);
         }
         }
     }
     }
 
 

+ 11 - 2
MBansheeEngine/Font.cs

@@ -1,6 +1,15 @@
-namespace BansheeEngine
+using System.Runtime.InteropServices;
+
+namespace BansheeEngine
 {
 {
-    public class Font : Resource // TODO - Dummy class
+    public sealed class Font : Resource // TODO - Dummy class
     {
     {
+        public Font()
+        {
+            Internal_CreateInstance(this);
+        }
+
+        [DllImport("__Internal")]
+        private static extern void Internal_CreateInstance(Font instance);
     }
     }
 }
 }

+ 38 - 0
MBansheeEngine/GUIElementStateStyle.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace BansheeEngine
+{
+    public sealed class GUIElementStateStyle : ScriptObject
+    {
+        public GUIElementStateStyle()
+        {
+            Internal_CreateInstance(this);
+        }
+
+        public SpriteTexture texture
+        {
+            get { SpriteTexture value; Internal_GetTexture(mCachedPtr, out value); return value; }
+            set { Internal_SetTexture(mCachedPtr, value); }
+        }
+
+        public Color textColor
+        {
+            get { Color value; Internal_GetTextColor(mCachedPtr, out value); return value; }
+            set { Internal_SetTextColor(mCachedPtr, ref value); }
+        }
+
+        [DllImport("__Internal")]
+        private static extern void Internal_CreateInstance(GUIElementStateStyle instance);
+
+        [DllImport("__Internal")]
+        private static extern void Internal_GetTexture(IntPtr nativeInstance, out SpriteTexture value);
+        [DllImport("__Internal")]
+        private static extern void Internal_SetTexture(IntPtr nativeInstance, SpriteTexture value);
+
+        [DllImport("__Internal")]
+        private static extern void Internal_GetTextColor(IntPtr nativeInstance, out Color value);
+        [DllImport("__Internal")]
+        private static extern void Internal_SetTextColor(IntPtr nativeInstance, ref Color value);
+    };
+}

+ 275 - 0
MBansheeEngine/GUIElementStyle.cs

@@ -0,0 +1,275 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace BansheeEngine
+{
+    public struct RectOffset
+	{
+		int left, right, top, bottom;
+	};
+
+	public enum GUIImagePosition
+	{
+		Left, Right
+	};
+
+    public enum TextHorzAlign
+	{
+		Left, Center, Right
+	};
+
+	public enum TextVertAlign
+	{
+		Top, Center, Bottom
+	};
+
+    public sealed class GUIElementStyle : ScriptObject
+    {
+		public GUIElementStyle()
+        {
+		    Internal_CreateInstance(this);
+        }
+
+        public Font font
+        {
+            get { return Internal_GetFont(mCachedPtr); }
+            set { Internal_SetFont(mCachedPtr, value); }
+        }
+
+        public int fontSize
+        {
+            get { return Internal_GetFontSize(mCachedPtr); }
+            set { Internal_SetFontSize(mCachedPtr, value); }
+        }
+
+
+        public TextHorzAlign textHorzAlign
+        {
+            get { return Internal_GetTextHorzAlign(mCachedPtr); }
+            set { Internal_SetTextHorzAlign(mCachedPtr, value); }
+        }
+
+        public TextVertAlign textVertAlign
+        {
+            get { return Internal_GetTextVertAlign(mCachedPtr); }
+            set { Internal_SetTextVertAlign(mCachedPtr, value); }
+        }
+
+        public GUIImagePosition imagePosition
+        {
+            get { return Internal_GetImagePosition(mCachedPtr); }
+            set { Internal_SetImagePosition(mCachedPtr, value); }
+        }
+
+        public bool wordWrap
+        {
+            get { return Internal_GetWordWrap(mCachedPtr); }
+            set { Internal_SetWordWrap(mCachedPtr, value); }
+        }
+
+
+        public GUIElementStateStyle normal
+        {
+            get { return Internal_GetNormal(mCachedPtr); }
+            set { Internal_SetNormal(mCachedPtr, value); }
+        }
+
+        public GUIElementStateStyle hover
+        {
+            get { return Internal_GetHover(mCachedPtr); }
+            set { Internal_SetHover(mCachedPtr, value); }
+        }
+
+        public GUIElementStateStyle active
+        {
+            get { return Internal_GetActive(mCachedPtr); }
+            set { Internal_SetActive(mCachedPtr, value); }
+        }
+
+        public GUIElementStateStyle focused
+        {
+            get { return Internal_GetFocused(mCachedPtr); }
+            set { Internal_SetFocused(mCachedPtr, value); }
+        }
+
+
+		// For controls that can be turned on-off
+        public GUIElementStateStyle normalOn
+        {
+            get { return Internal_GetNormalOn(mCachedPtr); }
+            set { Internal_SetNormalOn(mCachedPtr, value); }
+        }
+
+        public GUIElementStateStyle hoverOn
+        {
+            get { return Internal_GetHoverOn(mCachedPtr); }
+            set { Internal_SetHoverOn(mCachedPtr, value); }
+        }
+
+        public GUIElementStateStyle activeOn
+        {
+            get { return Internal_GetActiveOn(mCachedPtr); }
+            set { Internal_SetActiveOn(mCachedPtr, value); }
+        }
+
+        public GUIElementStateStyle focusedOn
+        {
+            get { return Internal_GetFocusedOn(mCachedPtr); }
+            set { Internal_SetFocusedOn(mCachedPtr, value); }
+        }
+
+
+        public RectOffset border // Determines how the element is scaled (using the typical Scale9Grid approach)
+        {
+            get { return Internal_GetBorder(mCachedPtr); }
+            set { Internal_SetBorder(mCachedPtr, value); }
+        }
+
+        public RectOffset margins // Determines offset from the background graphics to the content. Input uses bounds offset by this value.
+        {
+            get { return Internal_GetMargins(mCachedPtr); }
+            set { Internal_SetMargins(mCachedPtr, value); }
+        }
+
+        public RectOffset contentOffset // Additional offset to the content, that doesn't effect the bounds. Applied on top of the margins offsets.
+        {
+            get { return Internal_GetContentOffset(mCachedPtr); }
+            set { Internal_SetContentOffset(mCachedPtr, value); }
+        }
+
+
+        public int width
+        {
+            get { return Internal_GetWidth(mCachedPtr); }
+            set { Internal_SetWidth(mCachedPtr, value); }
+        }
+
+        public int height
+        {
+            get { return Internal_GetHeight(mCachedPtr); }
+            set { Internal_SetHeight(mCachedPtr, value); }
+        }
+
+        public int minWidth
+        {
+            get { return Internal_GetMinWidth(mCachedPtr); }
+            set { Internal_SetMinWidth(mCachedPtr, value); }
+        }
+        
+        public int maxWidth
+        {
+            get { return Internal_GetMaxWidth(mCachedPtr); }
+            set { Internal_SetMaxWidth(mCachedPtr, value); }
+        }
+
+        public int minHeight
+        {
+            get { return Internal_GetMinHeight(mCachedPtr); }
+            set { Internal_SetMinHeight(mCachedPtr, value); }
+        }
+
+        public int maxHeight
+        {
+            get { return Internal_GetMaxHeight(mCachedPtr); }
+            set { Internal_SetMaxHeight(mCachedPtr, value); }
+        }
+
+        public bool fixedWidth
+        {
+            get { return Internal_GetFixedWidth(mCachedPtr); }
+            set { Internal_SetFixedWidth(mCachedPtr, value); }
+        }
+
+        public bool fixedHeight
+        {
+            get { return Internal_GetFixedHeight(mCachedPtr); }
+            set { Internal_SetFixedHeight(mCachedPtr, value); }
+        }
+
+        [DllImport("__Internal")]
+        private static extern void Internal_CreateInstance(GUIElementStyle instance);
+
+        [DllImport("__Internal")] private static extern Font Internal_GetFont(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetFont(IntPtr nativeInstance, Font value);
+
+        [DllImport("__Internal")] private static extern int Internal_GetFontSize(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetFontSize(IntPtr nativeInstance, int value);
+
+        [DllImport("__Internal")] private static extern TextHorzAlign Internal_GetTextHorzAlign(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetTextHorzAlign(IntPtr nativeInstance, TextHorzAlign value);
+
+        [DllImport("__Internal")] private static extern TextVertAlign Internal_GetTextVertAlign(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetTextVertAlign(IntPtr nativeInstance, TextVertAlign value);
+
+        [DllImport("__Internal")] private static extern GUIImagePosition Internal_GetImagePosition(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetImagePosition(IntPtr nativeInstance, GUIImagePosition value);
+
+        [DllImport("__Internal")] private static extern bool Internal_GetWordWrap(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetWordWrap(IntPtr nativeInstance, bool value);
+
+
+        [DllImport("__Internal")] private static extern GUIElementStateStyle Internal_GetNormal(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetNormal(IntPtr nativeInstance, GUIElementStateStyle value);
+
+        [DllImport("__Internal")] private static extern GUIElementStateStyle Internal_GetHover(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetHover(IntPtr nativeInstance, GUIElementStateStyle value);
+
+        [DllImport("__Internal")] private static extern GUIElementStateStyle Internal_GetActive(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetActive(IntPtr nativeInstance, GUIElementStateStyle value);
+
+        [DllImport("__Internal")] private static extern GUIElementStateStyle Internal_GetFocused(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetFocused(IntPtr nativeInstance, GUIElementStateStyle value);
+
+
+        [DllImport("__Internal")] private static extern GUIElementStateStyle Internal_GetNormalOn(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetNormalOn(IntPtr nativeInstance, GUIElementStateStyle value);
+
+        [DllImport("__Internal")] private static extern GUIElementStateStyle Internal_GetHoverOn(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetHoverOn(IntPtr nativeInstance, GUIElementStateStyle value);
+
+        [DllImport("__Internal")] private static extern GUIElementStateStyle Internal_GetActiveOn(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetActiveOn(IntPtr nativeInstance, GUIElementStateStyle value);
+
+        [DllImport("__Internal")] private static extern GUIElementStateStyle Internal_GetFocusedOn(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetFocusedOn(IntPtr nativeInstance, GUIElementStateStyle value);
+
+
+        [DllImport("__Internal")] private static extern RectOffset Internal_GetBorder(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetBorder(IntPtr nativeInstance, RectOffset value);
+
+        [DllImport("__Internal")] private static extern RectOffset Internal_GetMargins(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetMargins(IntPtr nativeInstance, RectOffset value);
+
+        [DllImport("__Internal")] private static extern RectOffset Internal_GetContentOffset(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetContentOffset(IntPtr nativeInstance, RectOffset value);
+
+
+        [DllImport("__Internal")] private static extern int Internal_GetWidth(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetWidth(IntPtr nativeInstance, int value);
+
+        [DllImport("__Internal")] private static extern int Internal_GetHeight(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetHeight(IntPtr nativeInstance, int value);
+
+        [DllImport("__Internal")] private static extern int Internal_GetMinWidth(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetMinWidth(IntPtr nativeInstance, int value);
+
+        [DllImport("__Internal")] private static extern int Internal_GetMaxWidth(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetMaxWidth(IntPtr nativeInstance, int value);
+
+        [DllImport("__Internal")] private static extern int Internal_GetMinHeight(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetMinHeight(IntPtr nativeInstance, int value);
+
+        [DllImport("__Internal")] private static extern int Internal_GetMaxHeight(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetMaxHeight(IntPtr nativeInstance, int value);
+
+        [DllImport("__Internal")] private static extern bool Internal_GetFixedWidth(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetFixedWidth(IntPtr nativeInstance, bool value);
+
+        [DllImport("__Internal")] private static extern bool Internal_GetFixedHeight(IntPtr nativeInstance);
+        [DllImport("__Internal")] private static extern void Internal_SetFixedHeight(IntPtr nativeInstance, bool value);
+    }
+}

+ 0 - 8
MBansheeEngine/GUIWidget.cs

@@ -10,15 +10,7 @@ namespace BansheeEngine
             Internal_CreateInstance(this);
             Internal_CreateInstance(this);
         }
         }
 
 
-        ~GUIWidget()
-        {
-            Internal_DestroyInstance(mCachedPtr);
-        }
-
         [DllImport("__Internal")]
         [DllImport("__Internal")]
         private static extern void Internal_CreateInstance(GUIWidget instance);
         private static extern void Internal_CreateInstance(GUIWidget instance);
-
-        [DllImport("__Internal")]
-        private static extern void Internal_DestroyInstance(IntPtr nativeInstance);
     }
     }
 }
 }

+ 2 - 0
MBansheeEngine/MBansheeEngine.csproj

@@ -43,6 +43,8 @@
     <Compile Include="BuiltinResources.cs" />
     <Compile Include="BuiltinResources.cs" />
     <Compile Include="Color.cs" />
     <Compile Include="Color.cs" />
     <Compile Include="Font.cs" />
     <Compile Include="Font.cs" />
+    <Compile Include="GUIElementStateStyle.cs" />
+    <Compile Include="GUIElementStyle.cs" />
     <Compile Include="GUIWidget.cs" />
     <Compile Include="GUIWidget.cs" />
     <Compile Include="MathEx.cs" />
     <Compile Include="MathEx.cs" />
     <Compile Include="Matrix3.cs" />
     <Compile Include="Matrix3.cs" />

+ 4 - 1
MBansheeEngine/Program.cs

@@ -1,13 +1,16 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 
 
-namespace MBansheeEngine
+namespace BansheeEngine
 {
 {
     class Program
     class Program
     {
     {
         static void Main(string[] args)
         static void Main(string[] args)
         {
         {
+            GUIElementStateStyle dbgStyle = new GUIElementStateStyle();
+            Color newColor = Color.red;
 
 
+            dbgStyle.textColor = newColor;
         }
         }
     }
     }
 }
 }

+ 9 - 0
MBansheeEngine/ScriptObject.cs

@@ -1,6 +1,7 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
+using System.Runtime.InteropServices;
 using System.Text;
 using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 
 
@@ -9,5 +10,13 @@ namespace BansheeEngine
     public class ScriptObject
     public class ScriptObject
     {
     {
         protected IntPtr mCachedPtr;
         protected IntPtr mCachedPtr;
+
+        ~ScriptObject()
+        {
+            Internal_DestroyInstance(mCachedPtr);
+        }
+        
+        [DllImport("__Internal")]
+        private static extern void Internal_DestroyInstance(IntPtr nativeInstance);
     }
     }
 }
 }

+ 11 - 2
MBansheeEngine/SpriteTexture.cs

@@ -1,6 +1,15 @@
-namespace BansheeEngine
+using System.Runtime.InteropServices;
+
+namespace BansheeEngine
 {
 {
-    public class SpriteTexture : Resource // TODO - Dummy class
+    public sealed class SpriteTexture : Resource // TODO - Dummy class
     {
     {
+        public SpriteTexture()
+        {
+            Internal_CreateInstance(this);
+        }
+
+        [DllImport("__Internal")]
+        private static extern void Internal_CreateInstance(SpriteTexture instance);
     }
     }
 }
 }

+ 0 - 8
MBansheeEngine/Texture2D.cs

@@ -10,15 +10,7 @@ namespace BansheeEngine
             Internal_CreateInstance(this, format, width, height, hasMipmaps, gammaCorrection);
             Internal_CreateInstance(this, format, width, height, hasMipmaps, gammaCorrection);
         }
         }
 
 
-        ~Texture2D()
-        {
-            Internal_DestroyInstance(mCachedPtr);
-        }
-
         [DllImport("__Internal")]
         [DllImport("__Internal")]
         private static extern void Internal_CreateInstance(Texture2D instance, TextureFormat format, int width, int height, bool hasMipmaps, bool gammaCorrection);
         private static extern void Internal_CreateInstance(Texture2D instance, TextureFormat format, int width, int height, bool hasMipmaps, bool gammaCorrection);
-
-        [DllImport("__Internal")]
-        private static extern void Internal_DestroyInstance(IntPtr nativeInstance);
     }
     }
 }
 }