Browse Source

More documentation

Marko Pintera 11 years ago
parent
commit
ad063dc814

+ 1 - 1
BansheeEditor/Source/BsProjectLibrary.cpp

@@ -83,7 +83,7 @@ namespace BansheeEngine
 
 	void ProjectLibrary::update()
 	{
-		mMonitor->update();
+		mMonitor->_update();
 	}
 
 	void ProjectLibrary::checkForModifications(const WString& fullPath)

+ 9 - 3
CamelotCore/Include/CmShader.h

@@ -152,18 +152,24 @@ namespace BansheeEngine
 
 		/** 
 		 * @brief	Returns a map of all data parameters in the shader.
+		 * 			
+		 * @note	Internal method.
 		 */
-		const Map<String, SHADER_DATA_PARAM_DESC>::type& getDataParams() const { return mDataParams; }
+		const Map<String, SHADER_DATA_PARAM_DESC>::type& _getDataParams() const { return mDataParams; }
 
 		/** 
 		 * @brief	Returns a map of all object parameters in the shader.
+		 * 			
+		 * @note	Internal method.
 		 */
-		const Map<String, SHADER_OBJECT_PARAM_DESC>::type& getObjectParams() const { return mObjectParams; }
+		const Map<String, SHADER_OBJECT_PARAM_DESC>::type& _getObjectParams() const { return mObjectParams; }
 
 		/** 
 		 * @brief	Returns a map of all parameter blocks.
+		 * 			
+		 * @note	Internal method.
 		 */
-		const Map<String, SHADER_PARAM_BLOCK_DESC>::type& getParamBlocks() const { return mParamBlocks; }
+		const Map<String, SHADER_PARAM_BLOCK_DESC>::type& _getParamBlocks() const { return mParamBlocks; }
 
 		static bool isSampler(GpuParamObjectType type);
 		static bool isTexture(GpuParamObjectType type);

+ 1 - 1
CamelotCore/Include/CmWin32FolderMonitor.h

@@ -59,7 +59,7 @@ namespace BansheeEngine
 		 * 			
 		 * @note	Internal method.
 		 */
-		void update();
+		void _update();
 
 		/**
 		 * @brief	Triggers when a file is modified. Provides

+ 0 - 27
CamelotCore/Include/Cocoa/CmOSCursorImpl.h

@@ -1,27 +0,0 @@
-#pragma once
-
-#include "CmPrerequisitesUtil.h"
-#include "CmInt2.h"
-
-#if defined(__OBJC__)
-#import <Cocoa/Cocoa.h>
-#else
-#include <ApplicationServices/ApplicationServices.h>
-typedef void *id;
-#endif
-
-namespace CamelotEngine
-{
-	/**
-	 * @brief	Provides controls for Windows operating system cursor.
-	 */
-	class CM_UTILITY_EXPORT OSCursor
-	{
-	public:
-		static Int2 getPosition();
-		static void setPosition(const Int2& pos);
-
-		static void hide();
-		static void show();
-	};
-}

+ 103 - 12
CamelotCore/Include/Win32/CmPlatformImpl.h

