浏览代码

Properly set up cursors and their hotspots

Marko Pintera 11 年之前
父节点
当前提交
10f73b4f06

+ 4 - 4
BansheeEditor/Source/BsEditorApplication.cpp

@@ -260,11 +260,11 @@ namespace BansheeEditor
 		//	(UINT32)FolderChange::Creation | (UINT32)FolderChange::LastWrite);
 		//folderMonitor->startMonitor(L"D:\\TestDetect", true, folderChanges);
 
-		HTexture dbgCursor = static_resource_cast<Texture>(Importer::instance().import(L"C:\\CursorDbg.psd"));
-		PixelDataPtr cursorPixelData = dbgCursor->allocateSubresourceBuffer(0);
+		//HTexture dbgCursor = static_resource_cast<Texture>(Importer::instance().import(L"C:\\CursorDbg.psd"));
+		//PixelDataPtr cursorPixelData = dbgCursor->allocateSubresourceBuffer(0);
 
-		gMainSyncedCA().readSubresource(dbgCursor.getInternalPtr(), 0, cursorPixelData);
-		gMainSyncedCA().submitToCoreThread(true);
+		//gMainSyncedCA().readSubresource(dbgCursor.getInternalPtr(), 0, cursorPixelData);
+		//gMainSyncedCA().submitToCoreThread(true);
 
 		/************************************************************************/
 		/* 								MODAL WINDOW                      		*/

+ 4 - 3
BansheeEditor/Source/BsEditorWindowBase.cpp

@@ -1,5 +1,6 @@
 #include "BsEditorWindowBase.h"
 #include "CmApplication.h"
+#include "CmCoreThread.h"
 #include "CmSceneObject.h"
 #include "CmRenderWindow.h"
 
@@ -58,7 +59,7 @@ namespace BansheeEditor
 
 	void EditorWindowBase::hide()
 	{
-		gMainSyncedCA().hideWindow(mRenderWindow);
+		gCoreAccessor().hideWindow(mRenderWindow);
 	}
 
 	void EditorWindowBase::construct(const RenderWindowPtr& renderWindow)
@@ -85,12 +86,12 @@ namespace BansheeEditor
 
 	void EditorWindowBase::setPosition(CM::INT32 x, CM::INT32 y)
 	{
-		gMainCA().moveWindow(mRenderWindow, x, y);
+		gCoreAccessor().moveWindow(mRenderWindow, x, y);
 	}
 
 	void EditorWindowBase::setSize(CM::UINT32 width, CM::UINT32 height)
 	{
-		gMainCA().resizeWindow(mRenderWindow, width, height);
+		gCoreAccessor().resizeWindow(mRenderWindow, width, height);
 	}
 
 	INT32 EditorWindowBase::getLeft() const

+ 41 - 4
BansheeEngine/Include/BsBuiltinResources.h

@@ -3,9 +3,12 @@
 #include "BsPrerequisites.h"
 #include "BsGUISkin.h"
 #include "CmModule.h"
+#include "CmVector2I.h"
 
 namespace BansheeEngine
 {
+	// TODO - Currently this class will always import resources, but it would be better if it first
+	// checks for a pre-processed asset and only import it if that doesn't exist
 	class BS_EXPORT BuiltinResources : public CamelotFramework::Module<BuiltinResources>
 	{
 	public:
@@ -14,10 +17,9 @@ namespace BansheeEngine
 		const GUISkin& getSkin() const { return mSkin; }
 
 		const CM::PixelData& getCursorArrow(CM::Vector2I& hotSpot);
+		const CM::PixelData& getCursorArrowDrag(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);
@@ -28,7 +30,19 @@ namespace BansheeEngine
 	private:
 		GUISkin mSkin;
 
-		static const CM::WString DefaultFolder;
+		CM::PixelDataPtr mCursorArrow;
+		CM::PixelDataPtr mCursorArrowDrag;
+		CM::PixelDataPtr mCursorArrowLeftRight;
+		CM::PixelDataPtr mCursorIBeam;
+		CM::PixelDataPtr mCursorDeny;
+		CM::PixelDataPtr mCursorWait;
+		CM::PixelDataPtr mCursorSizeNESW;
+		CM::PixelDataPtr mCursorSizeNS;
+		CM::PixelDataPtr mCursorSizeNWSE;
+		CM::PixelDataPtr mCursorSizeWE;
+
+		static const CM::WString DefaultSkinFolder;
+		static const CM::WString DefaultCursorFolder;
 
 		static const CM::WString DefaultFontPath;
 		static const CM::UINT32 DefaultFontSize;
@@ -87,6 +101,29 @@ namespace BansheeEngine
 		static const CM::WString DropDownBoxBtnUpArrowTex;
 		static const CM::WString DropDownBoxBtnDownArrowTex;
 
-		static HSpriteTexture getTexture(const CM::WString& name);
+		static const CM::WString CursorArrowTex;
+		static const CM::WString CursorArrowDragTex;
+		static const CM::WString CursorArrowLeftRightTex;
+		static const CM::WString CursorIBeamTex;
+		static const CM::WString CursorDenyTex;
+		static const CM::WString CursorWaitTex;
+		static const CM::WString CursorSizeNESWTex;
+		static const CM::WString CursorSizeNSTex;
+		static const CM::WString CursorSizeNWSETex;
+		static const CM::WString CursorSizeWETex;
+
+		static const CM::Vector2I CursorArrowHotspot;
+		static const CM::Vector2I CursorArrowDragHotspot;
+		static const CM::Vector2I CursorArrowLeftRightHotspot;
+		static const CM::Vector2I CursorIBeamHotspot;
+		static const CM::Vector2I CursorDenyHotspot;
+		static const CM::Vector2I CursorWaitHotspot;
+		static const CM::Vector2I CursorSizeNESWHotspot;
+		static const CM::Vector2I CursorSizeNSHotspot;
+		static const CM::Vector2I CursorSizeNWSEHotspot;
+		static const CM::Vector2I CursorSizeWEHotspot;
+
+		static HSpriteTexture getSkinTexture(const CM::WString& name);
+		static CM::HTexture getCursorTexture(const CM::WString& name);
 	};
 }

+ 133 - 0
BansheeEngine/Include/BsCursor.h

