Browse Source

Refactored Module startUp (does not compile because of a weird linker error ATM)
Added Cursor class

Marko Pintera 11 years ago
parent
commit
42b20759ef
46 changed files with 412 additions and 231 deletions
  1. 1 2
      BansheeEditor/Source/BsDockManager.cpp
  2. 5 5
      BansheeEditor/Source/BsEditorApplication.cpp
  3. 1 1
      BansheeEditor/Source/BsEditorWidget.cpp
  4. 4 3
      BansheeEditor/Source/BsGUIDockSlider.cpp
  5. 1 1
      BansheeEditor/Source/BsGUIMenuBar.cpp
  6. 1 1
      BansheeEditor/Source/BsGUITabbedTitleBar.cpp
  7. 1 1
      BansheeEditor/Source/BsGUIWindowFrameWidget.cpp
  8. 1 1
      BansheeEditor/Source/BsMainEditorWindow.cpp
  9. 1 1
      BansheeEditorExec/BsEditorExec.cpp
  10. 4 2
      BansheeEngine/BansheeEngine.vcxproj
  11. 12 6
      BansheeEngine/BansheeEngine.vcxproj.filters
  12. 14 2
      BansheeEngine/Include/BsBuiltinResources.h
  13. 1 0
      BansheeEngine/Include/BsProfilerOverlay.h
  14. 14 11
      BansheeEngine/Source/BsApplication.cpp
  15. 99 44
      BansheeEngine/Source/BsBuiltinResources.cpp
  16. 4 3
      BansheeEngine/Source/BsGUIInputBox.cpp
  17. 2 2
      BansheeEngine/Source/BsGUIManager.cpp
  18. 2 2
      BansheeEngine/Source/BsProfilerOverlay.cpp
  19. 1 1
      BansheeMono/Source/BsMonoScriptManager.cpp
  20. 1 0
      BansheeOctreeSM/BansheeOctreeSM.vcxproj
  21. 8 1
      BansheeOctreeSM/Source/BsSceneManagerPlugin.cpp
  22. 2 0
      CamelotCore/Include/CmApplication.h
  23. 1 1
      CamelotCore/Include/CmGpuProgramManager.h
  24. 1 1
      CamelotCore/Include/CmHardwareBufferManager.h
  25. 1 1
      CamelotCore/Include/CmPlatform.h
  26. 1 1
      CamelotCore/Include/CmQueryManager.h
  27. 1 1
      CamelotCore/Include/CmRenderStateManager.h
  28. 1 1
      CamelotCore/Include/CmRenderSystem.h
  29. 1 1
      CamelotCore/Include/CmRenderWindowManager.h
  30. 1 1
      CamelotCore/Include/CmSceneManager.h
  31. 1 1
      CamelotCore/Include/CmTextureManager.h
  32. 1 7
      CamelotCore/Include/Win32/CmPlatformImpl.h
  33. 20 22
      CamelotCore/Source/CmApplication.cpp
  34. 1 52
      CamelotCore/Source/Win32/CmPlatformImpl.cpp
  35. 1 1
      CamelotD3D11RenderSystem/Include/CmD3D11RenderSystem.h
  36. 7 7
      CamelotD3D11RenderSystem/Source/CmD3D11RenderSystem.cpp
  37. 1 1
      CamelotD3D11RenderSystem/Source/CmD3D11RenderSystemFactory.cpp
  38. 6 6
      CamelotD3D9Renderer/Source/CmD3D9RenderSystem.cpp
  39. 1 1
      CamelotD3D9Renderer/Source/CmD3D9RenderSystemFactory.cpp
  40. 1 0
      CamelotGLRenderer/CamelotGLRenderer.vcxproj
  41. 7 7
      CamelotGLRenderer/Source/CmGLRenderSystem.cpp
  42. 1 1
      CamelotGLRenderer/Source/CmGLRenderSystemFactory.cpp
  43. 162 18
      CamelotUtility/Include/CmModule.h
  44. 0 5
      GameObjectSerialization.txt
  45. 11 1
      Inspector.txt
  46. 3 3
      SBansheeEngine/Source/BsScriptEnginePlugin.cpp

+ 1 - 2
BansheeEditor/Source/BsDockManager.cpp

@@ -20,11 +20,10 @@
 #include "BsGUIDockSlider.h"
 #include "CmVertexDataDesc.h"
 #include "BsGUISkin.h"
-#include "BsEngineGUI.h"
+#include "BsBuiltinResources.h"
 #include "BsDockManagerLayout.h"
 
 #include "BsGUISkin.h"
-#include "BsEngineGUI.h"
 #include "BsGUIButton.h"
 
 using namespace CamelotFramework;

+ 5 - 5
BansheeEditor/Source/BsEditorApplication.cpp

@@ -55,7 +55,7 @@ namespace BansheeEditor
 
 		const String& renderSystemLibraryName = getLibraryNameForRenderSystem(renderSystemPlugin);
 		gBansheeApp().startUp(renderWindowDesc, renderSystemLibraryName, "BansheeForwardRenderer"); // TODO - Make renderer and resource cache dir customizable
-		EditorGUI::startUp(cm_new<EditorGUI>());
+		EditorGUI::startUp();
 
 		{
 			auto inputConfig = VirtualInput::instance().getConfiguration();
@@ -69,13 +69,13 @@ namespace BansheeEditor
 			inputConfig->registerButton("Delete", BC_DELETE);
 		}
 
-		ProjectLibrary::startUp(cm_new<ProjectLibrary>(getActiveProjectPath()));
+		ProjectLibrary::startUp(getActiveProjectPath());
 
-		UndoRedo::startUp(cm_new<UndoRedo>());
-		EditorWindowManager::startUp(cm_new<EditorWindowManager>());
+		UndoRedo::startUp();
+		EditorWindowManager::startUp();
 
 		MainEditorWindow* mainWindow = MainEditorWindow::create(gApplication().getPrimaryWindow());
-		EditorWidgetManager::startUp(cm_new<EditorWidgetManager>());
+		EditorWidgetManager::startUp();
 
 		gApplication().loadPlugin("SBansheeEditor"); // Managed part of the editor
 

+ 1 - 1
BansheeEditor/Source/BsEditorWidget.cpp

@@ -4,7 +4,7 @@
 #include "BsGUITexture.h"
 #include "BsGUISkin.h"
 #include "BsGUILayout.h"
-#include "BsEngineGUI.h"
+#include "BsBuiltinResources.h"
 #include "BsGUIArea.h"
 #include "BsEditorWidgetContainer.h"
 #include "BsEditorWidgetManager.h"

+ 4 - 3
BansheeEditor/Source/BsGUIDockSlider.cpp

@@ -4,6 +4,7 @@
 #include "BsGUILayoutOptions.h"
 #include "BsGUIMouseEvent.h"
 #include "BsGUITabbedTitleBar.h"
+#include "BsCursor.h"
 #include "CmPlatform.h"
 
 using namespace CamelotFramework;
@@ -56,7 +57,7 @@ namespace BansheeEditor
 
 			if(!mIsCursorSet)
 			{
-				Platform::setCursor(mHorizontal ? CursorType::SizeNS : CursorType::SizeWE);
+				Cursor::instance().setCursor(mHorizontal ? CursorType::SizeNS : CursorType::SizeWE);
 				mIsCursorSet = true;
 			}
 
@@ -68,7 +69,7 @@ namespace BansheeEditor
 
 			if(!mDragInProgress && mIsCursorSet)
 			{
-				Platform::setCursor(CursorType::Arrow);
+				Cursor::instance().setCursor(CursorType::Arrow);
 				mIsCursorSet = false;
 			}
 
@@ -97,7 +98,7 @@ namespace BansheeEditor
 
 			if(mIsCursorSet && !mIsMouseOver)
 			{
-				Platform::setCursor(CursorType::Arrow);
+				Cursor::instance().setCursor(CursorType::Arrow);
 				mIsCursorSet = false;
 			}
 

+ 1 - 1
BansheeEditor/Source/BsGUIMenuBar.cpp

