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

Cursor refactoring and UpdateCallback component
EditorWindow displays current mouse coordinates

Marko Pintera 12 лет назад
Родитель
Сommit
8cfa6da2ce

+ 2 - 0
BansheeEngine/BansheeEngine.vcxproj

@@ -173,6 +173,7 @@
     <ClInclude Include="Include\BsD3D11BuiltinMaterialFactory.h" />
     <ClInclude Include="Include\BsD3D11BuiltinMaterialFactory.h" />
     <ClInclude Include="Include\BsD3D9BuiltinMaterialFactory.h" />
     <ClInclude Include="Include\BsD3D9BuiltinMaterialFactory.h" />
     <ClInclude Include="Include\BsGLBuiltinMaterialFactory.h" />
     <ClInclude Include="Include\BsGLBuiltinMaterialFactory.h" />
+    <ClInclude Include="Include\BsUpdateCallback.h" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsApplication.cpp" />
     <ClCompile Include="Source\BsApplication.cpp" />
@@ -197,6 +198,7 @@
     <ClCompile Include="Source\BsD3D11BuiltinMaterialFactory.cpp" />
     <ClCompile Include="Source\BsD3D11BuiltinMaterialFactory.cpp" />
     <ClCompile Include="Source\BsD3D9BuiltinMaterialFactory.cpp" />
     <ClCompile Include="Source\BsD3D9BuiltinMaterialFactory.cpp" />
     <ClCompile Include="Source\BsGLBuiltinMaterialFactory.cpp" />
     <ClCompile Include="Source\BsGLBuiltinMaterialFactory.cpp" />
+    <ClCompile Include="Source\BsUpdateCallback.cpp" />
   </ItemGroup>
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   <ImportGroup Label="ExtensionTargets">

+ 6 - 0
BansheeEngine/BansheeEngine.vcxproj.filters

@@ -117,6 +117,9 @@
     <ClInclude Include="Include\BsEngineGUI.h">
     <ClInclude Include="Include\BsEngineGUI.h">
       <Filter>Header Files\GUI</Filter>
       <Filter>Header Files\GUI</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="Include\BsUpdateCallback.h">
+      <Filter>Header Files\Components</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsGUIElement.cpp">
     <ClCompile Include="Source\BsGUIElement.cpp">
@@ -185,5 +188,8 @@
     <ClCompile Include="Source\BsEngineGUI.cpp">
     <ClCompile Include="Source\BsEngineGUI.cpp">
       <Filter>Source Files\GUI</Filter>
       <Filter>Source Files\GUI</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="Source\BsUpdateCallback.cpp">
+      <Filter>Source Files\Components</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 3 - 0
BansheeEngine/Include/BsGUILabel.h

@@ -16,6 +16,8 @@ namespace BansheeEngine
 		static GUILabel* create(GUIWidget* parent, const CM::String& text, UINT32 fixedWidth, UINT32 fixedHeight = 0, bool wordWrap = false);
 		static GUILabel* create(GUIWidget* parent, const CM::String& text, UINT32 fixedWidth, UINT32 fixedHeight = 0, bool wordWrap = false);
 		static GUILabel* create(GUIWidget* parent, const CM::String& text, UINT32 fixedWidth, UINT32 fixedHeight, bool wordWrap, TextHorzAlign horzAlign, TextVertAlign vertAlign = TVA_Top);
 		static GUILabel* create(GUIWidget* parent, const CM::String& text, UINT32 fixedWidth, UINT32 fixedHeight, bool wordWrap, TextHorzAlign horzAlign, TextVertAlign vertAlign = TVA_Top);
 
 
+		void setText(const CM::String& text);
+
 	protected:
 	protected:
 		~GUILabel();
 		~GUILabel();
 
 
@@ -46,6 +48,7 @@ namespace BansheeEngine
 		bool mWordWrap;
 		bool mWordWrap;
 		TextHorzAlign mHorzAlign;
 		TextHorzAlign mHorzAlign;
 		TextVertAlign mVertAlign;
 		TextVertAlign mVertAlign;