@@ -0,0 +1,133 @@
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "CmModule.h"
+#include "CmPixelData.h"
+#include "CmVector2I.h"
+
+namespace BansheeEngine
+{
+	enum class CursorType
+	{
+		Arrow,
+		ArrowDrag,
+		ArrowLeftRight,
+		Wait,
+		IBeam,
+		SizeNESW,
+		SizeNS,
+		SizeNWSE,
+		SizeWE,
+		Deny,
+
+		// Keep at the end
+		Count
+	};
+
+	/**
+	 * @brief	Allows you to manipulate the platform cursor in various ways.
+	 * 			
+	 * @note	Thread safe.
+	 */
+	class BS_EXPORT Cursor : public CM::Module<Cursor>
+	{
+		struct CustomIcon
+		{
+			CustomIcon() {}
+			CustomIcon(const CM::PixelData& pixelData, const CM::Vector2I& hotSpot)
+				:hotSpot(hotSpot), pixelData(pixelData)
+			{ }
+
+			CM::Vector2I hotSpot;
+			CM::PixelData pixelData;
+		};
+
+	public:
+		Cursor();
+
+		/**
+		 * @brief	Moves the cursor to the specified screen position.
+		 */
+		void move(const CM::Vector2I& screenPos);
+
+		/**
+		 * @brief	Hides the cursor.
+		 */
+		void hide();
+
+		/**
+		 * @brief	Shows the cursor.
+		 */
+		void show();
+
+		/**
+		 * @brief	Limit cursor movement to the specified window.
+		 */
+		void clipToWindow(const CM::RenderWindow& window);
+
+		/**
+		 * @brief	Limit cursor movement to specific area on the screen.
+		 */
+		void clipToRect(const CM::RectI& screenRect);
+
+		/**
+		 * @brief	Disables cursor clipping that was set using any of the "clipTo*" methods.
+		 */
+		void clipDisable();
+		
+		/**
+		 * @brief	Sets a cursor icon. Uses one of the built-in cursor types.
+		 */
+		void setCursor(CursorType type);
+
+		/**
+		 * @brief	Sets a cursor icon. Uses one of the manually registered icons.
+		 * 			
+		 * @param	name		The name to identify the cursor, one set previously by calling "addCursorIcon".
+		 */
+		void setCursor(const CM::String& name);
+
+		/**
+		 * @brief	Registers a new custom cursor icon you can then set by calling "setCursor".
+		 *
+		 * @param	name		The name to identify the cursor.
+		 * @param 	pixelData	Cursor image data.
+		 * @param	hotSpot		Offset on the cursor image to where the actual input happens (e.g. tip of the Arrow cursor).
+		 * 						
+		 * @note	Stores an internal copy of the pixel data. Clear it by calling "removeCursorIcon".
+		 * 			If a custom icon with the same name already exists it will be replaced.
+		 */
+		void setCursorIcon(const CM::String& name, const CM::PixelData& pixelData, const CM::Vector2I& hotSpot);
+
+		/**
+		 * @brief	Registers a new custom cursor icon you can then set by calling "setCursor".
+		 *
+		 * @param	type		One of the built-in cursor types.
+		 * @param 	pixelData	Cursor image data.
+		 * @param	hotSpot		Offset on the cursor image to where the actual input happens (e.g. tip of the Arrow cursor).
+		 * 						
+		 * @note	Stores an internal copy of the pixel data. Clear it by calling "removeCursorIcon".
+		 * 			If a custom icon with the same type already exists it will be replaced.
+		 */
+		void setCursorIcon(CursorType type, const CM::PixelData& pixelData, const CM::Vector2I& hotSpot);
+
+		/**
+		 * @brief	Removes a custom cursor icon and releases any data associated with it.
+		 */
+		void clearCursorIcon(const CM::String& name);
+
+		/**
+		 * @brief	Removes a custom cursor icon and releases any data associated with it. Restores
+		 * 			original icon associated with this cursor type.
+		 */
+		void clearCursorIcon(CursorType type);
+
+	private:
+		CM::UnorderedMap<CM::String, CM::UINT32>::type mCustomIconNameToId;
+		CM::UnorderedMap<CM::UINT32, CustomIcon>::type mCustomIcons;
+		CM::UINT32 mNextUniqueId;
+		CM::UINT32 mActiveCursorId;
+
+		void restoreCursorIcon(CursorType type);
+	};
+}

+ 2 - 0
BansheeEngine/Source/BsApplication.cpp

@@ -62,6 +62,8 @@ namespace BansheeEngine
 		CM::gApplication().loadPlugin("SBansheeEngine", &mSBansheeEnginePlugin); // Scripting interface
 		
 		updateCallbackConn = CM::gApplication().mainLoopCallback.connect(boost::bind(&Application::update, this));
+
+		Cursor::instance().setCursor(CursorType::Arrow);
 	}
 
 	void Application::runMainLoop()

+ 139 - 58
BansheeEngine/Source/BsBuiltinResources.cpp

@@ -12,6 +12,7 @@
 #include "CmImporter.h"
 #include "CmRTTIType.h"
 #include "CmFileSystem.h"
+#include "CmApplication.h"
 
 using namespace CamelotFramework;
 
@@ -20,7 +21,8 @@ namespace BansheeEngine
 	const WString BuiltinResources::DefaultFontPath = L"arial.ttf";
 	const UINT32 BuiltinResources::DefaultFontSize = 10;
 
-	const WString BuiltinResources::DefaultFolder = L"..\\..\\..\\..\\Data\\Engine\\Skin\\";
+	const WString BuiltinResources::DefaultSkinFolder = L"..\\..\\..\\..\\Data\\Engine\\Skin\\";
+	const WString BuiltinResources::DefaultCursorFolder = L"..\\..\\..\\..\\Data\\Engine\\Cursors\\";
 
 	const WString BuiltinResources::ButtonNormalTex = L"ButtonNormal.psd";
 	const WString BuiltinResources::ButtonHoverTex = L"ButtonHover.psd";
@@ -76,16 +78,85 @@ namespace BansheeEngine
 
 	const WString BuiltinResources::ScrollBarBgTex = L"ScrollBarBg.psd";
 