@@ -7,7 +7,7 @@
 #include "BsGUISpace.h"
 #include "BsGUIMenu.h"
 #include "BsGUIManager.h"
-#include "BsEngineGUI.h"
+#include "BsBuiltinResources.h"
 #include "BsGUIDropDownBoxManager.h"
 #include "CmSceneObject.h"
 #include "CmPlatform.h"

+ 1 - 1
BansheeEditor/Source/BsGUITabbedTitleBar.cpp

@@ -6,7 +6,7 @@
 #include "BsGUITabButton.h"
 #include "BsGUISpace.h"
 #include "BsGUIWindowDropArea.h"
-#include "BsEngineGUI.h"
+#include "BsBuiltinResources.h"
 #include "BsGUIWidget.h"
 #include "BsGUIMouseEvent.h"
 #include "BsDragAndDropManager.h"

+ 1 - 1
BansheeEditor/Source/BsGUIWindowFrameWidget.cpp

@@ -3,7 +3,7 @@
 #include "BsGUILayout.h"
 #include "BsGUITexture.h"
 #include "BsGUIWindowFrame.h"
-#include "BsEngineGUI.h"
+#include "BsBuiltinResources.h"
 #include "BsGUIMouseEvent.h"
 #include "CmRenderWindow.h"
 #include "CmMath.h"

+ 1 - 1
BansheeEditor/Source/BsMainEditorWindow.cpp

@@ -76,7 +76,7 @@ namespace BansheeEditor
 		AABox dbgBox(Vector3(-300, -200, 1000), Vector3(300, 300, 1500));
 		//DrawHelper3D::instance().drawAABox(sceneCamera, dbgBox, Color::Green, 250.0f);
 
-		ProfilerOverlay::startUp(cm_new<ProfilerOverlay>(sceneCamera->getViewport()));
+		ProfilerOverlay::startUp(sceneCamera->getViewport());
 		ProfilerOverlay::instance().show();
 	}
 

+ 1 - 1
BansheeEditorExec/BsEditorExec.cpp