+		TEXT_SPRITE_DESC mDesc;
 
 
 		GUILabel(GUIWidget* parent, const CM::String& text, UINT32 fixedWidth, UINT32 fixedHeight, 
 		GUILabel(GUIWidget* parent, const CM::String& text, UINT32 fixedWidth, UINT32 fixedHeight, 
 			bool wordWrap, TextHorzAlign horzAlign, TextVertAlign vertAlign);
 			bool wordWrap, TextHorzAlign horzAlign, TextVertAlign vertAlign);

+ 21 - 0
BansheeEngine/Include/BsUpdateCallback.h

@@ -0,0 +1,21 @@
+#include "BsPrerequisites.h"
+#include "CmComponent.h"
+
+#include "boost/signal.hpp"
+
+namespace BansheeEngine
+{
+	class BS_EXPORT UpdateCallback : public CM::Component
+	{
+	protected:
+		friend class CM::SceneObject;
+
+		UpdateCallback(const CM::HSceneObject& parent);
+	public:
+		~UpdateCallback();
+
+		virtual void update();
+
+		boost::signal<void()> onUpdate;
+	};
+}

+ 18 - 11
BansheeEngine/Source/BsGUILabel.cpp

@@ -18,17 +18,16 @@ namespace BansheeEngine
 		mStyle = skin->getStyle(getGUITypeName());
 		mStyle = skin->getStyle(getGUITypeName());
 		mTextSprite = CM_NEW(TextSprite, PoolAlloc) TextSprite();
 		mTextSprite = CM_NEW(TextSprite, PoolAlloc) TextSprite();
 
 
-		TEXT_SPRITE_DESC desc;
-		desc.text = text;
-		desc.font = mStyle->font;
-		desc.fontSize = mStyle->fontSize;
-		desc.width = fixedWidth;
-		desc.height = fixedHeight;
-		desc.wordWrap = wordWrap;
-		desc.clipRect = Rect(0, 0, fixedWidth, fixedHeight);
-		desc.horzAlign = horzAlign;
-		desc.vertAlign = vertAlign;
-		mTextSprite->update(desc);
+		mDesc.text = text;
+		mDesc.font = mStyle->font;
+		mDesc.fontSize = mStyle->fontSize;
+		mDesc.width = fixedWidth;
+		mDesc.height = fixedHeight;
+		mDesc.wordWrap = wordWrap;
+		mDesc.clipRect = Rect(0, 0, fixedWidth, fixedHeight);
+		mDesc.horzAlign = horzAlign;
+		mDesc.vertAlign = vertAlign;
+		mTextSprite->update(mDesc);
 
 
 		mBounds = mTextSprite->getBounds();
 		mBounds = mTextSprite->getBounds();
 	}
 	}
@@ -59,6 +58,14 @@ namespace BansheeEngine
 		mTextSprite->fillBuffer(vertices, uv, indices, startingQuad, maxNumQuads, vertexStride, indexStride, renderElementIdx);
 		mTextSprite->fillBuffer(vertices, uv, indices, startingQuad, maxNumQuads, vertexStride, indexStride, renderElementIdx);
 	}
 	}
 
 