+	const WString BuiltinResources::CursorArrowTex = L"Arrow.psd";
+	const WString BuiltinResources::CursorArrowDragTex = L"ArrowDrag.psd";
+	const WString BuiltinResources::CursorArrowLeftRightTex = L"ArrowLeftRight.psd";
+	const WString BuiltinResources::CursorIBeamTex = L"IBeam.psd";
+	const WString BuiltinResources::CursorDenyTex = L"Deny.psd";
+	const WString BuiltinResources::CursorWaitTex = L"Wait.psd";
+	const WString BuiltinResources::CursorSizeNESWTex = L"SizeNESW.psd";
+	const WString BuiltinResources::CursorSizeNSTex = L"SizeNS.psd";
+	const WString BuiltinResources::CursorSizeNWSETex = L"SizeNWSE.psd";
+	const WString BuiltinResources::CursorSizeWETex = L"SizeWE.psd";
+
+	const Vector2I BuiltinResources::CursorArrowHotspot = Vector2I(11, 8);
+	const Vector2I BuiltinResources::CursorArrowDragHotspot = Vector2I(11, 8);
+	const Vector2I BuiltinResources::CursorArrowLeftRightHotspot = Vector2I(9, 4);
+	const Vector2I BuiltinResources::CursorIBeamHotspot = Vector2I(15, 15);
+	const Vector2I BuiltinResources::CursorDenyHotspot = Vector2I(15, 15);
+	const Vector2I BuiltinResources::CursorWaitHotspot = Vector2I(15, 15);
+	const Vector2I BuiltinResources::CursorSizeNESWHotspot = Vector2I(15, 15);
+	const Vector2I BuiltinResources::CursorSizeNSHotspot = Vector2I(15, 15);
+	const Vector2I BuiltinResources::CursorSizeNWSEHotspot = Vector2I(15, 15);
+	const Vector2I BuiltinResources::CursorSizeWEHotspot = Vector2I(15, 15);
+
 	BuiltinResources::BuiltinResources()
 	{
 		// TODO - Normally I want to load this from some file
 		
+		/************************************************************************/
+		/* 								CURSOR		                     		*/
+		/************************************************************************/
+
+		HTexture cursorArrowTex = getCursorTexture(CursorArrowTex);
+		HTexture cursorArrowDragTex = getCursorTexture(CursorArrowDragTex);
+		HTexture cursorArrowLeftRightTex = getCursorTexture(CursorArrowLeftRightTex);
+		HTexture cursorIBeamTex = getCursorTexture(CursorIBeamTex);
+		HTexture cursorDenyTex = getCursorTexture(CursorDenyTex);
+		HTexture cursorWaitTex = getCursorTexture(CursorWaitTex);
+		HTexture cursorSizeNESWTex = getCursorTexture(CursorSizeNESWTex);
+		HTexture cursorSizeNSTex = getCursorTexture(CursorSizeNSTex);
+		HTexture cursorSizeNWSETex = getCursorTexture(CursorSizeNWSETex);
+		HTexture cursorSizeWETex = getCursorTexture(CursorSizeWETex);
+
+		mCursorArrow = cursorArrowTex->allocateSubresourceBuffer(0);
+		gSyncedCoreAccessor().readSubresource(cursorArrowTex.getInternalPtr(), 0, mCursorArrow);
+
+		mCursorArrowDrag = cursorArrowDragTex->allocateSubresourceBuffer(0);
+		gSyncedCoreAccessor().readSubresource(cursorArrowDragTex.getInternalPtr(), 0, mCursorArrowDrag);
+
+		mCursorArrowLeftRight = cursorArrowLeftRightTex->allocateSubresourceBuffer(0);
+		gSyncedCoreAccessor().readSubresource(cursorArrowLeftRightTex.getInternalPtr(), 0, mCursorArrowLeftRight);
+
+		mCursorIBeam = cursorIBeamTex->allocateSubresourceBuffer(0);
+		gSyncedCoreAccessor().readSubresource(cursorIBeamTex.getInternalPtr(), 0, mCursorIBeam);
+
+		mCursorDeny = cursorDenyTex->allocateSubresourceBuffer(0);
+		gSyncedCoreAccessor().readSubresource(cursorDenyTex.getInternalPtr(), 0, mCursorDeny);
+
+		mCursorWait = cursorWaitTex->allocateSubresourceBuffer(0);
+		gSyncedCoreAccessor().readSubresource(cursorWaitTex.getInternalPtr(), 0, mCursorWait);
+
+		mCursorSizeNESW = cursorSizeNESWTex->allocateSubresourceBuffer(0);
+		gSyncedCoreAccessor().readSubresource(cursorSizeNESWTex.getInternalPtr(), 0, mCursorSizeNESW);
+
+		mCursorSizeNS = cursorSizeNSTex->allocateSubresourceBuffer(0);
+		gSyncedCoreAccessor().readSubresource(cursorSizeNSTex.getInternalPtr(), 0, mCursorSizeNS);
+
+		mCursorSizeNWSE = cursorSizeNWSETex->allocateSubresourceBuffer(0);
+		gSyncedCoreAccessor().readSubresource(cursorSizeNWSETex.getInternalPtr(), 0, mCursorSizeNWSE);
+
+		mCursorSizeWE = cursorSizeWETex->allocateSubresourceBuffer(0);
+		gSyncedCoreAccessor().readSubresource(cursorSizeWETex.getInternalPtr(), 0, mCursorSizeWE);
+
+		gSyncedCoreAccessor().submitToCoreThread(true);
+
 		// Label
 		// TODO - Instead of importing font every time, try to save a resource and then just load it?
 		HFont font;
 
 		{
-			WString fontPath = DefaultFolder + DefaultFontPath;
+			WString fontPath = DefaultSkinFolder + DefaultFontPath;
 			ImportOptionsPtr fontImportOptions = Importer::instance().createImportOptions(fontPath);
 			if(rtti_is_of_type<FontImportOptions>(fontImportOptions))
 			{
@@ -112,8 +183,8 @@ namespace BansheeEngine
 
 		// Button
 		GUIElementStyle buttonStyle;
-		buttonStyle.normal.texture = getTexture(ButtonNormalTex);
-		buttonStyle.hover.texture = getTexture(ButtonHoverTex);
+		buttonStyle.normal.texture = getSkinTexture(ButtonNormalTex);
+		buttonStyle.hover.texture = getSkinTexture(ButtonHoverTex);
 		buttonStyle.active.texture = buttonStyle.hover.texture;
 		buttonStyle.border.left = 5;
 		buttonStyle.border.right = 5;
@@ -137,9 +208,9 @@ namespace BansheeEngine
 
 		// Input box
 		GUIElementStyle inputBoxStyle;
-		inputBoxStyle.normal.texture = getTexture(InputBoxNormalTex);
-		inputBoxStyle.hover.texture = getTexture(InputBoxHoverTex);
-		inputBoxStyle.focused.texture = getTexture(InputBoxFocusedTex);
+		inputBoxStyle.normal.texture = getSkinTexture(InputBoxNormalTex);
+		inputBoxStyle.hover.texture = getSkinTexture(InputBoxHoverTex);
+		inputBoxStyle.focused.texture = getSkinTexture(InputBoxFocusedTex);
 		inputBoxStyle.active.texture = inputBoxStyle.normal.texture;
 		inputBoxStyle.border.left = 5;
 		inputBoxStyle.border.right = 5;
@@ -167,9 +238,9 @@ namespace BansheeEngine
 
 		// Up button
 		GUIElementStyle scrollUpBtnStyle;
-		scrollUpBtnStyle.normal.texture = getTexture(ScrollBarUpNormalTex);
-		scrollUpBtnStyle.hover.texture = getTexture(ScrollBarUpHoverTex);
-		scrollUpBtnStyle.active.texture = getTexture(ScrollBarUpActiveTex);
+		scrollUpBtnStyle.normal.texture = getSkinTexture(ScrollBarUpNormalTex);
+		scrollUpBtnStyle.hover.texture = getSkinTexture(ScrollBarUpHoverTex);
+		scrollUpBtnStyle.active.texture = getSkinTexture(ScrollBarUpActiveTex);
 		scrollUpBtnStyle.fixedHeight = true;
 		scrollUpBtnStyle.fixedWidth = true;
 		scrollUpBtnStyle.height = 4;
@@ -179,9 +250,9 @@ namespace BansheeEngine
 
 		// Down button
 		GUIElementStyle scrollDownBtnStyle;
-		scrollDownBtnStyle.normal.texture = getTexture(ScrollBarDownNormalTex);
-		scrollDownBtnStyle.hover.texture = getTexture(ScrollBarDownHoverTex);
-		scrollDownBtnStyle.active.texture = getTexture(ScrollBarDownActiveTex);
+		scrollDownBtnStyle.normal.texture = getSkinTexture(ScrollBarDownNormalTex);
+		scrollDownBtnStyle.hover.texture = getSkinTexture(ScrollBarDownHoverTex);
+		scrollDownBtnStyle.active.texture = getSkinTexture(ScrollBarDownActiveTex);
 		scrollDownBtnStyle.fixedHeight = true;
 		scrollDownBtnStyle.fixedWidth = true;
 		scrollDownBtnStyle.height = 4;
@@ -191,9 +262,9 @@ namespace BansheeEngine
 
 		// Left button
 		GUIElementStyle scrollLeftBtnStyle;
-		scrollLeftBtnStyle.normal.texture = getTexture(ScrollBarLeftNormalTex);
-		scrollLeftBtnStyle.hover.texture = getTexture(ScrollBarLeftHoverTex);
-		scrollLeftBtnStyle.active.texture = getTexture(ScrollBarLeftActiveTex);
+		scrollLeftBtnStyle.normal.texture = getSkinTexture(ScrollBarLeftNormalTex);
+		scrollLeftBtnStyle.hover.texture = getSkinTexture(ScrollBarLeftHoverTex);
+		scrollLeftBtnStyle.active.texture = getSkinTexture(ScrollBarLeftActiveTex);
 		scrollLeftBtnStyle.fixedHeight = true;
 		scrollLeftBtnStyle.fixedWidth = true;
 		scrollLeftBtnStyle.height = 8;
@@ -203,9 +274,9 @@ namespace BansheeEngine
 
 		// Right button
 		GUIElementStyle scrollRightBtnStyle;
-		scrollRightBtnStyle.normal.texture = getTexture(ScrollBarRightNormalTex);
-		scrollRightBtnStyle.hover.texture = getTexture(ScrollBarRightHoverTex);
-		scrollRightBtnStyle.active.texture = getTexture(ScrollBarRightActiveTex);
+		scrollRightBtnStyle.normal.texture = getSkinTexture(ScrollBarRightNormalTex);
+		scrollRightBtnStyle.hover.texture = getSkinTexture(ScrollBarRightHoverTex);
+		scrollRightBtnStyle.active.texture = getSkinTexture(ScrollBarRightActiveTex);
 		scrollRightBtnStyle.fixedHeight = true;
 		scrollRightBtnStyle.fixedWidth = true;
 		scrollRightBtnStyle.height = 8;
@@ -215,9 +286,9 @@ namespace BansheeEngine
 
 		// Horizontal handle
 		GUIElementStyle scrollBarHorzBtnStyle;
-		scrollBarHorzBtnStyle.normal.texture = getTexture(ScrollBarHandleHorzNormalTex);
-		scrollBarHorzBtnStyle.hover.texture = getTexture(ScrollBarHandleHorzHoverTex);
-		scrollBarHorzBtnStyle.active.texture = getTexture(ScrollBarHandleHorzActiveTex);
+		scrollBarHorzBtnStyle.normal.texture = getSkinTexture(ScrollBarHandleHorzNormalTex);
+		scrollBarHorzBtnStyle.hover.texture = getSkinTexture(ScrollBarHandleHorzHoverTex);
+		scrollBarHorzBtnStyle.active.texture = getSkinTexture(ScrollBarHandleHorzActiveTex);
 		scrollBarHorzBtnStyle.fixedHeight = true;
 		scrollBarHorzBtnStyle.fixedWidth = true;
 		scrollBarHorzBtnStyle.height = 6;
@@ -227,9 +298,9 @@ namespace BansheeEngine
 
 		// Vertical handle
 		GUIElementStyle scrollBarVertBtnStyle;
-		scrollBarVertBtnStyle.normal.texture = getTexture(ScrollBarHandleVertNormalTex);
-		scrollBarVertBtnStyle.hover.texture = getTexture(ScrollBarHandleVertHoverTex);
-		scrollBarVertBtnStyle.active.texture = getTexture(ScrollBarHandleVertActiveTex);
+		scrollBarVertBtnStyle.normal.texture = getSkinTexture(ScrollBarHandleVertNormalTex);
+		scrollBarVertBtnStyle.hover.texture = getSkinTexture(ScrollBarHandleVertHoverTex);
+		scrollBarVertBtnStyle.active.texture = getSkinTexture(ScrollBarHandleVertActiveTex);
 		scrollBarVertBtnStyle.fixedHeight = true;
 		scrollBarVertBtnStyle.fixedWidth = true;
 		scrollBarVertBtnStyle.height = 4;
@@ -237,7 +308,7 @@ namespace BansheeEngine
 
 		mSkin.setStyle("ScrollBarVertBtn", scrollBarVertBtnStyle);
 
-		HSpriteTexture scrollBarBgPtr = getTexture(ScrollBarBgTex);
+		HSpriteTexture scrollBarBgPtr = getSkinTexture(ScrollBarBgTex);
 
 		// Vertical scroll bar
 		GUIElementStyle vertScrollBarStyle;
@@ -269,8 +340,8 @@ namespace BansheeEngine
 
 		// ListBox button
 		GUIElementStyle dropDownListStyle;
-		dropDownListStyle.normal.texture = getTexture(DropDownBtnNormalTex);
-		dropDownListStyle.hover.texture = getTexture(DropDownBtnHoverTex);
+		dropDownListStyle.normal.texture = getSkinTexture(DropDownBtnNormalTex);
+		dropDownListStyle.hover.texture = getSkinTexture(DropDownBtnHoverTex);
 		dropDownListStyle.active.texture = dropDownListStyle.hover.texture;
 		dropDownListStyle.normalOn.texture = dropDownListStyle.hover.texture;
 		dropDownListStyle.hoverOn.texture = dropDownListStyle.hover.texture;
@@ -296,7 +367,7 @@ namespace BansheeEngine
 
 		// DropDown scroll up button arrow
 		GUIElementStyle dropDownScrollUpBtnArrowStyle;
-		dropDownScrollUpBtnArrowStyle.normal.texture = getTexture(DropDownBoxBtnUpArrowTex);
+		dropDownScrollUpBtnArrowStyle.normal.texture = getSkinTexture(DropDownBoxBtnUpArrowTex);
 		dropDownScrollUpBtnArrowStyle.hover.texture = dropDownScrollUpBtnArrowStyle.normal.texture;
 		dropDownScrollUpBtnArrowStyle.active.texture = dropDownScrollUpBtnArrowStyle.hover.texture;
 		dropDownScrollUpBtnArrowStyle.fixedHeight = true;
@@ -314,8 +385,8 @@ namespace BansheeEngine
 
 		// DropDown scroll up button
 		GUIElementStyle dropDownScrollUpBtnStyle;
-		dropDownScrollUpBtnStyle.normal.texture = getTexture(DropDownBoxBtnUpNormalTex);
-		dropDownScrollUpBtnStyle.hover.texture = getTexture(DropDownBoxBtnUpHoverTex);
+		dropDownScrollUpBtnStyle.normal.texture = getSkinTexture(DropDownBoxBtnUpNormalTex);
+		dropDownScrollUpBtnStyle.hover.texture = getSkinTexture(DropDownBoxBtnUpHoverTex);
 		dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
 		dropDownScrollUpBtnStyle.fixedHeight = true;
 		dropDownScrollUpBtnStyle.fixedWidth = false;
@@ -332,7 +403,7 @@ namespace BansheeEngine
 
 		// DropDown scroll down button arrow
 		GUIElementStyle dropDownScrollDownBtnArrowStyle;
-		dropDownScrollDownBtnArrowStyle.normal.texture = getTexture(DropDownBoxBtnDownArrowTex);
+		dropDownScrollDownBtnArrowStyle.normal.texture = getSkinTexture(DropDownBoxBtnDownArrowTex);
 		dropDownScrollDownBtnArrowStyle.hover.texture = dropDownScrollDownBtnArrowStyle.normal.texture;
 		dropDownScrollDownBtnArrowStyle.active.texture = dropDownScrollDownBtnArrowStyle.hover.texture;
 		dropDownScrollDownBtnArrowStyle.fixedHeight = true;
@@ -350,8 +421,8 @@ namespace BansheeEngine
 
 		// DropDown scroll down button
 		GUIElementStyle dropDownScrollDownBtnStyle;
-		dropDownScrollDownBtnStyle.normal.texture = getTexture(DropDownBoxBtnDownNormalTex);
-		dropDownScrollDownBtnStyle.hover.texture = getTexture(DropDownBoxBtnDownHoverTex);
+		dropDownScrollDownBtnStyle.normal.texture = getSkinTexture(DropDownBoxBtnDownNormalTex);
+		dropDownScrollDownBtnStyle.hover.texture = getSkinTexture(DropDownBoxBtnDownHoverTex);
 		dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
 		dropDownScrollDownBtnStyle.fixedHeight = true;
 		dropDownScrollDownBtnStyle.fixedWidth = false;
@@ -368,8 +439,8 @@ namespace BansheeEngine
 
 		// DropDown entry button
 		GUIElementStyle dropDownEntryBtnStyle;
-		dropDownEntryBtnStyle.normal.texture = getTexture(DropDownBoxEntryNormalTex);
-		dropDownEntryBtnStyle.hover.texture = getTexture(DropDownBoxEntryHoverTex);
+		dropDownEntryBtnStyle.normal.texture = getSkinTexture(DropDownBoxEntryNormalTex);
+		dropDownEntryBtnStyle.hover.texture = getSkinTexture(DropDownBoxEntryHoverTex);
 		dropDownEntryBtnStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
 		dropDownEntryBtnStyle.fixedHeight = true;
 		dropDownEntryBtnStyle.fixedWidth = false;
@@ -390,8 +461,8 @@ namespace BansheeEngine
 
 		// DropDown entry button with expand
 		GUIElementStyle dropDownEntryExpBtnStyle;
-		dropDownEntryExpBtnStyle.normal.texture = getTexture(DropDownBoxEntryExpNormalTex);
-		dropDownEntryExpBtnStyle.hover.texture = getTexture(DropDownBoxEntryExpHoverTex);
+		dropDownEntryExpBtnStyle.normal.texture = getSkinTexture(DropDownBoxEntryExpNormalTex);
+		dropDownEntryExpBtnStyle.hover.texture = getSkinTexture(DropDownBoxEntryExpHoverTex);
 		dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
 		dropDownEntryExpBtnStyle.fixedHeight = true;
 		dropDownEntryExpBtnStyle.fixedWidth = false;
@@ -412,7 +483,7 @@ namespace BansheeEngine
 
 		// DropDown box frame
 		GUIElementStyle dropDownBoxStyle;
-		dropDownBoxStyle.normal.texture = getTexture(DropDownBoxBgTex);
+		dropDownBoxStyle.normal.texture = getSkinTexture(DropDownBoxBgTex);
 		dropDownBoxStyle.hover.texture = dropDownEntryBtnStyle.normal.texture;
 		dropDownBoxStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
 		dropDownBoxStyle.fixedHeight = false;
@@ -432,7 +503,7 @@ namespace BansheeEngine
 
 		// Drop down separator
 		GUIElementStyle dropDownSeparatorStyle;
-		dropDownSeparatorStyle.normal.texture = getTexture(DropDownSeparatorTex);
+		dropDownSeparatorStyle.normal.texture = getSkinTexture(DropDownSeparatorTex);
 		dropDownSeparatorStyle.fixedHeight = true;
 		dropDownSeparatorStyle.fixedWidth = false;
 		dropDownSeparatorStyle.height = 3;
@@ -447,63 +518,73 @@ namespace BansheeEngine
 		mSkin.setStyle("ContextMenuSeparator", dropDownSeparatorStyle);
 	}
 
-	HSpriteTexture BuiltinResources::getTexture(const CM::WString& name)
+	HSpriteTexture BuiltinResources::getSkinTexture(const CM::WString& name)
 	{
-		return SpriteTexture::create(static_resource_cast<Texture>(Importer::instance().import(FileSystem::getWorkingDirectoryPath() + L"\\" + DefaultFolder + name)));
+		return SpriteTexture::create(static_resource_cast<Texture>(Importer::instance().import(FileSystem::getWorkingDirectoryPath() + L"\\" + DefaultSkinFolder + name)));
 	}
 
-	const CM::PixelData& BuiltinResources::getCursorArrow(Vector2I& hotSpot)
+	HTexture BuiltinResources::getCursorTexture(const CM::WString& name)
 	{
-		CM_EXCEPT(NotImplementedException, "Not implemented");
+		return static_resource_cast<Texture>(Importer::instance().import(FileSystem::getWorkingDirectoryPath() + L"\\" + DefaultCursorFolder + name));
 	}
 
-	const CM::PixelData& BuiltinResources::getCursorWait(Vector2I& hotSpot)
+	const CM::PixelData& BuiltinResources::getCursorArrow(Vector2I& hotSpot)
 	{
-		CM_EXCEPT(NotImplementedException, "Not implemented");
+		hotSpot = CursorArrowHotspot;
+		return *mCursorArrow.get();
 	}
 
-	const CM::PixelData& BuiltinResources::getCursorIBeam(Vector2I& hotSpot)
+	const CM::PixelData& BuiltinResources::getCursorArrowDrag(Vector2I& hotSpot)
 	{
-		CM_EXCEPT(NotImplementedException, "Not implemented");
+		hotSpot = CursorArrowDragHotspot;
+		return *mCursorArrowDrag.get();
 	}
 
-	const CM::PixelData& BuiltinResources::getCursorHand(Vector2I& hotSpot)
+	const CM::PixelData& BuiltinResources::getCursorWait(Vector2I& hotSpot)
 	{
-		CM_EXCEPT(NotImplementedException, "Not implemented");
+		hotSpot = CursorWaitHotspot;
+		return *mCursorWait.get();
 	}
 
-	const CM::PixelData& BuiltinResources::getCursorSizeAll(Vector2I& hotSpot)
+	const CM::PixelData& BuiltinResources::getCursorIBeam(Vector2I& hotSpot)
 	{
-		CM_EXCEPT(NotImplementedException, "Not implemented");
+		hotSpot = CursorIBeamHotspot;
+		return *mCursorIBeam.get();
 	}
 
 	const CM::PixelData& BuiltinResources::getCursorSizeNESW(Vector2I& hotSpot)
 	{
-		CM_EXCEPT(NotImplementedException, "Not implemented");
+		hotSpot = CursorSizeNESWHotspot;
+		return *mCursorSizeNESW.get();
 	}
 
 	const CM::PixelData& BuiltinResources::getCursorSizeNS(Vector2I& hotSpot)
 	{
-		CM_EXCEPT(NotImplementedException, "Not implemented");
+		hotSpot = CursorSizeNSHotspot;
+		return *mCursorSizeNS.get();
 	}
 
 	const CM::PixelData& BuiltinResources::getCursorSizeNWSE(Vector2I& hotSpot)
 	{
-		CM_EXCEPT(NotImplementedException, "Not implemented");
+		hotSpot = CursorSizeNWSEHotspot;
+		return *mCursorSizeNWSE.get();
 	}
 
 	const CM::PixelData& BuiltinResources::getCursorSizeWE(Vector2I& hotSpot)
 	{
-		CM_EXCEPT(NotImplementedException, "Not implemented");
+		hotSpot = CursorSizeWEHotspot;
+		return *mCursorSizeWE.get();
 	}
 
 	const CM::PixelData& BuiltinResources::getCursorDeny(Vector2I& hotSpot)
 	{
-		CM_EXCEPT(NotImplementedException, "Not implemented");
+		hotSpot = CursorDenyHotspot;
+		return *mCursorDeny.get();
 	}
 
 	const CM::PixelData& BuiltinResources::getCursorMoveLeftRight(Vector2I& hotSpot)
 	{
-		CM_EXCEPT(NotImplementedException, "Not implemented");
+		hotSpot = CursorArrowLeftRightHotspot;
+		return *mCursorArrowLeftRight.get();
 	}
 }

+ 164 - 0
BansheeEngine/Source/BsCursor.cpp

@@ -0,0 +1,164 @@
+#include "BsCursor.h"
+#include "CmPlatform.h"
+#include "CmException.h"
+#include "BsBuiltinResources.h"
+
+using namespace CamelotFramework;
+
+namespace BansheeEngine
+{
+	Cursor::Cursor()
+		:mActiveCursorId(0), mNextUniqueId((UINT32)CursorType::Count)
+	{
+		for(UINT32 i = 0; i < (UINT32)CursorType::Count; i++)
+			restoreCursorIcon((CursorType)i);
+
+		setCursor(CursorType::Arrow);
+	}
+
+	void Cursor::move(const Vector2I& screenPos)
+	{
+		Platform::setCursorPosition(screenPos);
+	}
+
+	void Cursor::hide()
+	{
+		Platform::hideCursor();
+	}
+
+	void Cursor::show()
+	{
+		Platform::showCursor();
+	}
+
+	void Cursor::clipToWindow(const RenderWindow& window)
+	{
+		Platform::clipCursorToWindow(window);
+	}
+
+	void Cursor::clipToRect(const RectI& screenRect)
+	{
+		Platform::clipCursorToRect(screenRect);
+	}
+
+	void Cursor::clipDisable()
+	{
+		Platform::clipCursorDisable();
+	}
+
+	void Cursor::setCursor(CursorType type)
+	{
+		UINT32 id = (UINT32)type;
+		CustomIcon& customIcon = mCustomIcons[id];
+
+		Platform::setCursor(customIcon.pixelData, customIcon.hotSpot);
+
+		mActiveCursorId = id;
+	}
+
+	void Cursor::setCursor(const CM::String& name)
+	{
+		auto iterFind = mCustomIconNameToId.find(name);
+		if(iterFind == mCustomIconNameToId.end())
+		{
+			LOGWRN("Cannot find cursor icon with name: " + name);
+			return;
+		}
+
+		UINT32 id = iterFind->second;
+		CustomIcon& customIcon = mCustomIcons[id];
+		Platform::setCursor(customIcon.pixelData, customIcon.hotSpot);
+
+		mActiveCursorId = id;
+	}
+
+	void Cursor::setCursorIcon(const CM::String& name, const CM::PixelData& pixelData, const CM::Vector2I& hotSpot)
+	{
+		auto iterFind = mCustomIconNameToId.find(name);
+		if(iterFind != mCustomIconNameToId.end())
+		{
+			UINT32 id = iterFind->second;
+			mCustomIcons[id] = CustomIcon(pixelData, hotSpot);
+
+			if(mActiveCursorId == id)
+				setCursor(name); // Refresh active
+		}
+		else
+		{
+			UINT32 id = mNextUniqueId++;
+			mCustomIconNameToId[name] = id;
+			mCustomIcons[id] = CustomIcon(pixelData, hotSpot);
+		}
+	}
+
+	void Cursor::setCursorIcon(CursorType type, const CM::PixelData& pixelData, const CM::Vector2I& hotSpot)
+	{
+		UINT32 id = (UINT32)type;
+
+		mCustomIcons[id].pixelData = pixelData;
+		mCustomIcons[id].hotSpot = hotSpot;
+
+		if(mActiveCursorId == id)
+			setCursor(type); // Refresh active
+	}
+
+	void Cursor::clearCursorIcon(const CM::String& name)
+	{
+		auto iterFind = mCustomIconNameToId.find(name);
+		if(iterFind == mCustomIconNameToId.end())
+			return;
+
+		mCustomIcons.erase(iterFind->second);
+		mCustomIconNameToId.erase(iterFind);
+	}
+
+	void Cursor::clearCursorIcon(CursorType type)
+	{
+		restoreCursorIcon(type);
+
+		if(mActiveCursorId == (UINT32)type)
+			setCursor(type); // Refresh active
+	}
+
+	void Cursor::restoreCursorIcon(CursorType type)
+	{
+		UINT32 id = (UINT32)type;
+		mCustomIcons[id] = CustomIcon();
+
+		switch (type)
+		{
+		case CursorType::Arrow:
+			mCustomIcons[id].pixelData = BuiltinResources::instance().getCursorArrow(mCustomIcons[id].hotSpot);
+			return;
+		case CursorType::Wait:
+			mCustomIcons[id].pixelData = BuiltinResources::instance().getCursorWait(mCustomIcons[id].hotSpot);
+			return;
+		case CursorType::IBeam:
+			mCustomIcons[id].pixelData = BuiltinResources::instance().getCursorIBeam(mCustomIcons[id].hotSpot);
+			return;
+		case CursorType::ArrowDrag:
+			mCustomIcons[id].pixelData = BuiltinResources::instance().getCursorArrowDrag(mCustomIcons[id].hotSpot);
+			return;
+		case CursorType::SizeNESW:
+			mCustomIcons[id].pixelData = BuiltinResources::instance().getCursorSizeNESW(mCustomIcons[id].hotSpot);
+			return;
+		case CursorType::SizeNS:
+			mCustomIcons[id].pixelData = BuiltinResources::instance().getCursorSizeNS(mCustomIcons[id].hotSpot);
+			return;
+		case CursorType::SizeNWSE:
+			mCustomIcons[id].pixelData = BuiltinResources::instance().getCursorSizeNWSE(mCustomIcons[id].hotSpot);
+			return;
+		case CursorType::SizeWE:
+			mCustomIcons[id].pixelData = BuiltinResources::instance().getCursorSizeWE(mCustomIcons[id].hotSpot);
+			return;
+		case CursorType::Deny:
+			mCustomIcons[id].pixelData = BuiltinResources::instance().getCursorDeny(mCustomIcons[id].hotSpot);
+			return;
+		case CursorType::ArrowLeftRight:
+			mCustomIcons[id].pixelData = BuiltinResources::instance().getCursorMoveLeftRight(mCustomIcons[id].hotSpot);
+			return;
+		}
+
+		CM_EXCEPT(InvalidParametersException, "Invalid cursor type: " + toString((UINT32)type));
+	}
+}

+ 3 - 1
BansheeEngine/Source/BsGUIDropDownBox.cpp

@@ -546,7 +546,9 @@ namespace BansheeEngine
 	{
 		closeSubMenu();
 
-		mData.entries[idx].getCallback()();
+		auto callback = mData.entries[idx].getCallback();
+		if(callback != nullptr)
+			callback();
 
 		GUIDropDownBoxManager::instance().closeDropDownBox();
 	}

+ 2 - 2
BansheeEngine/Source/BsGUIManager.cpp

@@ -591,7 +591,7 @@ namespace BansheeEngine
 
 		data->setColorAt(mCaretColor, 0, 0);
 
-		gMainCA().writeSubresource(tex.getInternalPtr(), tex->mapToSubresourceIdx(0, 0), data);
+		gCoreAccessor().writeSubresource(tex.getInternalPtr(), tex->mapToSubresourceIdx(0, 0), data);
 	}
 
 	void GUIManager::updateTextSelectionTexture()