@@ -14,7 +14,7 @@ int CALLBACK WinMain(
 	_In_  int nCmdShow
 	)
 {
-	EditorApplication::startUp(cm_new<EditorApplication>(RenderSystemPlugin::DX11));
+	EditorApplication::startUp(RenderSystemPlugin::DX11);
 	EditorApplication::instance().runMainLoop();
 	EditorApplication::shutDown();
 

+ 4 - 2
BansheeEngine/BansheeEngine.vcxproj

@@ -226,14 +226,16 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="Source\BsCursor.cpp" />
     <ClCompile Include="Source\BsInputConfiguration.cpp" />
     <ClCompile Include="Source\BsVirtualInput.cpp" />
     <ClInclude Include="Include\BsApplication.h" />
+    <ClInclude Include="Include\BsCursor.h" />
     <ClInclude Include="Include\BsDrawHelper3D.h" />
     <ClInclude Include="Include\BsDrawHelperTemplate.h" />
     <ClInclude Include="Include\BsDragAndDropManager.h" />
     <ClInclude Include="Include\BsDrawHelper2D.h" />
-    <ClInclude Include="Include\BsEngineGUI.h" />
+    <ClInclude Include="Include\BsBuiltinResources.h" />
     <ClInclude Include="Include\BsGUIArea.h" />
     <ClInclude Include="Include\BsGUIButton.h" />
     <ClInclude Include="Include\BsGUIButtonBase.h" />
@@ -311,7 +313,7 @@
     <ClCompile Include="Source\BsDrawHelper3D.cpp" />
     <ClCompile Include="Source\BsDrawHelperTemplate.cpp" />
     <ClCompile Include="Source\BsDragAndDropManager.cpp" />
-    <ClCompile Include="Source\BsEngineGUI.cpp" />
+    <ClCompile Include="Source\BsBuiltinResources.cpp" />
     <ClCompile Include="Source\BsGUIArea.cpp" />
     <ClCompile Include="Source\BsGUIButton.cpp" />
     <ClCompile Include="Source\BsGUIContent.cpp" />

+ 12 - 6
BansheeEngine/BansheeEngine.vcxproj.filters

@@ -114,9 +114,6 @@
     <ClInclude Include="Include\BsGLBuiltinMaterialFactory.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="Include\BsEngineGUI.h">
-      <Filter>Header Files\GUI</Filter>
-    </ClInclude>
     <ClInclude Include="Include\BsUpdateCallback.h">
       <Filter>Header Files\Components</Filter>
     </ClInclude>
@@ -264,6 +261,12 @@
     <ClInclude Include="Include\BsGUIVirtualButtonEvent.h">
       <Filter>Header Files\GUI</Filter>
     </ClInclude>
+    <ClInclude Include="Include\BsCursor.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsBuiltinResources.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsGUIElement.cpp">
@@ -326,9 +329,6 @@
     <ClCompile Include="Source\BsGLBuiltinMaterialFactory.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="Source\BsEngineGUI.cpp">
-      <Filter>Source Files\GUI</Filter>
-    </ClCompile>
     <ClCompile Include="Source\BsUpdateCallback.cpp">
       <Filter>Source Files\Components</Filter>
     </ClCompile>
@@ -458,5 +458,11 @@
     <ClCompile Include="Source\BsInputConfiguration.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="Source\BsCursor.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="Source\BsBuiltinResources.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>

+ 14 - 2
BansheeEngine/Include/BsEngineGUI.h → BansheeEngine/Include/BsBuiltinResources.h

@@ -6,13 +6,25 @@
 
 namespace BansheeEngine
 {
-	class BS_EXPORT EngineGUI : public CamelotFramework::Module<EngineGUI>
+	class BS_EXPORT BuiltinResources : public CamelotFramework::Module<BuiltinResources>
 	{
 	public:
-		EngineGUI();
+		BuiltinResources();
 
 		const GUISkin& getSkin() const { return mSkin; }
 
+		const CM::PixelData& getCursorArrow(CM::Vector2I& hotSpot);
+		const CM::PixelData& getCursorWait(CM::Vector2I& hotSpot);
+		const CM::PixelData& getCursorIBeam(CM::Vector2I& hotSpot);
+		const CM::PixelData& getCursorHand(CM::Vector2I& hotSpot);
+		const CM::PixelData& getCursorSizeAll(CM::Vector2I& hotSpot);
+		const CM::PixelData& getCursorSizeNESW(CM::Vector2I& hotSpot);
+		const CM::PixelData& getCursorSizeNS(CM::Vector2I& hotSpot);
+		const CM::PixelData& getCursorSizeNWSE(CM::Vector2I& hotSpot);
+		const CM::PixelData& getCursorSizeWE(CM::Vector2I& hotSpot);
+		const CM::PixelData& getCursorDeny(CM::Vector2I& hotSpot);
+		const CM::PixelData& getCursorMoveLeftRight(CM::Vector2I& hotSpot);
+
 	private:
 		GUISkin mSkin;
 

+ 1 - 0
BansheeEngine/Include/BsProfilerOverlay.h

@@ -46,6 +46,7 @@ namespace BansheeEngine
 		};
 
 	public:
+		ProfilerOverlay() {} // For Module purposes only
 		ProfilerOverlay(const CM::ViewportPtr& target);
 		~ProfilerOverlay();
 

+ 14 - 11
BansheeEngine/Source/BsApplication.cpp

@@ -8,11 +8,12 @@
 #include "BsD3D9BuiltinMaterialFactory.h"
 #include "BsD3D11BuiltinMaterialFactory.h"
 #include "BsGLBuiltinMaterialFactory.h"
-#include "BsEngineGUI.h"
+#include "BsBuiltinResources.h"
 #include "BsScriptManager.h"
 #include "CmApplication.h"
 #include "CmProfiler.h"
 #include "BsVirtualInput.h"
+#include "BsCursor.h"
 
 using namespace CamelotFramework;
 
@@ -39,22 +40,23 @@ namespace BansheeEngine
 		
 		CM::gApplication().startUp(desc);
 
-		VirtualInput::startUp(cm_new<VirtualInput>());
-		ScriptManager::startUp(cm_new<ScriptManager>());
-		GUIManager::startUp(cm_new<GUIManager>());
-		GUIMaterialManager::startUp(cm_new<GUIMaterialManager>());
-		OverlayManager::startUp(cm_new<OverlayManager>());
+		VirtualInput::startUp();
+		ScriptManager::startUp();
+		GUIManager::startUp();
+		GUIMaterialManager::startUp();
+		OverlayManager::startUp();
 
-		BuiltinMaterialManager::startUp(cm_new<BuiltinMaterialManager>());
+		BuiltinMaterialManager::startUp();
 		BuiltinMaterialManager::instance().addFactory(cm_new<D3D9BuiltinMaterialFactory>());
 		BuiltinMaterialManager::instance().addFactory(cm_new<D3D11BuiltinMaterialFactory>());
 		BuiltinMaterialManager::instance().addFactory(cm_new<GLBuiltinMaterialFactory>());
 		BuiltinMaterialManager::instance().setActive(desc.renderSystem);
 
-		DrawHelper2D::startUp(cm_new<DrawHelper2D>());
-		DrawHelper3D::startUp(cm_new<DrawHelper3D>());
+		DrawHelper2D::startUp();
+		DrawHelper3D::startUp();
 
-		EngineGUI::startUp(cm_new<EngineGUI>());
+		BuiltinResources::startUp();
+		Cursor::startUp();
 
 		CM::gApplication().loadPlugin("BansheeMono", &mMonoPlugin);
 		CM::gApplication().loadPlugin("SBansheeEngine", &mSBansheeEnginePlugin); // Scripting interface
@@ -74,7 +76,8 @@ namespace BansheeEngine
 		CM::gApplication().unloadPlugin(mSBansheeEnginePlugin);
 		CM::gApplication().unloadPlugin(mMonoPlugin);
 
-		EngineGUI::shutDown();
+		Cursor::shutDown();
+		BuiltinResources::shutDown();
 
 		DrawHelper3D::shutDown();
 		DrawHelper2D::shutDown();

+ 99 - 44
BansheeEngine/Source/BsEngineGUI.cpp → BansheeEngine/Source/BsBuiltinResources.cpp

@@ -1,4 +1,4 @@
-#include "BsEngineGUI.h"
+#include "BsBuiltinResources.h"
 #include "BsGUIElementStyle.h"
 
 #include "BsGUILabel.h"
@@ -17,66 +17,66 @@ using namespace CamelotFramework;
 
 namespace BansheeEngine
 {
-	const WString EngineGUI::DefaultFontPath = L"arial.ttf";
-	const UINT32 EngineGUI::DefaultFontSize = 10;
+	const WString BuiltinResources::DefaultFontPath = L"arial.ttf";
+	const UINT32 BuiltinResources::DefaultFontSize = 10;
 
-	const WString EngineGUI::DefaultFolder = L"..\\..\\..\\..\\Data\\Engine\\Skin\\";
+	const WString BuiltinResources::DefaultFolder = L"..\\..\\..\\..\\Data\\Engine\\Skin\\";
 
-	const WString EngineGUI::ButtonNormalTex = L"ButtonNormal.psd";
-	const WString EngineGUI::ButtonHoverTex = L"ButtonHover.psd";
+	const WString BuiltinResources::ButtonNormalTex = L"ButtonNormal.psd";
+	const WString BuiltinResources::ButtonHoverTex = L"ButtonHover.psd";
 
-	const WString EngineGUI::InputBoxNormalTex = L"InputBoxNormal.psd";
-	const WString EngineGUI::InputBoxHoverTex = L"InputBoxHover.psd";
-	const WString EngineGUI::InputBoxFocusedTex = L"InputBoxFocused.psd";
+	const WString BuiltinResources::InputBoxNormalTex = L"InputBoxNormal.psd";
+	const WString BuiltinResources::InputBoxHoverTex = L"InputBoxHover.psd";
+	const WString BuiltinResources::InputBoxFocusedTex = L"InputBoxFocused.psd";
 
-	const WString EngineGUI::ScrollBarUpNormalTex = L"ScrollBarUpNormal.psd";
-	const WString EngineGUI::ScrollBarUpHoverTex = L"ScrollBarUpHover.psd";
-	const WString EngineGUI::ScrollBarUpActiveTex = L"ScrollBarUpActive.psd";
+	const WString BuiltinResources::ScrollBarUpNormalTex = L"ScrollBarUpNormal.psd";
+	const WString BuiltinResources::ScrollBarUpHoverTex = L"ScrollBarUpHover.psd";
+	const WString BuiltinResources::ScrollBarUpActiveTex = L"ScrollBarUpActive.psd";
 
-	const WString EngineGUI::ScrollBarDownNormalTex = L"ScrollBarDownNormal.psd";
-	const WString EngineGUI::ScrollBarDownHoverTex = L"ScrollBarDownHover.psd";
-	const WString EngineGUI::ScrollBarDownActiveTex = L"ScrollBarDownActive.psd";
+	const WString BuiltinResources::ScrollBarDownNormalTex = L"ScrollBarDownNormal.psd";
+	const WString BuiltinResources::ScrollBarDownHoverTex = L"ScrollBarDownHover.psd";
+	const WString BuiltinResources::ScrollBarDownActiveTex = L"ScrollBarDownActive.psd";
 
-	const WString EngineGUI::ScrollBarLeftNormalTex = L"ScrollBarLeftNormal.psd";
-	const WString EngineGUI::ScrollBarLeftHoverTex = L"ScrollBarLeftHover.psd";
-	const WString EngineGUI::ScrollBarLeftActiveTex = L"ScrollBarLeftActive.psd";
+	const WString BuiltinResources::ScrollBarLeftNormalTex = L"ScrollBarLeftNormal.psd";
+	const WString BuiltinResources::ScrollBarLeftHoverTex = L"ScrollBarLeftHover.psd";
+	const WString BuiltinResources::ScrollBarLeftActiveTex = L"ScrollBarLeftActive.psd";
 
-	const WString EngineGUI::ScrollBarRightNormalTex = L"ScrollBarRightNormal.psd";
-	const WString EngineGUI::ScrollBarRightHoverTex = L"ScrollBarRightHover.psd";
-	const WString EngineGUI::ScrollBarRightActiveTex = L"ScrollBarRightActive.psd";
+	const WString BuiltinResources::ScrollBarRightNormalTex = L"ScrollBarRightNormal.psd";
+	const WString BuiltinResources::ScrollBarRightHoverTex = L"ScrollBarRightHover.psd";
+	const WString BuiltinResources::ScrollBarRightActiveTex = L"ScrollBarRightActive.psd";
 
-	const WString EngineGUI::ScrollBarHandleHorzNormalTex = L"ScrollBarHorzHandleNormal.psd";
-	const WString EngineGUI::ScrollBarHandleHorzHoverTex = L"ScrollBarHorzHandleHover.psd";
-	const WString EngineGUI::ScrollBarHandleHorzActiveTex = L"ScrollBarHorzHandleActive.psd";
+	const WString BuiltinResources::ScrollBarHandleHorzNormalTex = L"ScrollBarHorzHandleNormal.psd";
+	const WString BuiltinResources::ScrollBarHandleHorzHoverTex = L"ScrollBarHorzHandleHover.psd";
+	const WString BuiltinResources::ScrollBarHandleHorzActiveTex = L"ScrollBarHorzHandleActive.psd";
 
-	const WString EngineGUI::ScrollBarHandleVertNormalTex = L"ScrollBarVertHandleNormal.psd";
-	const WString EngineGUI::ScrollBarHandleVertHoverTex = L"ScrollBarVertHandleHover.psd";
-	const WString EngineGUI::ScrollBarHandleVertActiveTex = L"ScrollBarVertHandleActive.psd";
+	const WString BuiltinResources::ScrollBarHandleVertNormalTex = L"ScrollBarVertHandleNormal.psd";
+	const WString BuiltinResources::ScrollBarHandleVertHoverTex = L"ScrollBarVertHandleHover.psd";
+	const WString BuiltinResources::ScrollBarHandleVertActiveTex = L"ScrollBarVertHandleActive.psd";
 
-	const WString EngineGUI::DropDownBtnNormalTex = L"DropDownNormal.psd";
-	const WString EngineGUI::DropDownBtnHoverTex = L"DropDownHover.psd";
+	const WString BuiltinResources::DropDownBtnNormalTex = L"DropDownNormal.psd";
+	const WString BuiltinResources::DropDownBtnHoverTex = L"DropDownHover.psd";
 
-	const WString EngineGUI::DropDownBoxBgTex = L"DropDownBoxBg.psd";
-	const WString EngineGUI::DropDownBoxEntryNormalTex = L"DropDownButtonNormal.psd";
-	const WString EngineGUI::DropDownBoxEntryHoverTex = L"DropDownButtonHover.psd";
+	const WString BuiltinResources::DropDownBoxBgTex = L"DropDownBoxBg.psd";
+	const WString BuiltinResources::DropDownBoxEntryNormalTex = L"DropDownButtonNormal.psd";
+	const WString BuiltinResources::DropDownBoxEntryHoverTex = L"DropDownButtonHover.psd";
 
-	const WString EngineGUI::DropDownBoxBtnUpNormalTex = L"DropDownBoxBtnUpNormal.psd";
-	const WString EngineGUI::DropDownBoxBtnUpHoverTex = L"DropDownBoxBtnUpHover.psd";
+	const WString BuiltinResources::DropDownBoxBtnUpNormalTex = L"DropDownBoxBtnUpNormal.psd";
+	const WString BuiltinResources::DropDownBoxBtnUpHoverTex = L"DropDownBoxBtnUpHover.psd";
 
-	const WString EngineGUI::DropDownBoxBtnDownNormalTex = L"DropDownBoxBtnDownNormal.psd";
-	const WString EngineGUI::DropDownBoxBtnDownHoverTex = L"DropDownBoxBtnDownHover.psd";
+	const WString BuiltinResources::DropDownBoxBtnDownNormalTex = L"DropDownBoxBtnDownNormal.psd";
+	const WString BuiltinResources::DropDownBoxBtnDownHoverTex = L"DropDownBoxBtnDownHover.psd";
 
-	const WString EngineGUI::DropDownBoxEntryExpNormalTex = L"DropDownExpNormal.psd";
-	const WString EngineGUI::DropDownBoxEntryExpHoverTex = L"DropDownExpHover.psd";
+	const WString BuiltinResources::DropDownBoxEntryExpNormalTex = L"DropDownExpNormal.psd";
+	const WString BuiltinResources::DropDownBoxEntryExpHoverTex = L"DropDownExpHover.psd";
 
-	const WString EngineGUI::DropDownSeparatorTex = L"DropDownSeparator.psd";
+	const WString BuiltinResources::DropDownSeparatorTex = L"DropDownSeparator.psd";
 
-	const WString EngineGUI::DropDownBoxBtnUpArrowTex = L"DropDownBoxBtnUpArrow.psd";
-	const WString EngineGUI::DropDownBoxBtnDownArrowTex = L"DropDownBoxBtnDownArrow.psd";
+	const WString BuiltinResources::DropDownBoxBtnUpArrowTex = L"DropDownBoxBtnUpArrow.psd";
+	const WString BuiltinResources::DropDownBoxBtnDownArrowTex = L"DropDownBoxBtnDownArrow.psd";
 
-	const WString EngineGUI::ScrollBarBgTex = L"ScrollBarBg.psd";
+	const WString BuiltinResources::ScrollBarBgTex = L"ScrollBarBg.psd";
 
-	EngineGUI::EngineGUI()
+	BuiltinResources::BuiltinResources()
 	{
 		// TODO - Normally I want to load this from some file
 		
@@ -447,8 +447,63 @@ namespace BansheeEngine
 		mSkin.setStyle("ContextMenuSeparator", dropDownSeparatorStyle);
 	}
 
-	HSpriteTexture EngineGUI::getTexture(const CM::WString& name)
+	HSpriteTexture BuiltinResources::getTexture(const CM::WString& name)
 	{
 		return SpriteTexture::create(static_resource_cast<Texture>(Importer::instance().import(FileSystem::getWorkingDirectoryPath() + L"\\" + DefaultFolder + name)));
 	}
+
+	const CM::PixelData& BuiltinResources::getCursorArrow(Vector2I& hotSpot)
+	{
+		CM_EXCEPT(NotImplementedException, "Not implemented");
+	}
+
+	const CM::PixelData& BuiltinResources::getCursorWait(Vector2I& hotSpot)
+	{
+		CM_EXCEPT(NotImplementedException, "Not implemented");
+	}
+
+	const CM::PixelData& BuiltinResources::getCursorIBeam(Vector2I& hotSpot)
+	{
+		CM_EXCEPT(NotImplementedException, "Not implemented");
+	}
+
+	const CM::PixelData& BuiltinResources::getCursorHand(Vector2I& hotSpot)
+	{
+		CM_EXCEPT(NotImplementedException, "Not implemented");
+	}
+
+	const CM::PixelData& BuiltinResources::getCursorSizeAll(Vector2I& hotSpot)
+	{
+		CM_EXCEPT(NotImplementedException, "Not implemented");
+	}
+
+	const CM::PixelData& BuiltinResources::getCursorSizeNESW(Vector2I& hotSpot)
+	{
+		CM_EXCEPT(NotImplementedException, "Not implemented");
+	}
+
+	const CM::PixelData& BuiltinResources::getCursorSizeNS(Vector2I& hotSpot)
+	{
+		CM_EXCEPT(NotImplementedException, "Not implemented");
+	}
+
+	const CM::PixelData& BuiltinResources::getCursorSizeNWSE(Vector2I& hotSpot)
+	{
+		CM_EXCEPT(NotImplementedException, "Not implemented");
+	}
+
+	const CM::PixelData& BuiltinResources::getCursorSizeWE(Vector2I& hotSpot)
+	{
+		CM_EXCEPT(NotImplementedException, "Not implemented");
+	}
+
+	const CM::PixelData& BuiltinResources::getCursorDeny(Vector2I& hotSpot)
+	{
+		CM_EXCEPT(NotImplementedException, "Not implemented");
+	}
+
+	const CM::PixelData& BuiltinResources::getCursorMoveLeftRight(Vector2I& hotSpot)
+	{
+		CM_EXCEPT(NotImplementedException, "Not implemented");
+	}
 }

+ 4 - 3
BansheeEngine/Source/BsGUIInputBox.cpp

@@ -18,6 +18,7 @@
 #include "BsDragAndDropManager.h"
 #include "BsGUIContextMenu.h"
 #include "BsGUIHelper.h"
+#include "BsCursor.h"
 
 using namespace CamelotFramework;
 
@@ -392,7 +393,7 @@ namespace BansheeEngine
 
 			if(!mInputCursorSet)
 			{
-				Platform::setCursor(CursorType::IBeam);
+				Cursor::instance().setCursor(CursorType::IBeam);
 				mInputCursorSet = true;
 			}
 
@@ -410,7 +411,7 @@ namespace BansheeEngine
 
 			if(!mDragInProgress && mInputCursorSet)
 			{
-				Platform::setCursor(CursorType::Arrow);
+				Cursor::instance().setCursor(CursorType::Arrow);
 				mInputCursorSet = false;
 			}
 
@@ -484,7 +485,7 @@ namespace BansheeEngine
 
 				if(!mIsMouseOver && mInputCursorSet)
 				{
-					Platform::setCursor(CursorType::Arrow);
+					Cursor::instance().setCursor(CursorType::Arrow);
 					mInputCursorSet = false;
 				}
 

+ 2 - 2
BansheeEngine/Source/BsGUIManager.cpp

@@ -83,10 +83,10 @@ namespace BansheeEngine
 		mInputCaret = cm_new<GUIInputCaret, PoolAlloc>();
 		mInputSelection = cm_new<GUIInputSelection, PoolAlloc>();
 
-		DragAndDropManager::startUp(cm_new<DragAndDropManager>());
+		DragAndDropManager::startUp();
 		mDragEndedConn = DragAndDropManager::instance().onDragEnded.connect(boost::bind(&GUIManager::onMouseDragEnded, this, _1));
 
-		GUIDropDownBoxManager::startUp(cm_new<GUIDropDownBoxManager>());
+		GUIDropDownBoxManager::startUp();
 
 		mVertexDesc = cm_shared_ptr<VertexDataDesc>();
 		mVertexDesc->addVertElem(VET_FLOAT2, VES_POSITION);

+ 2 - 2
BansheeEngine/Source/BsProfilerOverlay.cpp

@@ -6,7 +6,7 @@
 #include "BsGUIElement.h"
 #include "BsGUILabel.h"
 #include "BsGUISpace.h"
-#include "BsEngineGUI.h"
+#include "BsBuiltinResources.h"
 #include "CmProfiler.h"
 #include "CmViewport.h"
 
@@ -263,7 +263,7 @@ namespace BansheeEngine
 		mWidgetSO = SceneObject::create("ProfilerOverlay");
 		mWidget = mWidgetSO->addComponent<GUIWidget>(mTarget.get());
 		mWidget->setDepth(127);
-		mWidget->setSkin(EngineGUI::instance().getSkin());
+		mWidget->setSkin(BuiltinResources::instance().getSkin());
 
 		mBasicAreaLabels = GUIArea::create(*mWidget, 0, 0);
 		mPreciseAreaLabels = GUIArea::create(*mWidget, 0, 0);

+ 1 - 1
BansheeMono/Source/BsMonoScriptManager.cpp

@@ -19,7 +19,7 @@ namespace BansheeEngine
 
 	void MonoScriptSystem::initialize()
 	{
-		MonoManager::startUp(cm_new<MonoManager>());
+		MonoManager::startUp();
 		mIsInitialized = true;
 	}
 }

+ 1 - 0
BansheeOctreeSM/BansheeOctreeSM.vcxproj

@@ -144,6 +144,7 @@
       <AdditionalLibraryDirectories>..\lib\$(Platform)\$(Configuration);..\Dependencies\lib\x64\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <AdditionalDependencies>CamelotCore.lib;CamelotUtility.lib;BansheeEngine.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <ImportLibrary>..\lib\$(Platform)\$(Configuration)\$(TargetName).lib</ImportLibrary>
+      <ShowProgress>NotSet</ShowProgress>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

+ 8 - 1
BansheeOctreeSM/Source/BsSceneManagerPlugin.cpp

@@ -13,6 +13,13 @@ namespace BansheeEngine
 
 	extern "C" BS_SM_EXPORT void* loadPlugin()
 	{
-		return cm_new<OctreeSceneManager>();
+		SceneManager::startUp<OctreeSceneManager>();
+
+		return nullptr;
+	}
+
+	extern "C" BS_SM_EXPORT void unloadPlugin()
+	{
+		SceneManager::shutDown();
 	}
 }