@@ -8,7 +8,9 @@
 
 namespace BansheeEngine
 {
-	// Encapsulate native cursor type so we can avoid including windows.h as it pollutes the global namespace
+	/**
+	 * @brief	Encapsulate native cursor data so we can avoid including windows.h as it pollutes the global namespace
+	 */
 	struct CM_EXPORT NativeCursorData
 	{
 		struct Pimpl;
@@ -19,7 +21,9 @@ namespace BansheeEngine
 		Pimpl* data;
 	};
 
-	// Encapsulate native cursor type so we can avoid including windows.h as it pollutes the global namespace
+	/**
+	 * @brief	Encapsulate drop target data so we can avoid including windows.h as it pollutes the global namespace
+	 */
 	struct CM_EXPORT NativeDropTargetData
 	{
 		struct Pimpl;
@@ -30,12 +34,18 @@ namespace BansheeEngine
 		Pimpl* data;
 	};
 
+	/**
+	 * @brief	Represents a specific non client area used for window resizing.
+	 */
 	struct CM_EXPORT NonClientResizeArea
 	{
 		NonClientAreaBorderType type;
 		RectI area;
 	};
 
+	/**
+	 * @brief	Contains a list of window move and resize non client areas.
+	 */
 	struct CM_EXPORT WindowNonClientAreaData
 	{
 		Vector<NonClientResizeArea>::type resizeAreas;
@@ -165,6 +175,8 @@ namespace BansheeEngine
 
 		/**
 		 * @brief	Adds a string to the clipboard.
+		 * 			
+		 * @note	Thread safe.
 		 */
 		static void copyToClipboard(const WString& string);
 
@@ -174,12 +186,16 @@ namespace BansheeEngine
 		 * 			
 		 * @note	Both wide and normal strings will be read, but normal strings will be converted to
 		 * 			a wide string before returning.
+		 * 			
+		 *			Thread safe.
 		 */
 		static WString copyFromClipboard();
 
 		/**
 		 * @brief	Queries the internal system performance counter you can use for very precise time
 		 * 			measurements. Value is in milliseconds.
+		 * 			
+		 * @note	Thread safe.
 		 */
 		static double queryPerformanceTimerMs();
 
@@ -206,51 +222,126 @@ namespace BansheeEngine
 		/**
 		 * @brief	Message pump. Processes OS messages and returns when it's free.
 		 * 			
-		 * @note	This method must be called from the core thread.
-		 * 			Internal method.
+		 * @note	Internal method.
+		 * 			Core thread only.
 		 */
-		static void messagePump();
+		static void _messagePump();
 
 		/**
 		 * @brief	Called during application start up from the sim thread.
 		 * 			Must be called before any other operations are done.
+		 * 			
+		 * @note	Internal method.
 		 */
-		static void startUp();
+		static void _startUp();
 
 		/**
 		 * @brief	Called once per frame from the sim thread.
 		 * 			
 		 * @note	Internal method.
+		 * 			Sim thread only.
 		 */
-		static void update();
+		static void _update();
 
 		/**
 		 * @brief	Called once per frame from the core thread.
 		 * 			
 		 * @note	Internal method.
+		 * 			Core thread only.
 		 */
-		static void coreUpdate();
+		static void _coreUpdate();
 
 		/**
 		 * @brief	Called during application shut down from the sim thread.
+		 * 			
+		 * @note	Internal method.
+		 * 			Sim thread only.
 		 */
-		static void shutDown();
+		static void _shutDown();
 
-		// Callbacks triggered on the sim thread
+		/**
+		 * @brief	Triggered when a pointer leaves the provided window.
+		 * 			
+		 * @note	Sim thread only.
+		 */
 		static boost::signal<void(RenderWindow*)> onMouseLeftWindow;
 
-		// Callbacks triggered on the core thread. Be careful so that none
-		// of the connected methods call methods intended for sim thread.
+		/**
+		 * @brief	Triggered whenever the pointer moves.
+		 * 			
+		 * @note	Core thread only.
+		 */
 		static boost::signal<void(const Vector2I&, OSPointerButtonStates)> onCursorMoved;
+
+		/**
+		 * @brief	Triggered whenever a pointer button is pressed.
+		 * 			
+		 * @note	Core thread only.
+		 */
 		static boost::signal<void(const Vector2I&, OSMouseButton button, OSPointerButtonStates)> onCursorButtonPressed;
+
+		/**
+		 * @brief	Triggered whenever pointer button is released.
+		 * 			
+		 * @note	Core thread only.
+		 */
 		static boost::signal<void(const Vector2I&, OSMouseButton button, OSPointerButtonStates)> onCursorButtonReleased;
+
+		/**
+		 * @brief	Triggered whenever a pointer button is double clicked.
+		 * 			
+		 * @note	Core thread only.
+		 */
 		static boost::signal<void(const Vector2I&, OSPointerButtonStates)> onCursorDoubleClick;
+
+		/**
+		 * @brief	Triggered whenever an input command is entered.
+		 * 			
+		 * @note	Core thread only.
+		 */
 		static boost::signal<void(InputCommandType)> onInputCommand;
+
+		/**
+		 * @brief	Triggered whenever the mouse wheel is scolled.
+		 * 			
+		 * @note	Core thread only.
+		 */
 		static boost::signal<void(float)> onMouseWheelScrolled;
+
+		/**
+		 * @brief	Triggered whenever a character is entered.
+		 * 			
+		 * @note	Core thread only.
+		 */
 		static boost::signal<void(UINT32)> onCharInput;
+
+		/**
+		 * @brief	Triggered whenever a window receives focus.
+		 * 			
+		 * @note	Core thread only.
+		 */
 		static boost::signal<void(RenderWindow*)> onWindowFocusReceived;
+
+		/**
+		 * @brief	Triggered whenever a window loses focus.
+		 * 			
+		 * @note	Core thread only.
+		 */
 		static boost::signal<void(RenderWindow*)> onWindowFocusLost;
+
+		/**
+		 * @brief	Triggered whenever a window gets moved or resized.
+		 * 			
+		 * @note	Core thread only.
+		 */
 		static boost::signal<void(RenderWindow*)> onWindowMovedOrResized;
+
+		/**
+		 * @brief	Triggered whenever mouse capture state for the window is changed
+		 * 			(it receives or loses it).
+		 * 			
+		 * @note	Core thread only.
+		 */
 		static boost::signal<void()> onMouseCaptureChanged;
 	protected:
 		static bool mIsCursorHidden;

+ 73 - 1
CamelotCore/Include/Win32/CmWin32DropTarget.h

@@ -16,6 +16,9 @@ namespace BansheeEngine
 	*/
 	class Win32DropTarget : public IDropTarget
 	{
+		/**
+		 * @brief	Type of drag and drop event.
+		 */
 		enum class DropOpType
 		{
 			DragOver,
@@ -23,12 +26,18 @@ namespace BansheeEngine
 			Leave
 		};
 
+		/**
+		 * @brief	Type of data that a drag and drop operation contains.
+		 */
 		enum class DropOpDataType
 		{
 			FileList,
 			None
 		};
 
+		/**
+		 * @brief	Structure describing a drag and drop operation.
+		 */
 		struct DropTargetOp
 		{
 			DropTargetOp(DropOpType _type, const Vector2I& _pos)
@@ -63,18 +72,30 @@ namespace BansheeEngine
 			mQueuedDropOps.clear();
 		}
 
+		/**
+		 * @brief	Registers the drop target with the operating system. Monitoring
+		 * 			for drag and drop operations starts.
+		 */
 		void registerWithOS()
 		{
 			CoLockObjectExternal(this, TRUE, FALSE);
 			HRESULT hr = RegisterDragDrop(mHWnd, this);
 		}
 
+		/**
+		 * @brief	Unregisters the drop target with the operating system. Monitoring
+		 * 			for drag and drop operations stops.
+		 */
 		void unregisterWithOS()
 		{
 			RevokeDragDrop(mHWnd);
 			CoLockObjectExternal(this, FALSE, FALSE);
 		}
 
+		/**
+		 * @brief	COM requirement. Returns instance of an interface of
+		 * 			provided type.
+		 */
 		HRESULT __stdcall QueryInterface(REFIID iid, void** ppvObject)
 		{
 			if(iid == IID_IDropTarget || iid == IID_IUnknown)
@@ -90,11 +111,20 @@ namespace BansheeEngine
 			}
 		}
 
+		/**
+		 * @brief	COM requirement. Increments objects
+		 * 			reference count.
+		 */
 		ULONG __stdcall AddRef()
 		{
 			return InterlockedIncrement(&mRefCount);
 		} 
 
+		/**
+		 * @brief	COM requirement. Decreases the objects 
+		 * 			reference count and deletes the object
+		 * 			if its zero.
+		 */
 		ULONG __stdcall Release()
 		{
 			LONG count = InterlockedDecrement(&mRefCount);
@@ -110,6 +140,11 @@ namespace BansheeEngine
 			}
 		} 
 
+		/**
+		 * @brief	Called by the OS when user enters the drop target area while dragging an object.
+		 * 			
+		 * @note	Called on core thread.
+		 */
 		HRESULT __stdcall DragEnter(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
 		{
 			*pdwEffect = DROPEFFECT_LINK;
@@ -134,6 +169,11 @@ namespace BansheeEngine
 			return S_OK;
 		}
 
+		/**
+		 * @brief	Called by the OS while user continues to drag an object over the drop target.
+		 * 			
+		 * @note	Called on core thread.
+		 */
 		HRESULT __stdcall DragOver(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
 		{
 			*pdwEffect = DROPEFFECT_LINK;
@@ -155,6 +195,11 @@ namespace BansheeEngine
 			return S_OK;
 		} 
 
+		/**
+		 * @brief	Called by the OS when user leaves the drop target.
+		 * 			
+		 * @note	Called on core thread.
+		 */
 		HRESULT __stdcall DragLeave()
 		{
 			{
@@ -170,6 +215,12 @@ namespace BansheeEngine
 			return S_OK;
 		}
 
+		/**
+		 * @brief	Called by the OS when the user ends the drag operation while
+		 * 			over the drop target.
+		 * 			
+		 * @note	Called on core thread.
+		 */
 		HRESULT __stdcall Drop(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
 		{
 			*pdwEffect = DROPEFFECT_LINK;
@@ -194,12 +245,21 @@ namespace BansheeEngine
 			return S_OK;
 		}
 
-		// Sim thread only
+		/**
+		 * @brief	Registers a new drop target to monitor.
+		 *
+		 * @note	Sim thread only.
+		 */
 		void registerDropTarget(OSDropTarget* dropTarget)
 		{
 			mDropTargets.push_back(dropTarget);
 		}
 
+		/**
+		 * @brief	Unregisters an existing drop target and stops monitoring it.
+		 *
+		 * @note	Sim thread only.
+		 */
 		void unregisterDropTarget(OSDropTarget* dropTarget)
 		{
 			auto findIter = std::find(begin(mDropTargets), end(mDropTargets), dropTarget);
@@ -207,6 +267,11 @@ namespace BansheeEngine
 				mDropTargets.erase(findIter);
 		}
 
+		/**
+		 * @brief	Gets the total number of monitored drop targets.
+		 * 			
+		 * @note	Sim thread only.
+		 */
 		unsigned int getNumDropTargets() const 
 		{ 
 			return (unsigned int)mDropTargets.size(); 
@@ -272,6 +337,9 @@ namespace BansheeEngine
 			mQueuedDropOps.clear();
 		}
 	private:
+		/**
+		 * @brief	Check if we support the data in the provided drag and drop data object.
+		 */
 		bool isDataValid(IDataObject* data)
 		{
 			// TODO - Currently only supports file drag and drop, so only CF_HDROP is used
@@ -280,6 +348,10 @@ namespace BansheeEngine
 			return data->QueryGetData(&fmtetc) == S_OK ? true : false;
 		}
 
+		/**
+		 * @brief	Gets a file list from data. Caller must ensure that the data actually
+		 * 			contains a file list.
+		 */
 		Vector<WString>::type* getFileListFromData(IDataObject* data)
 		{
 			FORMATETC fmtetc = { CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

+ 0 - 33
CamelotCore/Include/X11/CmOSCursorImpl.h

@@ -1,33 +0,0 @@
-#pragma once
-
-#include "CmPrerequisitesUtil.h"
-#include "CmInt2.h"
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-namespace CamelotEngine
-{
-	/**
-	 * @brief	Provides controls for operating system cursor.
-	 */
-	class CM_UTILITY_EXPORT OSCursor
-	{
-	public:
-		OSCursor();
-
-		static Int2 getPosition();
-		static void setPosition(const Int2& pos);
-
-		static void hide();
-		static void show();
-
-	private:
-		Window mWindow; // TODO - This isn't being set anywhere yet
-		Cursor mCursor;
-		Display* mDisplay;
-
-		bool mCursorGrabbed;
-		bool mCursorHidden;
-	};
-}

+ 4 - 4
CamelotCore/Source/CmApplication.cpp

@@ -55,7 +55,7 @@ namespace BansheeEngine
 	{
 		UINT32 numWorkerThreads = CM_THREAD_HARDWARE_CONCURRENCY - 1; // Number of cores while excluding current thread.
 
-		Platform::startUp();
+		Platform::_startUp();
 		MemStack::beginThread();
 
 		Profiler::startUp(cm_new<Profiler>());
@@ -105,7 +105,7 @@ namespace BansheeEngine
 			gProfiler().beginThread("Sim");
 
 			gCoreThread().update();
-			Platform::update();
+			Platform::_update();
 			DeferredCallManager::instance().update();
 			RenderWindowManager::instance().update();
 			gInput()._update();
@@ -137,7 +137,7 @@ namespace BansheeEngine
 				mIsFrameRenderingFinished = false;
 			}
 
-			gCoreThread().queueCommand(&Platform::coreUpdate);
+			gCoreThread().queueCommand(&Platform::_coreUpdate);
 			gCoreThread().submitAccessors();
 			gCoreThread().queueCommand(std::bind(&Application::endCoreProfiling, this));
 			gCoreThread().queueCommand(std::bind(&Application::frameRenderingFinishedCallback, this));
@@ -204,7 +204,7 @@ namespace BansheeEngine
 		ThreadPool::shutDown();
 		Profiler::shutDown();
 		MemStack::endThread();
-		Platform::shutDown();
+		Platform::_shutDown();
 	}
 
 	void* Application::loadPlugin(const String& pluginName, DynLib** library)

+ 3 - 3
CamelotCore/Source/CmMaterial.cpp

@@ -109,7 +109,7 @@ namespace BansheeEngine
 			Map<String, GpuParamBlockBufferPtr>::type paramBlockBuffers;
 
 			// Create param blocks
-			const Map<String, SHADER_PARAM_BLOCK_DESC>::type& shaderDesc = mShader->getParamBlocks();
+			const Map<String, SHADER_PARAM_BLOCK_DESC>::type& shaderDesc = mShader->_getParamBlocks();
 			for(auto iter = validShareableParamBlocks.begin(); iter != validShareableParamBlocks.end(); ++iter)
 			{
 				bool isShared = false;
@@ -146,7 +146,7 @@ namespace BansheeEngine
 			}
 
 			// Create data param mappings
-			const Map<String, SHADER_DATA_PARAM_DESC>::type& dataParamDesc = mShader->getDataParams();
+			const Map<String, SHADER_DATA_PARAM_DESC>::type& dataParamDesc = mShader->_getDataParams();
 			for(auto iter = dataParamDesc.begin(); iter != dataParamDesc.end(); ++iter)
 			{
 				auto findIter = validDataParameters.find(iter->second.gpuVariableName);
@@ -179,7 +179,7 @@ namespace BansheeEngine
 			}
 
 			// Create object param mappings
-			const Map<String, SHADER_OBJECT_PARAM_DESC>::type& objectParamDesc = mShader->getObjectParams();
+			const Map<String, SHADER_OBJECT_PARAM_DESC>::type& objectParamDesc = mShader->_getObjectParams();
 			for(auto iter = objectParamDesc.begin(); iter != objectParamDesc.end(); ++iter)
 			{
 				auto findIter = validObjectParameters.find(iter->second.gpuVariableName);

+ 1 - 1
CamelotCore/Source/CmWin32FolderMonitor.cpp

@@ -637,7 +637,7 @@ namespace BansheeEngine
 		}
 	}
 
-	void FolderMonitor::update()
+	void FolderMonitor::_update()
 	{
 		{
 			CM_LOCK_MUTEX(mPimpl->mMainMutex);

+ 0 - 36
CamelotCore/Source/Cocoa/CmOSCursorImpl.cpp

@@ -1,36 +0,0 @@
-#include "X11/CmOSCursorImpl.h"
-
-// TODO - Not tested and will not work until I properly test it on a mac system!
-
-namespace CamelotEngine
-{
-	OSCursor()
-	{
-	}
-
-	Int2 OSCursor::getPosition()
-	{
-		NSPoint mouseLoc;
-		mouseLoc = [NSEvent mouseLocation];
-
-		return Int2(mouseLoc.x, mouseLoc.y);
-	}
-
-	void OSCursor::setPosition(const Int2& pos)
-	{
-		CGPoint globalPoint = CGPointMake(pos.x, pos.y);
-		CGWarpMouseCursorPosition(globalPoint);
-	}
-
-	void OSCursor::hide()
-	{
-		[NSCursor hide];
-		CGAssociateMouseAndMouseCursorPosition(false);
-	}
-
-	void OSCursor::show()
-	{
-		[NSCursor unhide];
-		CGAssociateMouseAndMouseCursorPosition(true);
-	}
-}

+ 6 - 6
CamelotCore/Source/Win32/CmPlatformImpl.cpp

@@ -392,7 +392,7 @@ namespace BansheeEngine
 		CM_PVT_DELETE(OSDropTarget, &target);
 	}
 
-	void Platform::messagePump()
+	void Platform::_messagePump()
 	{
 		MSG  msg;
 		while(PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
@@ -402,14 +402,14 @@ namespace BansheeEngine
 		}
 	}
 
-	void Platform::startUp()
+	void Platform::_startUp()
 	{
 		CM_LOCK_MUTEX(mSync);
 
 		mRequiresStartUp = true;
 	}
 
-	void Platform::update()
+	void Platform::_update()
 	{
 		Vector<RenderWindow*>::type windowsCopy;
 		{
@@ -431,7 +431,7 @@ namespace BansheeEngine
 		}
 	}
 
-	void Platform::coreUpdate()
+	void Platform::_coreUpdate()
 	{
 		{
 			CM_LOCK_MUTEX(mSync);
@@ -464,7 +464,7 @@ namespace BansheeEngine
 			mDropTargets.data->dropTargetsToDestroy.clear();
 		}
 
-		messagePump();
+		_messagePump();
 
 		{
 			CM_LOCK_MUTEX(mSync);
@@ -476,7 +476,7 @@ namespace BansheeEngine
 		}
 	}
 
-	void Platform::shutDown()
+	void Platform::_shutDown()
 	{
 		CM_LOCK_MUTEX(mSync);
 

+ 0 - 76
CamelotCore/Source/X11/CmOSCursorImpl.cpp

@@ -1,76 +0,0 @@
-#include "X11/CmOSCursorImpl.h"
-
-// TODO - Not tested and will not work until I properly test it on a unix system!
-
-namespace CamelotEngine
-{
-	OSCursor()
-		:mCursorGrabbed(false), mCursorHidden(false)
-	{
-		mDisplay = XOpenDisplay(0); // TODO - What if there are multiple displays? Need to check for that
-		mWindow = XRootWindow(mDisplay, 0);
-		mCursor = createNULLCursor(mDisplay, mWindow); // Create invisible cursor
-	}
-
-	Int2 OSCursor::getPosition()
-	{
-		Window returnedWindow;
-		int rootX, rootY;
-		int winX, winY;
-		unsigned int returnedMask;
-
-		XQueryPointer(mDisplay, mWindow, &returnedWindow,
-			&returnedWindow, &rootX, &rootY, &winX, &winY,
-			&returnedMask)
-
-		return Int2(rootX, rootY);
-	}
-
-	void OSCursor::setPosition(const Int2& pos)
-	{
-		XWarpPointer(mDisplay, None, mWindow, 0,0,0,0, pos.x, pos.y);
-		XFlush(mDisplay);
-	}
-
-	void OSCursor::hide()
-	{
-		// Hide cursor
-		if(!mCursorHidden)
-		{
-			XDefineCursor(mDisplay, mWindow, mCursor );
-			mCursorHidden = true;
-		}
-
-		// Grab cursor to user window
-		if(!mCursorGrabbed)
-		{
-			if( XGrabPointer( mDisplay, mWindow, True,
-				ButtonPressMask | ButtonReleaseMask |
-				PointerMotionMask, GrabModeAsync, GrabModeAsync,
-				mWindow, None, CurrentTime ) ==
-				GrabSuccess )
-			{
-				mCursorGrabbed = true;
-			}
-		}
-	}
-
-	void OSCursor::show()
-	{
-		// Un-grab cursor (only in windowed mode: in fullscreen mode we still
-		// want the mouse grabbed in order to confine the cursor to the window
-		// area)
-		if(mCursorGrabbed)
-		{
-			XUngrabPointer(mDisplay, CurrentTime);
-			mCursorGrabbed = false;
-		}
-
-		// Show cursor
-		if(mCursorHidden)
-		{
-			XUndefineCursor(mDisplay, mWindow);
-			mCursorHidden = GL_FALSE;
-		}
-	}
-}