@@ -609,7 +609,7 @@ namespace BansheeEngine
 
 		data->setColorAt(mTextSelectionColor, 0, 0);
 
-		gMainCA().writeSubresource(tex.getInternalPtr(), tex->mapToSubresourceIdx(0, 0), data);
+		gCoreAccessor().writeSubresource(tex.getInternalPtr(), tex->mapToSubresourceIdx(0, 0), data);
 	}
 
 	bool GUIManager::onMouseDragEnded(const CM::PositionalInputEvent& event)

+ 2 - 2
BansheeForwardRenderer/Source/BsForwardRenderer.cpp

@@ -46,7 +46,7 @@ namespace BansheeEngine
 
 		gSceneManager().updateRenderableBounds();
 
-		CoreAccessor& coreAccessor = gMainCA();
+		CoreAccessor& coreAccessor = gCoreAccessor();
 		const Vector<HCamera>::type& allCameras = gSceneManager().getAllCameras();
 
 		struct RenderTargetRenderInfo
@@ -132,7 +132,7 @@ namespace BansheeEngine
 		if(!camera->getIgnoreSceneRenderables())
 			allRenderables = gSceneManager().getVisibleRenderables(camera);
 
-		CoreAccessor& coreAccessor = gMainCA();
+		CoreAccessor& coreAccessor = gCoreAccessor();
 		coreAccessor.setViewport(camera->getViewport());
 
 		Matrix4 projMatrixCstm = camera->getProjectionMatrix();