+ 2 - 0
CamelotCore/Include/CmApplication.h

@@ -88,6 +88,8 @@ namespace CamelotFramework
 		CoreAccessorPtr mPrimaryCoreAccessor;
 		SyncedCoreAccessor* mPrimarySyncedCoreAccessor;
 
+		DynLib* mSceneManagerPlugin;
+
 		bool mIsFrameRenderingFinished;
 		CM_MUTEX(mFrameRenderingFinishedMutex);
 		CM_THREAD_SYNCHRONISER(mFrameRenderingFinishedCondition);

+ 1 - 1
CamelotCore/Include/CmGpuProgramManager.h

@@ -42,7 +42,7 @@ namespace CamelotFramework {
 	/** \addtogroup Resources
 	*  @{
 	*/
-	class CM_EXPORT GpuProgramManager : public Module<GpuProgramManager>
+	class CM_EXPORT GpuProgramManager : public Module<GpuProgramManager, true>
 	{
 	public:
 

+ 1 - 1
CamelotCore/Include/CmHardwareBufferManager.h

@@ -46,7 +46,7 @@ namespace CamelotFramework {
 
 	/** Base definition of a hardware buffer manager.
 	*/
-	class CM_EXPORT HardwareBufferManager : public Module<HardwareBufferManager>
+	class CM_EXPORT HardwareBufferManager : public Module<HardwareBufferManager, true>
 	{
     public:
         HardwareBufferManager();

+ 1 - 1
CamelotCore/Include/CmPlatform.h

@@ -4,7 +4,7 @@
 
 namespace CamelotFramework
 {
-	enum class CursorType
+	enum class PlatformCursorType
 	{
 		Arrow,
 		Wait,

+ 1 - 1
CamelotCore/Include/CmQueryManager.h

@@ -11,7 +11,7 @@ namespace CamelotFramework
 	 * 			
 	 * @note	Core thread only.
 	 */
-	class CM_EXPORT QueryManager : public Module<QueryManager>
+	class CM_EXPORT QueryManager : public Module<QueryManager, true>
 	{
 	public:
 		QueryManager();

+ 1 - 1
CamelotCore/Include/CmRenderStateManager.h

@@ -5,7 +5,7 @@
 
 namespace CamelotFramework
 {
-	class CM_EXPORT RenderStateManager : public Module<RenderStateManager>
+	class CM_EXPORT RenderStateManager : public Module<RenderStateManager, true>
 	{
 	public:
 		/**

+ 1 - 1
CamelotCore/Include/CmRenderSystem.h

@@ -78,7 +78,7 @@ namespace CamelotFramework
 	@version
 	1.0
 	*/
-	class CM_EXPORT RenderSystem : public Module<RenderSystem>
+	class CM_EXPORT RenderSystem : public Module<RenderSystem, true>
 	{
 	public:
 		/** Default Constructor.

+ 1 - 1
CamelotCore/Include/CmRenderWindowManager.h

@@ -7,7 +7,7 @@
 
 namespace CamelotFramework
 {
-	class CM_EXPORT RenderWindowManager : public Module<RenderWindowManager>
+	class CM_EXPORT RenderWindowManager : public Module<RenderWindowManager, true>
 	{
 	public:
 		RenderWindowManager();

+ 1 - 1
CamelotCore/Include/CmSceneManager.h

@@ -12,7 +12,7 @@ namespace CamelotFramework
 	 * 			query functionality. You should override it with your own version that
 	 * 			implements a spatial data structure of your choice for faster queries.
 	 */
-	class CM_EXPORT SceneManager : public Module<SceneManager>
+	class CM_EXPORT SceneManager : public Module<SceneManager, true>
 	{
 	public:
 		SceneManager();

+ 1 - 1
CamelotCore/Include/CmTextureManager.h

@@ -39,7 +39,7 @@ namespace CamelotFramework
      *
      * @note	Must be initialized when RenderSystem is first started.
      */
-    class CM_EXPORT TextureManager : public Module<TextureManager>
+    class CM_EXPORT TextureManager : public Module<TextureManager, true>
     {
     public:
 

+ 1 - 7
CamelotCore/Include/Win32/CmPlatformImpl.h

@@ -116,12 +116,6 @@ namespace CamelotFramework
 		 */
 		static bool isCursorHidden() { return mIsCursorHidden; }
 		
-		/**
-		 * @brief	Sets a cursor icon. Uses built-in platform cursor types.
-		 *
-		 * @note	Thread safe.
-		 */
-		static void setCursor(CursorType type);
 		/**
 		 * @brief	Sets a cursor using a custom image.
 		 *
@@ -130,7 +124,7 @@ namespace CamelotFramework
 		 * 						
 		 * @note	Thread safe.
 		 */
-		static void setCustomCursor(PixelData& pixelData, const Vector2I& hotSpot);
+		static void setCursor(PixelData& pixelData, const Vector2I& hotSpot);
 
 		/**
 		 * @brief	Sets custom caption non client areas for the specified window. Using custom client

+ 20 - 22
CamelotCore/Source/CmApplication.cpp

@@ -43,7 +43,7 @@
 namespace CamelotFramework
 {
 	Application::Application()
-		:mPrimaryWindow(nullptr), mIsFrameRenderingFinished(true), mRunMainLoop(false)
+		:mPrimaryWindow(nullptr), mIsFrameRenderingFinished(true), mRunMainLoop(false), mSceneManagerPlugin(nullptr)
 	{
 		
 	}
@@ -53,23 +53,23 @@ namespace CamelotFramework
 		Platform::startUp();
 		MemStack::beginThread();
 
-		Profiler::startUp(cm_new<Profiler>());
-		StringTable::startUp(cm_new<StringTable>());
-		DeferredCallManager::startUp(cm_new<DeferredCallManager>());
-		Time::startUp(cm_new<Time>());
-		DynLibManager::startUp(cm_new<DynLibManager>());
-		CoreGpuObjectManager::startUp(cm_new<CoreGpuObjectManager>());
-		GameObjectManager::startUp(cm_new<GameObjectManager>());
-		Resources::startUp(cm_new<Resources>());
-		HighLevelGpuProgramManager::startUp(cm_new<HighLevelGpuProgramManager>());
+		Profiler::startUp();
+		StringTable::startUp();
+		DeferredCallManager::startUp();
+		Time::startUp();
+		DynLibManager::startUp();
+		CoreGpuObjectManager::startUp();
+		GameObjectManager::startUp();
+		Resources::startUp();
+		HighLevelGpuProgramManager::startUp();
 
-		CoreThread::startUp(cm_new<CoreThread>());
-		RenderSystemManager::startUp(cm_new<RenderSystemManager>());
+		CoreThread::startUp();
+		RenderSystemManager::startUp();
 
 		mPrimaryWindow = RenderSystemManager::instance().initialize(desc.renderSystem, desc.primaryWindowDesc);
 
-		Input::startUp(cm_new<Input>());
-		RendererManager::startUp(cm_new<RendererManager>());
+		Input::startUp();
+		RendererManager::startUp();
 
 		loadPlugin(desc.renderer);
 		RendererManager::instance().setActive(desc.renderer);
@@ -77,20 +77,18 @@ namespace CamelotFramework
 		mPrimaryCoreAccessor = gCoreThread().getAccessor();
 		mPrimarySyncedCoreAccessor = &gCoreThread().getSyncedAccessor();
 
-		SceneManager::startUp((SceneManager*)loadPlugin(desc.sceneManager));
+		loadPlugin(desc.sceneManager, &mSceneManagerPlugin);
 
-		MeshManager::startUp(cm_new<MeshManager>());
-		MaterialManager::startUp(cm_new<MaterialManager>());
-		FontManager::startUp(cm_new<FontManager>());
+		MeshManager::startUp();
+		MaterialManager::startUp();
+		FontManager::startUp();
 
-		Importer::startUp(cm_new<Importer>());
+		Importer::startUp();
 
 		for(auto& importerName : desc.importers)
 			loadPlugin(importerName);
 
 		loadPlugin(desc.input);
-
-		Platform::setCursor(CursorType::Arrow);
 	}
 
 	void Application::runMainLoop()
@@ -177,7 +175,7 @@ namespace CamelotFramework
 		MaterialManager::shutDown();
 		MeshManager::shutDown();
 
-		SceneManager::shutDown();
+		unloadPlugin(mSceneManagerPlugin);
 
 		RendererManager::shutDown();
 		RenderSystemManager::shutDown();

+ 1 - 52
CamelotCore/Source/Win32/CmPlatformImpl.cpp

@@ -167,59 +167,8 @@ namespace CamelotFramework
 		ClipCursor(NULL);
 	}
 
-	void Platform::setCursor(CursorType type)
-	{
-		if(mUsingCustomCursor)
-		{
-			SetCursor(0);
-			DestroyIcon(mCursor.data->cursor);
-			mUsingCustomCursor = false;
-		}
-
-		switch(type)
-		{
-		case CursorType::Arrow:
-			mCursor.data->cursor = LoadCursor(0, IDC_ARROW);
-			break;
-		case CursorType::Wait:
-			mCursor.data->cursor = LoadCursor(0, IDC_WAIT);
-			break;
-		case CursorType::IBeam:
-			mCursor.data->cursor = LoadCursor(0, IDC_IBEAM);
-			break;
-		case CursorType::Help:
-			mCursor.data->cursor = LoadCursor(0, IDC_HELP);
-			break;
-		case CursorType::Hand:
-			mCursor.data->cursor = LoadCursor(0, IDC_HAND);
-			break;
-		case CursorType::SizeAll:
-			mCursor.data->cursor = LoadCursor(0, IDC_SIZEALL);
-			break;
-		case CursorType::SizeNESW:
-			mCursor.data->cursor = LoadCursor(0, IDC_SIZENESW);
-			break;
-		case CursorType::SizeNS:
-			mCursor.data->cursor = LoadCursor(0, IDC_SIZENS);
-			break;
-		case CursorType::SizeNWSE:
-			mCursor.data->cursor = LoadCursor(0, IDC_SIZENWSE);
-			break;
-		case CursorType::SizeWE:
-			mCursor.data->cursor = LoadCursor(0, IDC_SIZEWE);
-			break;
-		}
-
-		// Make sure we notify the message loop to perform the actual cursor update
-		RenderWindowPtr primaryWindow = gApplication().getPrimaryWindow();
-		HWND hwnd;
-		primaryWindow->getCustomAttribute("WINDOW", &hwnd);
-
-		PostMessage(hwnd, WM_SETCURSOR, WPARAM(hwnd), (LPARAM)MAKELONG(HTCLIENT, WM_MOUSEMOVE));
-	}
-
 	// TODO - Add support for animated custom cursor
-	void Platform::setCustomCursor(PixelData& pixelData, const Vector2I& hotSpot)
+	void Platform::setCursor(PixelData& pixelData, const Vector2I& hotSpot)
 	{
 		if(mUsingCustomCursor)
 		{

+ 1 - 1
CamelotD3D11RenderSystem/Include/CmD3D11RenderSystem.h

@@ -8,6 +8,7 @@ namespace CamelotFramework
 	class CM_D3D11_EXPORT D3D11RenderSystem : public RenderSystem
 	{
 	public:
+		D3D11RenderSystem();
 		~D3D11RenderSystem();
 
 		/**
@@ -94,7 +95,6 @@ namespace CamelotFramework
 
 	protected:
 		friend class D3D11RenderSystemFactory;
-		D3D11RenderSystem();
 
 		/**
 		 * @copydoc	RenderSystem::initialize_internal().

+ 7 - 7
CamelotD3D11RenderSystem/Source/CmD3D11RenderSystem.cpp

@@ -104,22 +104,22 @@ namespace CamelotFramework
 		}
 
 		// Create the texture manager for use by others		
-		TextureManager::startUp(cm_new<D3D11TextureManager>());
+		TextureManager::startUp<D3D11TextureManager>();
 
 		// Also create hardware buffer manager		
-		HardwareBufferManager::startUp(cm_new<D3D11HardwareBufferManager>(std::ref(*mDevice)));
+		HardwareBufferManager::startUp<D3D11HardwareBufferManager>(std::ref(*mDevice));
 
 		// Create the GPU program manager		
-		GpuProgramManager::startUp(cm_new<D3D11GpuProgramManager>(std::ref(*mDevice)));
+		GpuProgramManager::startUp<D3D11GpuProgramManager>(std::ref(*mDevice));
 
 		// Create render window manager
-		RenderWindowManager::startUp(cm_new<D3D11RenderWindowManager>(this));
+		RenderWindowManager::startUp<D3D11RenderWindowManager>(this);
 
 		// Create & register HLSL factory		
 		mHLSLFactory = cm_new<D3D11HLSLProgramFactory>();
 
 		// Create render state manager
-		RenderStateManager::startUp(cm_new<D3D11RenderStateManager>());
+		RenderStateManager::startUp<D3D11RenderStateManager>();
 
 		mCurrentCapabilities = createRenderSystemCapabilities();
 
@@ -130,9 +130,9 @@ namespace CamelotFramework
 
 		RenderWindowPtr primaryWindow = RenderWindow::create(mPrimaryWindowDesc);
 
-		D3D11RenderUtility::startUp(cm_new<D3D11RenderUtility>(mDevice));
+		D3D11RenderUtility::startUp(mDevice);
 
-		QueryManager::startUp(cm_new<D3D11QueryManager>());
+		QueryManager::startUp<D3D11QueryManager>();
 
 		RenderSystem::initialize_internal(asyncOp);
 

+ 1 - 1
CamelotD3D11RenderSystem/Source/CmD3D11RenderSystemFactory.cpp

@@ -5,7 +5,7 @@ namespace CamelotFramework
 {
 	void D3D11RenderSystemFactory::create()
 	{
-		RenderSystem::startUp(new (cm_alloc<D3D11RenderSystem>()) D3D11RenderSystem());
+		RenderSystem::startUp<D3D11RenderSystem>();
 	}
 
 	D3D11RenderSystemFactory::InitOnStart D3D11RenderSystemFactory::initOnStart;

+ 6 - 6
CamelotD3D9Renderer/Source/CmD3D9RenderSystem.cpp

@@ -151,10 +151,10 @@ namespace CamelotFramework
 		mDeviceManager = cm_new<D3D9DeviceManager>();
 
 		// Also create hardware buffer manager		
-		HardwareBufferManager::startUp(cm_new<D3D9HardwareBufferManager>());
+		HardwareBufferManager::startUp<D3D9HardwareBufferManager>();
 
 		// Create the GPU program manager		
-		GpuProgramManager::startUp(cm_new<D3D9GpuProgramManager>());
+		GpuProgramManager::startUp<D3D9GpuProgramManager>();
 
 		// Create & register HLSL factory		
 		mHLSLProgramFactory = cm_new<D3D9HLSLProgramFactory>();
@@ -163,10 +163,10 @@ namespace CamelotFramework
 		mCgProgramFactory = cm_new<CgProgramFactory>();
 
 		// Create render window manager
-		RenderWindowManager::startUp(cm_new<D3D9RenderWindowManager>(this));
+		RenderWindowManager::startUp<D3D9RenderWindowManager>(this);
 
 		// Create render state manager
-		RenderStateManager::startUp(cm_new<RenderStateManager>());
+		RenderStateManager::startUp<RenderStateManager>();
 
 		// Create primary window and finalize initialization
 		RenderWindowPtr primaryWindow = RenderWindow::create(mPrimaryWindowDesc);
@@ -174,9 +174,9 @@ namespace CamelotFramework
 		updateRenderSystemCapabilities(d3d9renderWindow);
 
 		// Create the texture manager for use by others		
-		TextureManager::startUp(cm_new<D3D9TextureManager>());
+		TextureManager::startUp<D3D9TextureManager>();
 
-		QueryManager::startUp(cm_new<D3D9QueryManager>());
+		QueryManager::startUp<D3D9QueryManager>();
 
 		// call superclass method
 		RenderSystem::initialize_internal(asyncOp);

+ 1 - 1
CamelotD3D9Renderer/Source/CmD3D9RenderSystemFactory.cpp

@@ -11,7 +11,7 @@ namespace CamelotFramework
 		HINSTANCE hInst = GetModuleHandle( "CamelotD3D9RenderSystem.dll" );
 	#endif
 
-		RenderSystem::startUp(cm_new<D3D9RenderSystem>(hInst));
+		RenderSystem::startUp<D3D9RenderSystem>(hInst);
 	}
 
 	D3D9RenderSystemFactory::InitOnStart D3D9RenderSystemFactory::initOnStart;

+ 1 - 0
CamelotGLRenderer/CamelotGLRenderer.vcxproj

@@ -146,6 +146,7 @@
       <AdditionalDependencies>glu32.lib;opengl32.lib;CamelotCore.lib;CamelotUtility.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <ImportLibrary>..\lib\$(Platform)\$(Configuration)\$(TargetName).lib</ImportLibrary>
       <AdditionalLibraryDirectories>..\lib\$(Platform)\$(Configuration);..\Dependencies\lib\x64\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <ShowProgress>NotSet</ShowProgress>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

+ 7 - 7
CamelotGLRenderer/Source/CmGLRenderSystem.cpp

@@ -137,11 +137,11 @@ namespace CamelotFramework
 		THROW_IF_NOT_CORE_THREAD;
 
 		mGLSupport->start();
-		RenderWindowManager::startUp(cm_new<GLRenderWindowManager>(this));
+		RenderWindowManager::startUp<GLRenderWindowManager>(this);
 
-		RenderStateManager::startUp(cm_new<RenderStateManager>());
+		RenderStateManager::startUp<RenderStateManager>();
 
-		QueryManager::startUp(cm_new<GLQueryManager>());
+		QueryManager::startUp<GLQueryManager>();
 
 		// Initialize a window so we have something to create a GL context with
 		RenderWindowPtr primaryWindow = RenderWindow::create(mPrimaryWindowDesc);
@@ -1800,11 +1800,11 @@ namespace CamelotFramework
 			glUnmapBufferARB = glUnmapBuffer;
 		}
 
-		HardwareBufferManager::startUp(cm_new<GLHardwareBufferManager>());
+		HardwareBufferManager::startUp<GLHardwareBufferManager>();
 		checkForErrors();
 
 		// GPU Program Manager setup
-		GpuProgramManager::startUp(cm_new<GLGpuProgramManager>());
+		GpuProgramManager::startUp<GLGpuProgramManager>();
 		checkForErrors();
 
 		if(caps->isShaderProfileSupported("glsl"))
@@ -1850,7 +1850,7 @@ namespace CamelotFramework
 			if(caps->hasCapability(RSC_HWRENDER_TO_TEXTURE))
 			{
 				// Create FBO manager
-				GLRTTManager::startUp(cm_new<GLRTTManager>());
+				GLRTTManager::startUp();
 				checkForErrors();
 			}
 		}
@@ -1899,7 +1899,7 @@ namespace CamelotFramework
 			CM_EXCEPT(InternalErrorException, "Number of combined uniform block buffers less than the number of individual per-stage buffers!?");
 
 		/// Create the texture manager   
-		TextureManager::startUp(cm_new<GLTextureManager>(std::ref(*mGLSupport))); 
+		TextureManager::startUp<GLTextureManager>(std::ref(*mGLSupport)); 
 		checkForErrors();
 	}
 

+ 1 - 1
CamelotGLRenderer/Source/CmGLRenderSystemFactory.cpp

@@ -5,7 +5,7 @@ namespace CamelotFramework
 {
 	void GLRenderSystemFactory::create()
 	{
-		RenderSystem::startUp(cm_new<GLRenderSystem>());
+		RenderSystem::startUp<GLRenderSystem>();
 	}
 
 	GLRenderSystemFactory::InitOnStart GLRenderSystemFactory::initOnStart;

+ 162 - 18
CamelotUtility/Include/CmModule.h

@@ -5,13 +5,10 @@
 
 namespace CamelotFramework
 {
-	/**
-	 * @brief	Represents one engine module. Essentially it is a specialized type of singleton.
-	 */
-	template <class T> // TODO - Make it thread safe
+	template <class T, bool abstract = false>
 	class Module
 	{
-	public:
+		public:
 		static T& instance()
 		{
 			if(isShutDown)
@@ -45,25 +42,164 @@ namespace CamelotFramework
 
 			return _instance;
 		}
+		
+#define MAKE_CM_NEW(z, n, unused)																	\
+		template<BOOST_PP_ENUM_PARAMS(n, class T)>													\
+		static void startUp(BOOST_PP_ENUM_BINARY_PARAMS(n, T, &&t) )								\
+		{																							\
+			if(!isShutDown)																			\
+				CM_EXCEPT(InternalErrorException, "Trying to start an already started module.");	\
+																									\
+			_instance = cm_new<T>(std::forward<T0>(t0) BOOST_PP_REPEAT_FROM_TO(1, n, FORWARD_T, ~)); \
+			isShutDown = false;																		\
+																									\
+			((Module*)_instance)->onStartUp();														\
+		}
+
+#define FORWARD_T(z, i, unused) \
+	, std::forward<BOOST_PP_CAT(T, i)>(BOOST_PP_CAT(t, i))
+
+		BOOST_PP_REPEAT_FROM_TO(1, 15, MAKE_CM_NEW, ~)
+
+#undef FORWARD_T
+#undef MAKE_CM_NEW
+
+		static void startUp()
+		{
+			if(!isShutDown)
+				CM_EXCEPT(InternalErrorException, "Trying to start an already started module.");
+
+			_instance = cm_new<T>();
+			isShutDown = false;
+
+			((Module*)_instance)->onStartUp();
+		}
 
 		/**
-		 * @brief	Initializes the module.
-		 *
-		 * @param [in]	moduleInstance Instantiated module. Module takes ownership of instance memory
-		 * 								and releases it when shutDown is called.
+		 * @brief	Shuts down this module and frees any resources it is using.
 		 */
-		static void startUp(T* moduleInstance)
+		static void shutDown()
 		{
-			if(!isShutDown)
+			if(isShutDown)
+			{
+				CM_EXCEPT(InternalErrorException, 
+					"Trying to shut down an already shut down module.");
+			}
+
+			((Module*)_instance)->onShutDown();
+
+			cm_delete(_instance);
+			isShutDown = true;
+		}
+
+		/**
+		 * @brief	Query if this object has been started.
+		 */
+		static bool isStarted()
+		{
+			return !isShutDown && !isDestroyed;
+		}
+
+	protected:
+		Module() 
+		{ 
+		}
+
+		virtual ~Module()
+		{ 
+			_instance = nullptr;
+			isDestroyed = true;
+		}
+
+		Module(const Module&) { }
+		Module& operator=(const Module&) { return *this; }
+
+		virtual void onStartUp() {}
+		virtual void onShutDown() {}
+
+		static T* _instance;
+		static bool isShutDown;
+		static bool isDestroyed;
+	};
+
+	/**
+	 * @brief	Represents one engine module. Essentially it is a specialized type of singleton.
+	 */
+	template <class T>
+	class Module<T, true>
+	{
+	public:
+		static T& instance()
+		{
+			if(isShutDown)
+			{
+				CM_EXCEPT(InternalErrorException, 
+					"Trying to access a module but it hasn't been started up yet.");
+			}
+
+			if(isDestroyed)
+			{
+				CM_EXCEPT(InternalErrorException, 
+					"Trying to access a destroyed module.");
+			}
+
+			return *_instance;
+		}
+
+		static T* instancePtr()
+		{
+			if(isShutDown)
+			{
+				CM_EXCEPT(InternalErrorException, 
+					"Trying to access a module but it hasn't been started up yet.");
+			}
+
+			if(isDestroyed)
 			{
 				CM_EXCEPT(InternalErrorException, 
-					"Trying to start an already started module.");
+					"Trying to access a destroyed module.");
 			}
 
-			_instance = moduleInstance;
+			return _instance;
+		}
+
+#define MAKE_CM_NEW(z, n, unused)																		\
+		template<class Type BOOST_PP_ENUM_TRAILING_PARAMS(n, class T)>									\
+		static void startUp(BOOST_PP_ENUM_BINARY_PARAMS(n, T, &&t) )									\
+		{																								\
+			BOOST_STATIC_ASSERT_MSG((boost::is_base_of<T, Type>::value),								\
+				"Invalid type. Specific type must be a child of the type Module is defined with.");		\
+																										\
+			if(!isShutDown)																				\
+				CM_EXCEPT(InternalErrorException, "Trying to start an already started module.");		\
+																										\
+			_instance = cm_new<Type>(std::forward<T0>(t0) BOOST_PP_REPEAT_FROM_TO(1, n, FORWARD_T, ~));	\
+			isShutDown = false;																			\
+																										\
+			((Module*)_instance)->onStartUp();															\
+		}
+
+#define FORWARD_T(z, i, unused) \
+	, std::forward<BOOST_PP_CAT(T, i)>(BOOST_PP_CAT(t, i))
+
+			BOOST_PP_REPEAT_FROM_TO(1, 15, MAKE_CM_NEW, ~)
+
+#undef FORWARD_T
+#undef MAKE_CM_NEW
+
+		template<class Type>
+		static void startUp()
+		{
+			BOOST_STATIC_ASSERT_MSG((boost::is_base_of<T, Type>::value), 
+				"Invalid type. Specific type must be a child of the type Module is defined with.");
+
+			if(!isShutDown)
+				CM_EXCEPT(InternalErrorException, "Trying to start an already started module.");
+
+			_instance = cm_new<Type>();
 			isShutDown = false;
 
-			((Module*)moduleInstance)->onStartUp();
+			((Module*)_instance)->onStartUp();
 		}
 
 		/**
@@ -108,18 +244,26 @@ namespace CamelotFramework
 		virtual void onStartUp() {}
 		virtual void onShutDown() {}
 
-	private:
 		static T* _instance;
 		static bool isShutDown;
 		static bool isDestroyed;
 	};
 
+	template <class T, bool abstract>
+	T* Module<T, abstract>::_instance = nullptr;
+
+	template <class T, bool abstract>
+	bool Module<T, abstract>::isShutDown = true;
+
+	template <class T, bool abstract>
+	bool Module<T, abstract>::isDestroyed = false;
+
 	template <class T>
-	T* Module<T>::_instance = nullptr;
+	T* Module<T, true>::_instance = nullptr;
 
 	template <class T>
-	bool Module<T>::isShutDown = true;
+	bool Module<T, true>::isShutDown = true;
 
 	template <class T>
-	bool Module<T>::isDestroyed = false;
+	bool Module<T, true>::isDestroyed = false;
 }

+ 0 - 5
GameObjectSerialization.txt

@@ -8,11 +8,6 @@ C# Serialization
 
  ---------------------------------------
 
-IMMEDIATE:
-MonoManager class caching doesn't work with generic types because they all share the same name
-Ensure that List works with all data types
-When it works copy its set/get code to Dictionary
-
 LOW PRIORITY
 - Get rid of ScriptObject::createInstance and replace it with parameter in constructor
 - A way to serialize any object into a Resource (and deserialize it from Resource)

+ 11 - 1
Inspector.txt

@@ -13,6 +13,15 @@ Resource field
 Component foldout field
 Text field
 
+-------------
+Cursor
+ - Implement get*Cursor methods in BsBuiltinResources
+ - A way to save/load a set of cursors
+
+Other:
+ - Refactor BuiltinMaterialFactory to BuiltinEngineResources
+ - Need to set up parameter pass-through for Modules
+
 -------------
 
 When Inspector is displayed a SerializedObject of a Component (or some other type) is created
@@ -24,4 +33,5 @@ You can call EditorGUI.SerializedField to automatically draw GUI depending on fi
  - Or SerializedObject to draw GUI for entire object
 
 ------------
-PRIMARY advantage of handling properties like this, instead of making custom inspectors and calling GUI methods manually is that you get undo/redo support.
+PRIMARY advantage of handling properties like this, instead of making custom inspectors and calling GUI methods manually is that you get undo/redo support.
+ALSO I need tab movement

+ 3 - 3
SBansheeEngine/Source/BsScriptEnginePlugin.cpp

@@ -50,9 +50,9 @@ namespace BansheeEngine
 		mono_add_internal_call("BansheeEngine.Program::dbgTestComponentClone", &dbgTestComponentClone);
 		mono_add_internal_call("BansheeEngine.Program::reportDbgValue", &reportDbgValue);
 
-		RuntimeScriptObjects::startUp(cm_new<RuntimeScriptObjects>());
-		ScriptResourceManager::startUp(cm_new<ScriptResourceManager>());
-		ScriptGameObjectManager::startUp(cm_new<ScriptGameObjectManager>());
+		RuntimeScriptObjects::startUp();
+		ScriptResourceManager::startUp();
+		ScriptGameObjectManager::startUp();
 
 		RuntimeScriptObjects::instance().refreshScriptObjects(BansheeEngineAssemblyName);