+	void GUILabel::setText(const CM::String& text)
+	{
+		mDesc.text = text;
+
+		mTextSprite->update(mDesc);
+		mBounds = mTextSprite->getBounds();
+	}
+
 	GUILabel* GUILabel::create(GUIWidget* parent, const String& text)
 	GUILabel* GUILabel::create(GUIWidget* parent, const String& text)
 	{
 	{
 		return CM_NEW(GUILabel, PoolAlloc) GUILabel(parent, text, 0, 0, false, THA_Left, TVA_Top);
 		return CM_NEW(GUILabel, PoolAlloc) GUILabel(parent, text, 0, 0, false, THA_Left, TVA_Top);

+ 2 - 0
BansheeEngine/Source/BsGUIWidget.cpp

@@ -197,6 +197,8 @@ namespace BansheeEngine
 		// but for now it seems like too much hassle for something like GUI that is pretty dynamic anyway.
 		// but for now it seems like too much hassle for something like GUI that is pretty dynamic anyway.
 		updateMeshes();
 		updateMeshes();
 
 
+		return;
+
 		// Render the meshes
 		// Render the meshes
 		UINT32 meshIdx = 0;
 		UINT32 meshIdx = 0;
 		for(auto& mesh : mCachedMeshes)
 		for(auto& mesh : mCachedMeshes)

+ 25 - 0
BansheeEngine/Source/BsUpdateCallback.cpp

@@ -0,0 +1,25 @@
+#include "BsUpdateCallback.h"
+
+using namespace CamelotFramework;
+
+namespace BansheeEngine
+{
+	UpdateCallback::UpdateCallback(const HSceneObject& parent)
+		:Component(parent)
+	{
+
+	}
+
+	UpdateCallback::~UpdateCallback()
+	{
+
+	}
+
+	void UpdateCallback::update()
+	{
+		if(!onUpdate.empty())
+		{
+			onUpdate();
+		}
+	}
+}

+ 3 - 1
CamelotClient/CamelotClient.cpp

@@ -28,13 +28,14 @@
 #include "CmTestTextSprite.h"
 #include "CmTestTextSprite.h"
 #include "CmEditorWindow.h"
 #include "CmEditorWindow.h"
 #include "CmRTTIType.h"
 #include "CmRTTIType.h"
+#include "CmCursor.h"
 
 
 #define DX11
 #define DX11
 //#define DX9
 //#define DX9
 //#define GL
 //#define GL
 
 
 using namespace CamelotFramework;
 using namespace CamelotFramework;
-using namespace CamelotEditor;
+using namespace BansheeEditor;
 using namespace BansheeEngine;
 using namespace BansheeEngine;
 
 
 int CALLBACK WinMain(
 int CALLBACK WinMain(
@@ -271,6 +272,7 @@ int CALLBACK WinMain(
 
 
 	//// Set the new state for the flag
 	//// Set the new state for the flag
 	//_CrtSetDbgFlag( tmpFlag );
 	//_CrtSetDbgFlag( tmpFlag );
+	Cursor::hide();
 	
 	
 	EditorWindow* newWindow = new EditorWindow("Test window");
 	EditorWindow* newWindow = new EditorWindow("Test window");
 
 

+ 3 - 3
CamelotClient/CmDebugCamera.cpp

@@ -5,7 +5,7 @@
 #include "CmMath.h"
 #include "CmMath.h"
 #include "CmSceneObject.h"
 #include "CmSceneObject.h"
 #include "BsCamera.h"
 #include "BsCamera.h"
-#include "CmOSCursor.h"
+#include "CmCursor.h"
 
 
 using namespace BansheeEngine;
 using namespace BansheeEngine;
 
 
@@ -71,7 +71,7 @@ namespace CamelotFramework
 		{
 		{
 			mCameraRotating = true;
 			mCameraRotating = true;
 
 
-			OSCursor::hide();
+			Cursor::hide();
 		}
 		}
 	}
 	}
 
 
@@ -81,7 +81,7 @@ namespace CamelotFramework
 		{
 		{
 			mCameraRotating = false;
 			mCameraRotating = false;
 
 
-			OSCursor::show();
+			Cursor::show();
 		}
 		}
 	}
 	}
 
 

+ 16 - 3
CamelotClient/CmEditorWindow.cpp

@@ -2,17 +2,19 @@
 #include "CmRenderWindow.h"
 #include "CmRenderWindow.h"
 #include "CmApplication.h"
 #include "CmApplication.h"
 #include "CmSceneObject.h"
 #include "CmSceneObject.h"
+#include "CmCursor.h"
 #include "BsGUIWidget.h"
 #include "BsGUIWidget.h"
 #include "BsGUILabel.h"
 #include "BsGUILabel.h"
 #include "BsGUISkin.h"
 #include "BsGUISkin.h"
 #include "BsOverlayManager.h"
 #include "BsOverlayManager.h"
 #include "BsCamera.h"
 #include "BsCamera.h"
+#include "BsUpdateCallback.h"
 #include "BsEngineGUI.h"
 #include "BsEngineGUI.h"
 
 
 using namespace CamelotFramework;
 using namespace CamelotFramework;
 using namespace BansheeEngine;
 using namespace BansheeEngine;
 
 
-namespace CamelotEditor
+namespace BansheeEditor
 {
 {
 	EditorWindow::EditorWindow(const String& name)
 	EditorWindow::EditorWindow(const String& name)
 	{
 	{
@@ -28,8 +30,12 @@ namespace CamelotEditor
 
 
 		HSceneObject so = SceneObject::create("EditorWindow-" + name);
 		HSceneObject so = SceneObject::create("EditorWindow-" + name);
 		HGUIWidget gui = so->addComponent<GUIWidget>();
 		HGUIWidget gui = so->addComponent<GUIWidget>();
-		HCamera camera = so->addComponent<Camera>();
+		
+		GameObjectHandle<UpdateCallback> updateCallback = so->addComponent<UpdateCallback>();
 
 
+		updateCallback->onUpdate.connect(boost::bind(&EditorWindow::update, this));
+
+		HCamera camera = so->addComponent<Camera>();
 		camera->init(mRenderWindow, 0.0f, 0.0f, 1.0f, 1.0f, 0);
 		camera->init(mRenderWindow, 0.0f, 0.0f, 1.0f, 1.0f, 0);
 		camera->setNearClipDistance(5);
 		camera->setNearClipDistance(5);
 		camera->setAspectRatio(1.0f);
 		camera->setAspectRatio(1.0f);
@@ -49,11 +55,18 @@ namespace CamelotEditor
 		//gui->setSkin(mSkin);
 		//gui->setSkin(mSkin);
 		//// END DEBUG
 		//// END DEBUG
 		gui->setSkin(&EngineGUI::instance().getSkin());
 		gui->setSkin(&EngineGUI::instance().getSkin());
-		GUILabel::create(gui.get(), "Testing test", renderWindowDesc.width);
+		mDbgLabel = GUILabel::create(gui.get(), "Testing test", renderWindowDesc.width);
 	}
 	}
 
 
 	EditorWindow::~EditorWindow()
 	EditorWindow::~EditorWindow()
 	{
 	{
 		mRenderWindow->destroy();
 		mRenderWindow->destroy();
 	}
 	}
+
+	void EditorWindow::update()
+	{
+		Int2 cursorPos = Cursor::getWindowPosition(*mRenderWindow);
+
+		//mDbgLabel->setText(toString(cursorPos.x) + ", " + toString(cursorPos.y));
+	}
 }
 }

+ 5 - 2
CamelotClient/CmEditorWindow.h

@@ -2,7 +2,7 @@
 
 
 #include "BsPrerequisites.h"
 #include "BsPrerequisites.h"
 
 
-namespace CamelotEditor
+namespace BansheeEditor
 {
 {
 	class EditorWindow
 	class EditorWindow
 	{
 	{
@@ -10,9 +10,12 @@ namespace CamelotEditor
 		EditorWindow(const CM::String& name);
 		EditorWindow(const CM::String& name);
 		virtual ~EditorWindow();
 		virtual ~EditorWindow();
 
 
+	protected:
+		virtual void update();
+
 	private:
 	private:
 		CM::RenderWindowPtr mRenderWindow;
 		CM::RenderWindowPtr mRenderWindow;
 
 
-		BS::GUISkin* mSkin; // dbg only
+		BS::GUILabel* mDbgLabel;
 	};
 	};
 }
 }

+ 3 - 3
CamelotCore/CamelotCore.vcxproj

@@ -245,7 +245,7 @@
     <ClInclude Include="Include\CmMeshData.h" />
     <ClInclude Include="Include\CmMeshData.h" />
     <ClInclude Include="Include\CmMeshDataRTTI.h" />
     <ClInclude Include="Include\CmMeshDataRTTI.h" />
     <ClInclude Include="Include\CmMultiRenderTexture.h" />
     <ClInclude Include="Include\CmMultiRenderTexture.h" />
-    <ClInclude Include="Include\CmOSCursor.h" />
+    <ClInclude Include="Include\CmCursor.h" />
     <ClInclude Include="Include\CmPass.h" />
     <ClInclude Include="Include\CmPass.h" />
     <ClInclude Include="Include\CmPassRTTI.h" />
     <ClInclude Include="Include\CmPassRTTI.h" />
     <ClInclude Include="Include\CmPrerequisites.h" />
     <ClInclude Include="Include\CmPrerequisites.h" />
@@ -292,7 +292,7 @@
     <ClInclude Include="Include\targetver.h" />
     <ClInclude Include="Include\targetver.h" />
     <ClInclude Include="Include\CmVertexDeclarationRTTI.h" />
     <ClInclude Include="Include\CmVertexDeclarationRTTI.h" />
     <ClInclude Include="Include\CmTechnique.h" />
     <ClInclude Include="Include\CmTechnique.h" />
-    <ClInclude Include="Include\Win32\CmOSCursorImpl.h" />
+    <ClInclude Include="Include\Win32\CmCursorImpl.h" />
     <ClInclude Include="Source\CmMeshRTTI.h" />
     <ClInclude Include="Source\CmMeshRTTI.h" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -373,7 +373,7 @@
     <ClCompile Include="Source\CmSceneObject.cpp" />
     <ClCompile Include="Source\CmSceneObject.cpp" />
     <ClCompile Include="Source\CmComponent.cpp" />
     <ClCompile Include="Source\CmComponent.cpp" />
     <ClCompile Include="Source\stdafx.cpp" />
     <ClCompile Include="Source\stdafx.cpp" />
-    <ClCompile Include="Source\Win32\CmOSCursorImpl.cpp" />
+    <ClCompile Include="Source\Win32\CmCursorImpl.cpp" />
   </ItemGroup>
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   <ImportGroup Label="ExtensionTargets">

+ 9 - 9
CamelotCore/CamelotCore.vcxproj.filters

@@ -249,12 +249,6 @@
     <ClInclude Include="Include\CmMaterialRTTI.h">
     <ClInclude Include="Include\CmMaterialRTTI.h">
       <Filter>Header Files\RTTI</Filter>
       <Filter>Header Files\RTTI</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="Include\CmOSCursor.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Include\Win32\CmOSCursorImpl.h">
-      <Filter>Header Files\Win32</Filter>
-    </ClInclude>
     <ClInclude Include="Include\CmSamplerState.h">
     <ClInclude Include="Include\CmSamplerState.h">
       <Filter>Header Files\RenderSystem</Filter>
       <Filter>Header Files\RenderSystem</Filter>
     </ClInclude>
     </ClInclude>
@@ -441,6 +435,12 @@
     <ClInclude Include="Include\CmDeferredRenderContextFwd.h">
     <ClInclude Include="Include\CmDeferredRenderContextFwd.h">
       <Filter>Header Files\RenderSystem</Filter>
       <Filter>Header Files\RenderSystem</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="Include\Win32\CmCursorImpl.h">
+      <Filter>Header Files\Win32</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\CmCursor.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\CmApplication.cpp">
     <ClCompile Include="Source\CmApplication.cpp">
@@ -545,9 +545,6 @@
     <ClCompile Include="Source\CmMaterialRTTI.cpp">
     <ClCompile Include="Source\CmMaterialRTTI.cpp">
       <Filter>Source Files\RTTI</Filter>
       <Filter>Source Files\RTTI</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="Source\Win32\CmOSCursorImpl.cpp">
-      <Filter>Source Files\Win32</Filter>
-    </ClCompile>
     <ClCompile Include="Source\CmSamplerState.cpp">
     <ClCompile Include="Source\CmSamplerState.cpp">
       <Filter>Source Files\RenderSystem</Filter>
       <Filter>Source Files\RenderSystem</Filter>
     </ClCompile>
     </ClCompile>
@@ -677,5 +674,8 @@
     <ClCompile Include="Source\CmPixelData.cpp">
     <ClCompile Include="Source\CmPixelData.cpp">
       <Filter>Source Files\Resources</Filter>
       <Filter>Source Files\Resources</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="Source\Win32\CmCursorImpl.cpp">
+      <Filter>Source Files\Win32</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 3 - 3
CamelotCore/Include/CmOSCursor.h → CamelotCore/Include/CmCursor.h

@@ -4,9 +4,9 @@
 
 
 //Bring in the specific platform's header file
 //Bring in the specific platform's header file
 #if CM_PLATFORM == CM_PLATFORM_WIN32
 #if CM_PLATFORM == CM_PLATFORM_WIN32
-# include "Win32/CmOSCursorImpl.h"
+# include "Win32/CmCursorImpl.h"
 #elif (CM_PLATFORM == CM_PLATFORM_LINUX)
 #elif (CM_PLATFORM == CM_PLATFORM_LINUX)
-# include "GLX/CmOSCursorImpl.h"
+# include "GLX/CmCursorImpl.h"
 #elif CM_PLATFORM == CM_PLATFORM_APPLE
 #elif CM_PLATFORM == CM_PLATFORM_APPLE
-# include "OSX/CmOSCursorImpl.h"
+# include "OSX/CmCursorImpl.h"
 #endif
 #endif

+ 24 - 0
CamelotCore/Include/Win32/CmCursorImpl.h

@@ -0,0 +1,24 @@
+#pragma once
+
+#include "CmPrerequisites.h"
+#include "CmInt2.h"
+#include <windows.h>
+
+namespace CamelotFramework
+{
+	/**
+	 * @brief	Provides controls for Windows operating system cursor.
+	 */
+	class CM_EXPORT Cursor
+	{
+	public:
+		static Int2 getScreenPosition();
+		static void setScreenPosition(const Int2& pos);
+
+		static Int2 getWindowPosition(RenderWindow& window);
+		static void setWindowPosition(RenderWindow& window, const Int2& pos);
+
+		static void hide();
+		static void show();
+	};
+}

+ 0 - 21
CamelotCore/Include/Win32/CmOSCursorImpl.h

@@ -1,21 +0,0 @@
-#pragma once
-
-#include "CmPrerequisites.h"
-#include "CmInt2.h"
-#include <windows.h>
-
-namespace CamelotFramework
-{
-	/**
-	 * @brief	Provides controls for Windows operating system cursor.
-	 */
-	class CM_EXPORT OSCursor
-	{
-	public:
-		static Int2 getPosition();
-		static void setPosition(const Int2& pos);
-
-		static void hide();
-		static void show();
-	};
-}

+ 4 - 0
CamelotCore/Source/CmWindowEventUtilities.cpp

@@ -224,6 +224,10 @@ LRESULT CALLBACK WindowEventUtilities::_WndProc(HWND hWnd, UINT uMsg, WPARAM wPa
 		for(index = start; index != end; ++index)
 		for(index = start; index != end; ++index)
 			(index->second)->windowResized(win);
 			(index->second)->windowResized(win);
 		break;
 		break;
+	case WM_SETCURSOR:
+		 //SetCursor(0);
+		 //ShowCursor(FALSE);
+		 break;
 	case WM_GETMINMAXINFO:
 	case WM_GETMINMAXINFO:
 		// Prevent the window from going smaller than some minimu size
 		// Prevent the window from going smaller than some minimu size
 		((MINMAXINFO*)lParam)->ptMinTrackSize.x = 100;
 		((MINMAXINFO*)lParam)->ptMinTrackSize.x = 100;

+ 85 - 0
CamelotCore/Source/Win32/CmCursorImpl.cpp

@@ -0,0 +1,85 @@
+#include "Win32/CmCursorImpl.h"
+#include "CmRenderWindow.h"
+
+namespace CamelotFramework
+{
+	Int2 Cursor::getWindowPosition(RenderWindow& window)
+	{
+		POINT screenPos;
+		GetCursorPos(&screenPos);
+
+		HWND hwnd;
+		window.getCustomAttribute("WINDOW", &hwnd);
+
+		ScreenToClient(hwnd, &screenPos);
+
+		return Int2(screenPos.x, screenPos.y);
+	}
+
+	void Cursor::setWindowPosition(RenderWindow& window, const Int2& pos)
+	{
+		POINT screenPos;
+
+		// Convert client coordinates to screen coordinates
+		screenPos.x = pos.x;
+		screenPos.y = pos.y;
+
+		HWND hwnd;
+		window.getCustomAttribute("WINDOW", &hwnd);
+
+		ClientToScreen(hwnd, &screenPos);
+
+		SetCursorPos(screenPos.x, screenPos.y);
+	}
+
+	static Int2 getScreenPosition()
+	{
+		POINT screenPos;
+		GetCursorPos(&screenPos);
+
+		return Int2(screenPos.x, screenPos.y);
+	}
+
+	static void setScreenPosition(const Int2& pos)
+	{
+		POINT screenPos;
+
+		// Convert client coordinates to screen coordinates
+		screenPos.x = pos.x;
+		screenPos.y = pos.y;
+
+		SetCursorPos(screenPos.x, screenPos.y);
+	}
+
+	void Cursor::hide()
+	{
+		RECT clipWindowRect;
+
+		ShowCursor(FALSE);
+		SetCursor(0);
+
+		//RenderWindowPtr primaryWindow = gApplication().getPrimaryRenderWindow();
+		//HWND hwnd;
+		//primaryWindow->getCustomAttribute("WINDOW", &hwnd);
+
+		//// Clip cursor to the window
+		//if( GetWindowRect(hwnd, &clipWindowRect))
+		//{
+		//	ClipCursor(&clipWindowRect);
+		//}
+
+		//// Capture cursor to user window
+		//SetCapture(hwnd);
+	}
+
+	void Cursor::show()
+	{
+		//// Un-capture cursor
+		//ReleaseCapture();
+
+		//// Release the cursor from the window
+		//ClipCursor(NULL);
+
+		//ShowCursor(TRUE);
+	}
+}

+ 0 - 68
CamelotCore/Source/Win32/CmOSCursorImpl.cpp

@@ -1,68 +0,0 @@
-#include "Win32/CmOSCursorImpl.h"
-#include "CmApplication.h"
-#include "CmRenderWindow.h"
-
-namespace CamelotFramework
-{
-	Int2 OSCursor::getPosition()
-	{
-		POINT screenPos;
-		GetCursorPos(&screenPos);
-
-		RenderWindowPtr primaryWindow = gApplication().getPrimaryRenderWindow();
-		HWND hwnd;
-		primaryWindow->getCustomAttribute("WINDOW", &hwnd);
-
-		ScreenToClient(hwnd, &screenPos);
-
-		return Int2(screenPos.x, screenPos.y);
-	}
-
-	void OSCursor::setPosition(const Int2& pos)
-	{
-		POINT screenPos;
-
-		// Convert client coordinates to screen coordinates
-		screenPos.x = pos.x;
-		screenPos.y = pos.y;
-
-		RenderWindowPtr primaryWindow = gApplication().getPrimaryRenderWindow();
-		HWND hwnd;
-		primaryWindow->getCustomAttribute("WINDOW", &hwnd);
-
-		ClientToScreen(hwnd, &screenPos);
-
-		SetCursorPos(screenPos.x, screenPos.y);
-	}
-
-	void OSCursor::hide()
-	{
-		RECT clipWindowRect;
-
-		ShowCursor( FALSE );
-
-		RenderWindowPtr primaryWindow = gApplication().getPrimaryRenderWindow();
-		HWND hwnd;
-		primaryWindow->getCustomAttribute("WINDOW", &hwnd);
-
-		// Clip cursor to the window
-		if( GetWindowRect(hwnd, &clipWindowRect))
-		{
-			ClipCursor(&clipWindowRect);
-		}
-
-		// Capture cursor to user window
-		SetCapture(hwnd);
-	}
-
-	void OSCursor::show()
-	{
-		// Un-capture cursor
-		ReleaseCapture();
-
-		// Release the cursor from the window
-		ClipCursor(NULL);
-
-		ShowCursor(TRUE);
-	}
-}