+ 0 - 21
CamelotCore/Include/CmApplication.h

@@ -81,12 +81,7 @@ namespace CamelotFramework
 			boost::signal<void()> mainLoopCallback;
 
 	private:
-		friend CM_EXPORT CoreAccessor& gMainCA();
-		friend CM_EXPORT SyncedCoreAccessor& gMainSyncedCA();
-
 		RenderWindowPtr mPrimaryWindow;
-		CoreAccessorPtr mPrimaryCoreAccessor;
-		SyncedCoreAccessor* mPrimarySyncedCoreAccessor;
 
 		DynLib* mSceneManagerPlugin;
 
@@ -113,20 +108,4 @@ namespace CamelotFramework
 	};
 
 	CM_EXPORT Application& gApplication();
-
-	/**
-	 * @brief	A shortcut for accessing the primary core accessor. It may only be accessed safely
-	 * 			from the main thread.
-	 */
-	CM_EXPORT CoreAccessor& gMainCA();
-
-	/**
-	 * @brief	A shortcut for accessing the primary synchronized core accessor. This accessor may be accessed
-	 * 			from all threads except the core thread. All operations from this accessor will be executed after
-	 * 			non-synchronized primary accessor has finished executing.
-	 * 			
-	 * @note	It is more efficient to create your own non-synchronized core accessor if you plan on often using it from
-	 * 			threads other than main.
-	 */
-	CM_EXPORT SyncedCoreAccessor& gMainSyncedCA();
 }

+ 5 - 0
CamelotCore/Include/CmCoreThread.h

@@ -3,6 +3,7 @@
 #include "CmPrerequisites.h"
 #include "CmModule.h"
 #include "CmCommandQueue.h"
+#include "CmCoreThreadAccessor.h"
 
 namespace CamelotFramework
 {
@@ -181,6 +182,10 @@ private:
 
 	CM_EXPORT CoreThread& gCoreThread();
 
+	CM_EXPORT CoreThreadAccessor<CommandQueueNoSync>& gCoreAccessor();
+
+	CM_EXPORT CoreThreadAccessor<CommandQueueSync>& gSyncedCoreAccessor();
+
 	/**
 		* @brief	Throws an exception if current thread isn't the core thread;
 		*/

+ 3 - 3
CamelotCore/Include/CmTextureRTTI.h

@@ -38,8 +38,8 @@ namespace CamelotFramework
 
 			GpuResourcePtr sharedTexPtr = std::static_pointer_cast<GpuResource>(obj->getThisPtr());
 
-			gMainSyncedCA().readSubresource(sharedTexPtr, subresourceIdx, pixelData);
-			gMainSyncedCA().submitToCoreThread(true); // We need the data right away, so execute the context and wait until we get it
+			gSyncedCoreAccessor().readSubresource(sharedTexPtr, subresourceIdx, pixelData);
+			gSyncedCoreAccessor().submitToCoreThread(true); // We need the data right away, so execute the context and wait until we get it
 
 			return pixelData;
 		}
@@ -111,7 +111,7 @@ namespace CamelotFramework
 				UINT32 subresourceIdx = texture->mapToSubresourceIdx(face, mipmap);
 
 				GpuResourcePtr sharedTexPtr = std::static_pointer_cast<GpuResource>(texture->getThisPtr());
-				gMainSyncedCA().writeSubresource(sharedTexPtr, subresourceIdx, pixelData->at(i));
+				gSyncedCoreAccessor().writeSubresource(sharedTexPtr, subresourceIdx, pixelData->at(i));
 			}
 
 			cm_delete<PoolAlloc>(pixelData);

+ 0 - 13
CamelotCore/Source/CmApplication.cpp

@@ -74,9 +74,6 @@ namespace CamelotFramework
 		loadPlugin(desc.renderer);
 		RendererManager::instance().setActive(desc.renderer);
 
-		mPrimaryCoreAccessor = gCoreThread().getAccessor();
-		mPrimarySyncedCoreAccessor = &gCoreThread().getSyncedAccessor();
-
 		loadPlugin(desc.sceneManager, &mSceneManagerPlugin);
 
 		MeshManager::startUp(cm_new<MeshManager>());
@@ -261,14 +258,4 @@ namespace CamelotFramework
 		static Application application;
 		return application;
 	}
-
-	CoreAccessor& gMainCA()
-	{
-		return *gApplication().mPrimaryCoreAccessor.get();
-	}
-
-	SyncedCoreAccessor& gMainSyncedCA()
-	{
-		return *gApplication().mPrimarySyncedCoreAccessor;
-	}
 }

+ 3 - 4
CamelotCore/Source/CmCoreObject.cpp

@@ -164,13 +164,13 @@ namespace CamelotFramework
 		// reference to the obj (saved in the bound function).
 		// We could have called the function directly using "this" pointer but then we couldn't have used a shared_ptr for the object,
 		// in which case there is a possibility that the object would be released and deleted while still being in the command queue.
-		CoreThread::instance().getAccessor()->queueCommand(boost::bind(&CoreObject::executeGpuCommand, obj, func));
+		gCoreAccessor().queueCommand(boost::bind(&CoreObject::executeGpuCommand, obj, func));
 	}
 
 	AsyncOp CoreObject::queueReturnGpuCommand(std::shared_ptr<CoreObject>& obj, boost::function<void(AsyncOp&)> func)
 	{
 		// See queueGpuCommand
-		return CoreThread::instance().getAccessor()->queueReturnCommand(boost::bind(&CoreObject::executeReturnGpuCommand, obj, func, _1));
+		return gCoreAccessor().queueReturnCommand(boost::bind(&CoreObject::executeReturnGpuCommand, obj, func, _1));
 	}
 
 	void CoreObject::queueInitializeGpuCommand(std::shared_ptr<CoreObject>& obj)
@@ -184,8 +184,7 @@ namespace CamelotFramework
 	{
 		boost::function<void()> func = boost::bind(&CoreObject::destroy_internal, obj.get());
 
-		CoreThread::instance().getAccessor()->queueCommand(
-			boost::bind(&CoreObject::executeGpuCommand, obj, func));
+		gCoreAccessor().queueCommand(boost::bind(&CoreObject::executeGpuCommand, obj, func));
 	}
 
 	void CoreObject::executeGpuCommand(std::shared_ptr<CoreObject>& obj, boost::function<void()> func)

+ 10 - 1
CamelotCore/Source/CmCoreThread.cpp

@@ -1,5 +1,4 @@
 #include "CmCoreThread.h"
-#include "CmCoreThreadAccessor.h"
 
 namespace CamelotFramework
 {
@@ -292,6 +291,16 @@ namespace CamelotFramework
 		return CoreThread::instance();
 	}
 
+	CoreThreadAccessor<CommandQueueNoSync>& gCoreAccessor()
+	{
+		return *CoreThread::instance().getAccessor();
+	}
+
+	CoreThreadAccessor<CommandQueueSync>& gSyncedCoreAccessor()
+	{
+		return CoreThread::instance().getSyncedAccessor();
+	}
+
 	void throwIfNotCoreThread()
 	{
 #if !CM_FORCE_SINGLETHREADED_RENDERING

+ 2 - 2
CamelotCore/Source/CmMeshRTTI.h

@@ -25,8 +25,8 @@ namespace CamelotFramework
 
 			GpuResourcePtr sharedMeshPtr = std::static_pointer_cast<GpuResource>(obj->getThisPtr());
 
-			gMainSyncedCA().readSubresource(sharedMeshPtr, 0, meshData);
-			gMainSyncedCA().submitToCoreThread(true); // We need the data right away, so execute the context and wait until we get it
+			gSyncedCoreAccessor().readSubresource(sharedMeshPtr, 0, meshData);
+			gSyncedCoreAccessor().submitToCoreThread(true); // We need the data right away, so execute the context and wait until we get it
 
 			return meshData;
 		}

+ 2 - 2
CamelotCore/Source/CmRenderSystem.cpp

@@ -33,7 +33,7 @@ THE SOFTWARE.
 
 #include "CmRenderSystem.h"
 
-#include "CmCoreThreadAccessor.h"
+#include "CmCoreThread.h"
 #include "CmViewport.h"
 #include "CmException.h"
 #include "CmRenderTarget.h"
@@ -90,7 +90,7 @@ namespace CamelotFramework {
 
 	void RenderSystem::destroy()
 	{
-		gCoreThread().getAccessor()->queueCommand(boost::bind(&RenderSystem::destroy_internal, this));
+		gCoreAccessor().queueCommand(boost::bind(&RenderSystem::destroy_internal, this));
 		gCoreThread().submitAccessors(true);
 	}
 

+ 2 - 2
CamelotFontImporter/Source/CmFontImporter.cpp

@@ -279,11 +279,11 @@ namespace CamelotFramework
 					PixelDataPtr temp = newTex->allocateSubresourceBuffer(subresourceIdx);
 					PixelUtil::bulkPixelConversion(*pixelData, *temp);
 
-					gMainSyncedCA().writeSubresource(newTex.getInternalPtr(), subresourceIdx, temp);
+					gSyncedCoreAccessor().writeSubresource(newTex.getInternalPtr(), subresourceIdx, temp);
 				}
 				else
 				{
-					gMainSyncedCA().writeSubresource(newTex.getInternalPtr(), subresourceIdx, pixelData);
+					gSyncedCoreAccessor().writeSubresource(newTex.getInternalPtr(), subresourceIdx, pixelData);
 				}
 
 				fontData.texturePages.push_back(newTex);

+ 2 - 1
CamelotFreeImgImporter/Source/CmFreeImgImporter.cpp

@@ -8,6 +8,7 @@
 #include "CmTexture.h"
 #include "CmFileSystem.h"
 #include "CmApplication.h"
+#include "CmCoreThread.h"
 #include "CmCoreThreadAccessor.h"
 
 #include "FreeImage.h"
@@ -137,7 +138,7 @@ namespace CamelotFramework
 
 			imgData->getPixels(mip, *src);
 
-			gMainSyncedCA().writeSubresource(newTexture, subresourceIdx, src);
+			gSyncedCoreAccessor().writeSubresource(newTexture, subresourceIdx, src);
 		}
 
 		fileData->close();

+ 2 - 1
Inspector.txt

@@ -15,7 +15,8 @@ Text field
 
 -------------
 Cursor
- - Implement get*Cursor methods in BsBuiltinResources
+ - Set cursor hotspots
+ - Fix cursor images
  - A way to save/load a set of cursors
 
 Other: