Browse Source

Render window positioning x/y coordinates weren't being consistent

BearishSun 10 years ago
parent
commit
ecb34ab114

+ 365 - 365
BansheeCore/Include/BsRenderWindow.h

@@ -1,365 +1,365 @@
-#pragma once
-
-#include "BsCorePrerequisites.h"
-
-#include "BsRenderTarget.h"
-#include "BsVideoModeInfo.h"
-#include "BsVector2I.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Structure that is used for initializing a render window.
-	 */
-	struct BS_CORE_EXPORT RENDER_WINDOW_DESC
-	{
-		RENDER_WINDOW_DESC()
-		: vsync(false), vsyncInterval(1), fullscreen(false), hidden(false), depthBuffer(true)
-			, multisampleCount(0), multisampleHint(""), gamma(false), left(-1), top(-1)
-			, title(""), border(WindowBorder::Normal), outerDimensions(false), enableDoubleClick(true)
-			, toolWindow(false), modal(false), hideUntilSwap(false)
-		{ }
-
-		VideoMode videoMode; /**< A set of frame buffer options. */
-		bool fullscreen; /**< Should the window be opened in fullscreen mode. */
-		bool vsync; /**< Should the window wait for vertical sync before swapping buffers. */
-		UINT32 vsyncInterval; /**< Determines how many vsync intervals occur per frame. FPS = refreshRate/interval. Usually 1 when vsync active. */
-		bool hidden; /**< Should the window be hidden initially. */
-		bool depthBuffer; /**< Should the window be created with a depth/stencil buffer. */
-		UINT32 multisampleCount; /**< If higher than 1, texture containing multiple samples per pixel is created. */
-		String multisampleHint; /**< Hint about what kind of multisampling to use. Render system specific. */
-		bool gamma; /**< Should the written color pixels be gamma corrected before write. */
-		INT32 left; /**< Window origin on X axis in pixels. -1 == screen center. Relative to monitor provided in videoMode. */
-		INT32 top; /**< Window origin on Y axis in pixels. -1 == screen center. Relative to monitor provided in videoMode. */
-		String title; /**< Title of the window. */
-		WindowBorder border; /**< Type of border to create the window with. */
-		bool outerDimensions; /**< Do our dimensions include space for things like title-bar and border. */
-		bool enableDoubleClick; /**< Does window accept double-clicks. */
-		bool toolWindow; /**< Tool windows have a different style than normal windows and can be created with no border or title bar. */
-		bool modal; /**< When a modal window is open all other windows will be locked until modal window is closed. */
-		bool hideUntilSwap; /** < Window will be created as hidden and only be shown when the first framebuffer swap happens. */
-
-		NameValuePairList platformSpecific; /**< Platform-specific creation options. */
-	};
-
-	/**
-	 * @brief	Contains various properties that describe a render window.
-	 */
-	class BS_CORE_EXPORT RenderWindowProperties : public RenderTargetProperties
-	{
-	public:
-		RenderWindowProperties(const RENDER_WINDOW_DESC& desc);
-		virtual ~RenderWindowProperties() { }
-
-		/**
-		 * @brief	Gets the horizontal origin of the window in pixels.
-		 */
-		INT32 getLeft() const { return mLeft; }
-
-		/**
-		 * @brief	Gets the vertical origin of the window in pixels.
-		 */
-		INT32 getTop() const { return mTop; }
-
-		/**
-		 * @brief	Indicates whether the window currently has keyboard focus.
-		 */
-		bool hasFocus() const { return mHasFocus; }
-
-		/**
-		 * @brief	Returns true if window is running in fullscreen mode.
-		 */
-		bool isFullScreen() const { return mIsFullScreen; }
-
-		/**
-		 * @brief	Returns true if the window is modal (blocks interaction with
-		 *			any non-modal window until closed).
-		 */
-		bool isModal() const { return mIsModal; }
-
-		/**
-		 * @brief	Returns true if the window is hidden.
-		 */
-		bool isHidden() const { return mHidden; }
-
-		/**
-		 * @brief	Returns true if the window is maximized.
-		 */
-		bool isMaximized() const { return mIsMaximized; }
-
-	protected:
-		friend class RenderWindowCore;
-		friend class RenderWindow;
-
-		bool mIsFullScreen = false;
-		INT32 mLeft = 0;
-		INT32 mTop = 0;
-		bool mHasFocus = false;
-		bool mHidden = false;
-		bool mIsModal = false;
-		bool mIsMaximized = false;
-	};
-
-	/**
-	 * @brief	Provides access to internal render window implementation usable only from the core thread.
-	 *
-	 * @note	Core thread only.
-	 */
-	class BS_CORE_EXPORT RenderWindowCore : public RenderTargetCore
-	{
-	public:
-		RenderWindowCore(const RENDER_WINDOW_DESC& desc, UINT32 windowId);
-		virtual ~RenderWindowCore();
-
-		/** 
-		 * @brief	Switches the window to fullscreen mode. Child windows cannot go into fullscreen mode.
-		 *
-		 * @param	width		Width of the window frame buffer in pixels.
-		 * @param	height		Height of the window frame buffer in pixels.
-		 * @param	refreshRate	Refresh rate of the window in Hertz.
-		 * @param	monitorIdx	Index of the monitor to go fullscreen on.
-		 *
-		 * @note	If the exact provided mode isn't available, closest one is used instead.
-		 */
-		virtual void setFullscreen(UINT32 width, UINT32 height, float refreshRate = 60.0f, UINT32 monitorIdx = 0) { }
-
-		/**
-		* @brief	Switches the window to fullscreen mode. Child windows cannot go into fullscreen mode.
-		*
-		* @param	videoMode	Mode retrieved from VideoModeInfo in RenderAPI.
-		*/
-		virtual void setFullscreen(const VideoMode& mode) { }
-
-		/**
-		 * @brief	Switches the window to windowed mode.
-		 *
-		 * @param	Window width in pixels.
-		 * @param	Window height in pixels.
-		 */
-		virtual void setWindowed(UINT32 width, UINT32 height) { }
-
-        /**
-         * @brief	Hide or show the window.
-         */
-        virtual void setHidden(bool hidden);
-
-		/**
-		 * @brief	Makes the render target active or inactive. (e.g. for a window, it will hide or restore the window).
-		 */
-		virtual void setActive(bool state);
-
-		/**
-		 * @brief	Minimizes the window to the taskbar.
-		 */
-		virtual void minimize() { }
-
-		/**
-		 * @brief	Maximizes the window over the entire current screen.
-		 */
-		virtual void maximize() { }
-
-		/**
-		 * @brief	Restores the window to original position and size if it is
-		 *			minimized or maximized.
-		 */
-		virtual void restore() { }
-
-        /**
-         * @brief	Change the size of the window.
-         */
-        virtual void resize(UINT32 width, UINT32 height) = 0;
-
-        /**
-         * @brief	Reposition the window.
-         */
-        virtual void move(INT32 top, INT32 left) = 0;
-
-		/**
-		 * @brief	Returns properties that describe the render window.
-		 */
-		const RenderWindowProperties& getProperties() const;
-
-		/**
-		 * @brief	Called when window is moved or resized.
-		 *
-		 * @note	Core thread. Internal method.
-		 */
-		virtual void _windowMovedOrResized();
-
-		/**
-		 * @brief	Called when window has received focus.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void _windowFocusReceived();
-
-		/**
-		 * @brief	Called when window has lost focus.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void _windowFocusLost();
-
-		/**
-		 * @brief	Called when window has been maximized.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void _notifyMaximized();
-
-		/**
-		 * @brief	Called when window has been minimized.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void _notifyMinimized();
-
-		/**
-		 * @brief	Called when window has been restored 
-		 *			from minimized or maximized state.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void _notifyRestored();
-
-	protected:
-		friend class RenderWindow;
-		friend class RenderWindowManager;
-		friend class RenderWindowCoreManager;
-
-		/**
-		 * @brief	Returns window properties that are always kept in sync between core and sim threads.
-		 *
-		 * @note	Used for keeping up what are the most up to date settings.
-		 */
-		virtual RenderWindowProperties& getSyncedProperties() = 0;
-
-		/**
-		 * @brief	Updates window properties from the synced property data.
-		 */
-		virtual void syncProperties() = 0;
-
-		RENDER_WINDOW_DESC mDesc;
-		SpinLock mLock;
-		UINT32 mWindowId;
-	};
-
-	/**
-	 * @brief	Render target specialization that allows you to render into window
-	 *			frame buffer(s).
-	 *
-	 * @note	Sim thread only. Retrieve core implementation from getCore()
-	 *			for core thread only functionality.
-	 */
-    class BS_CORE_EXPORT RenderWindow : public RenderTarget
-    {
-    public:
-		virtual ~RenderWindow() { }
-
-		/**
-		 * @copydoc	RenderTarget::destroy
-		 */
-		virtual void destroy() override;	
-
-		/**
-		 * @brief	Converts screen position into window local position.
-		 */
-		virtual Vector2I screenToWindowPos(const Vector2I& screenPos) const = 0;
-
-		/**
-		 * @brief	Converts window local position to screen position.
-		 */
-		virtual Vector2I windowToScreenPos(const Vector2I& windowPos) const = 0;
-
-		/**
-		 * @brief	Resize the window to specified width and height in pixels.
-		 */
-		void resize(CoreAccessor& accessor, UINT32 width, UINT32 height);
-
-		/**
-		 * @brief	Move the window to specified screen coordinates.
-		 */
-		void move(CoreAccessor& accessor, INT32 left, INT32 top);
-
-		/**
-		 * @brief	Hide the window. (Does not destroy it, just hides it).
-		 */
-		void hide(CoreAccessor& accessor);
-
-		/**
-		 * @brief	Shows a previously hidden window.
-		 */
-		void show(CoreAccessor& accessor);
-
-		/**
-		 * @copydoc	RenderWindowCore::minimize
-		 */
-		void minimize(CoreAccessor& accessor);
-
-		/**
-		 * @copydoc	RenderWindowCore::maximize
-		 */
-		void maximize(CoreAccessor& accessor);
-
-		/**
-		 * @copydoc	RenderWindowCore::restore
-		 */
-		void restore(CoreAccessor& accessor);
-
-		/**
-		 * @copydoc RenderWindowCore::setFullscreen(UINT32, UINT32, float, UINT32)
-		 */
-		void setFullscreen(CoreAccessor& accessor, UINT32 width, UINT32 height, float refreshRate = 60.0f, UINT32 monitorIdx = 0);
-
-		/**
-		 * @copydoc RenderWindowCore::setFullscreen(const VideoMode&)
-		 */
-		void setFullscreen(CoreAccessor& accessor, const VideoMode& mode);
-
-		/**
-		 * @copydoc RenderWindowCore::setWindowed
-		 */
-		void setWindowed(CoreAccessor& accessor, UINT32 width, UINT32 height);
-
-		/**
-		 * @brief	Retrieves a core implementation of a render window usable only from the
-		 *			core thread.
-		 */
-		SPtr<RenderWindowCore> getCore() const;
-
-		/**
-		 * @brief	Returns properties that describe the render window.
-		 */
-		const RenderWindowProperties& getProperties() const;
-
-		/**
-		 * @brief	Creates a new render window using the specified options. Optionally
-		 *			makes the created window a child of another window.
-		 */
-		static RenderWindowPtr create(RENDER_WINDOW_DESC& desc, RenderWindowPtr parentWindow = nullptr);
-
-    protected:
-		friend class RenderWindowManager;
-
-		RenderWindow(const RENDER_WINDOW_DESC& desc, UINT32 windowId);
-
-		/**
-		 * @brief	Returns render window properties that may be edited.
-		 */
-		RenderWindowProperties& getMutableProperties();
-
-		/**
-		 * @copydoc	RenderTarget::createCore
-		 */
-		SPtr<CoreObjectCore> createCore() const override;
-
-		/**
-		 * @brief	Updates window properties from the synced property data.
-		 */
-		virtual void syncProperties() = 0;
-
-	protected:
-		RENDER_WINDOW_DESC mDesc;
-		UINT32 mWindowId;
-    };
-}
+#pragma once
+
+#include "BsCorePrerequisites.h"
+
+#include "BsRenderTarget.h"
+#include "BsVideoModeInfo.h"
+#include "BsVector2I.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Structure that is used for initializing a render window.
+	 */
+	struct BS_CORE_EXPORT RENDER_WINDOW_DESC
+	{
+		RENDER_WINDOW_DESC()
+		: vsync(false), vsyncInterval(1), fullscreen(false), hidden(false), depthBuffer(true)
+			, multisampleCount(0), multisampleHint(""), gamma(false), left(-1), top(-1)
+			, title(""), border(WindowBorder::Normal), outerDimensions(false), enableDoubleClick(true)
+			, toolWindow(false), modal(false), hideUntilSwap(false)
+		{ }
+
+		VideoMode videoMode; /**< A set of frame buffer options. */
+		bool fullscreen; /**< Should the window be opened in fullscreen mode. */
+		bool vsync; /**< Should the window wait for vertical sync before swapping buffers. */
+		UINT32 vsyncInterval; /**< Determines how many vsync intervals occur per frame. FPS = refreshRate/interval. Usually 1 when vsync active. */
+		bool hidden; /**< Should the window be hidden initially. */
+		bool depthBuffer; /**< Should the window be created with a depth/stencil buffer. */
+		UINT32 multisampleCount; /**< If higher than 1, texture containing multiple samples per pixel is created. */
+		String multisampleHint; /**< Hint about what kind of multisampling to use. Render system specific. */
+		bool gamma; /**< Should the written color pixels be gamma corrected before write. */
+		INT32 left; /**< Window origin on X axis in pixels. -1 == screen center. Relative to monitor provided in videoMode. */
+		INT32 top; /**< Window origin on Y axis in pixels. -1 == screen center. Relative to monitor provided in videoMode. */
+		String title; /**< Title of the window. */
+		WindowBorder border; /**< Type of border to create the window with. */
+		bool outerDimensions; /**< Do our dimensions include space for things like title-bar and border. */
+		bool enableDoubleClick; /**< Does window accept double-clicks. */
+		bool toolWindow; /**< Tool windows have a different style than normal windows and can be created with no border or title bar. */
+		bool modal; /**< When a modal window is open all other windows will be locked until modal window is closed. */
+		bool hideUntilSwap; /** < Window will be created as hidden and only be shown when the first framebuffer swap happens. */
+
+		NameValuePairList platformSpecific; /**< Platform-specific creation options. */
+	};
+
+	/**
+	 * @brief	Contains various properties that describe a render window.
+	 */
+	class BS_CORE_EXPORT RenderWindowProperties : public RenderTargetProperties
+	{
+	public:
+		RenderWindowProperties(const RENDER_WINDOW_DESC& desc);
+		virtual ~RenderWindowProperties() { }
+
+		/**
+		 * @brief	Gets the horizontal origin of the window in pixels.
+		 */
+		INT32 getLeft() const { return mLeft; }
+
+		/**
+		 * @brief	Gets the vertical origin of the window in pixels.
+		 */
+		INT32 getTop() const { return mTop; }
+
+		/**
+		 * @brief	Indicates whether the window currently has keyboard focus.
+		 */
+		bool hasFocus() const { return mHasFocus; }
+
+		/**
+		 * @brief	Returns true if window is running in fullscreen mode.
+		 */
+		bool isFullScreen() const { return mIsFullScreen; }
+
+		/**
+		 * @brief	Returns true if the window is modal (blocks interaction with
+		 *			any non-modal window until closed).
+		 */
+		bool isModal() const { return mIsModal; }
+
+		/**
+		 * @brief	Returns true if the window is hidden.
+		 */
+		bool isHidden() const { return mHidden; }
+
+		/**
+		 * @brief	Returns true if the window is maximized.
+		 */
+		bool isMaximized() const { return mIsMaximized; }
+
+	protected:
+		friend class RenderWindowCore;
+		friend class RenderWindow;
+
+		bool mIsFullScreen = false;
+		INT32 mLeft = 0;
+		INT32 mTop = 0;
+		bool mHasFocus = false;
+		bool mHidden = false;
+		bool mIsModal = false;
+		bool mIsMaximized = false;
+	};
+
+	/**
+	 * @brief	Provides access to internal render window implementation usable only from the core thread.
+	 *
+	 * @note	Core thread only.
+	 */
+	class BS_CORE_EXPORT RenderWindowCore : public RenderTargetCore
+	{
+	public:
+		RenderWindowCore(const RENDER_WINDOW_DESC& desc, UINT32 windowId);
+		virtual ~RenderWindowCore();
+
+		/** 
+		 * @brief	Switches the window to fullscreen mode. Child windows cannot go into fullscreen mode.
+		 *
+		 * @param	width		Width of the window frame buffer in pixels.
+		 * @param	height		Height of the window frame buffer in pixels.
+		 * @param	refreshRate	Refresh rate of the window in Hertz.
+		 * @param	monitorIdx	Index of the monitor to go fullscreen on.
+		 *
+		 * @note	If the exact provided mode isn't available, closest one is used instead.
+		 */
+		virtual void setFullscreen(UINT32 width, UINT32 height, float refreshRate = 60.0f, UINT32 monitorIdx = 0) { }
+
+		/**
+		* @brief	Switches the window to fullscreen mode. Child windows cannot go into fullscreen mode.
+		*
+		* @param	videoMode	Mode retrieved from VideoModeInfo in RenderAPI.
+		*/
+		virtual void setFullscreen(const VideoMode& mode) { }
+
+		/**
+		 * @brief	Switches the window to windowed mode.
+		 *
+		 * @param	Window width in pixels.
+		 * @param	Window height in pixels.
+		 */
+		virtual void setWindowed(UINT32 width, UINT32 height) { }
+
+        /**
+         * @brief	Hide or show the window.
+         */
+        virtual void setHidden(bool hidden);
+
+		/**
+		 * @brief	Makes the render target active or inactive. (e.g. for a window, it will hide or restore the window).
+		 */
+		virtual void setActive(bool state);
+
+		/**
+		 * @brief	Minimizes the window to the taskbar.
+		 */
+		virtual void minimize() { }
+
+		/**
+		 * @brief	Maximizes the window over the entire current screen.
+		 */
+		virtual void maximize() { }
+
+		/**
+		 * @brief	Restores the window to original position and size if it is
+		 *			minimized or maximized.
+		 */
+		virtual void restore() { }
+
+        /**
+         * @brief	Change the size of the window.
+         */
+        virtual void resize(UINT32 width, UINT32 height) = 0;
+
+        /**
+         * @brief	Reposition the window.
+         */
+        virtual void move(INT32 left, INT32 top) = 0;
+
+		/**
+		 * @brief	Returns properties that describe the render window.
+		 */
+		const RenderWindowProperties& getProperties() const;
+
+		/**
+		 * @brief	Called when window is moved or resized.
+		 *
+		 * @note	Core thread. Internal method.
+		 */
+		virtual void _windowMovedOrResized();
+
+		/**
+		 * @brief	Called when window has received focus.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void _windowFocusReceived();
+
+		/**
+		 * @brief	Called when window has lost focus.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void _windowFocusLost();
+
+		/**
+		 * @brief	Called when window has been maximized.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void _notifyMaximized();
+
+		/**
+		 * @brief	Called when window has been minimized.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void _notifyMinimized();
+
+		/**
+		 * @brief	Called when window has been restored 
+		 *			from minimized or maximized state.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void _notifyRestored();
+
+	protected:
+		friend class RenderWindow;
+		friend class RenderWindowManager;
+		friend class RenderWindowCoreManager;
+
+		/**
+		 * @brief	Returns window properties that are always kept in sync between core and sim threads.
+		 *
+		 * @note	Used for keeping up what are the most up to date settings.
+		 */
+		virtual RenderWindowProperties& getSyncedProperties() = 0;
+
+		/**
+		 * @brief	Updates window properties from the synced property data.
+		 */
+		virtual void syncProperties() = 0;
+
+		RENDER_WINDOW_DESC mDesc;
+		SpinLock mLock;
+		UINT32 mWindowId;
+	};
+
+	/**
+	 * @brief	Render target specialization that allows you to render into window
+	 *			frame buffer(s).
+	 *
+	 * @note	Sim thread only. Retrieve core implementation from getCore()
+	 *			for core thread only functionality.
+	 */
+    class BS_CORE_EXPORT RenderWindow : public RenderTarget
+    {
+    public:
+		virtual ~RenderWindow() { }
+
+		/**
+		 * @copydoc	RenderTarget::destroy
+		 */
+		virtual void destroy() override;	
+
+		/**
+		 * @brief	Converts screen position into window local position.
+		 */
+		virtual Vector2I screenToWindowPos(const Vector2I& screenPos) const = 0;
+
+		/**
+		 * @brief	Converts window local position to screen position.
+		 */
+		virtual Vector2I windowToScreenPos(const Vector2I& windowPos) const = 0;
+
+		/**
+		 * @brief	Resize the window to specified width and height in pixels.
+		 */
+		void resize(CoreAccessor& accessor, UINT32 width, UINT32 height);
+
+		/**
+		 * @brief	Move the window to specified screen coordinates.
+		 */
+		void move(CoreAccessor& accessor, INT32 left, INT32 top);
+
+		/**
+		 * @brief	Hide the window. (Does not destroy it, just hides it).
+		 */
+		void hide(CoreAccessor& accessor);
+
+		/**
+		 * @brief	Shows a previously hidden window.
+		 */
+		void show(CoreAccessor& accessor);
+
+		/**
+		 * @copydoc	RenderWindowCore::minimize
+		 */
+		void minimize(CoreAccessor& accessor);
+
+		/**
+		 * @copydoc	RenderWindowCore::maximize
+		 */
+		void maximize(CoreAccessor& accessor);
+
+		/**
+		 * @copydoc	RenderWindowCore::restore
+		 */
+		void restore(CoreAccessor& accessor);
+
+		/**
+		 * @copydoc RenderWindowCore::setFullscreen(UINT32, UINT32, float, UINT32)
+		 */
+		void setFullscreen(CoreAccessor& accessor, UINT32 width, UINT32 height, float refreshRate = 60.0f, UINT32 monitorIdx = 0);
+
+		/**
+		 * @copydoc RenderWindowCore::setFullscreen(const VideoMode&)
+		 */
+		void setFullscreen(CoreAccessor& accessor, const VideoMode& mode);
+
+		/**
+		 * @copydoc RenderWindowCore::setWindowed
+		 */
+		void setWindowed(CoreAccessor& accessor, UINT32 width, UINT32 height);
+
+		/**
+		 * @brief	Retrieves a core implementation of a render window usable only from the
+		 *			core thread.
+		 */
+		SPtr<RenderWindowCore> getCore() const;
+
+		/**
+		 * @brief	Returns properties that describe the render window.
+		 */
+		const RenderWindowProperties& getProperties() const;
+
+		/**
+		 * @brief	Creates a new render window using the specified options. Optionally
+		 *			makes the created window a child of another window.
+		 */
+		static RenderWindowPtr create(RENDER_WINDOW_DESC& desc, RenderWindowPtr parentWindow = nullptr);
+
+    protected:
+		friend class RenderWindowManager;
+
+		RenderWindow(const RENDER_WINDOW_DESC& desc, UINT32 windowId);
+
+		/**
+		 * @brief	Returns render window properties that may be edited.
+		 */
+		RenderWindowProperties& getMutableProperties();
+
+		/**
+		 * @copydoc	RenderTarget::createCore
+		 */
+		SPtr<CoreObjectCore> createCore() const override;
+
+		/**
+		 * @brief	Updates window properties from the synced property data.
+		 */
+		virtual void syncProperties() = 0;
+
+	protected:
+		RENDER_WINDOW_DESC mDesc;
+		UINT32 mWindowId;
+    };
+}

+ 140 - 140
BansheeCore/Include/Win32/BsWin32Window.h

@@ -1,141 +1,141 @@
-#pragma once
-
-#include "BsCorePrerequisites.h"
-#include "BsVector2I.h"
-#include "windows.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Descriptor used for creating a platform specific native window.
-	 */
-	struct BS_CORE_EXPORT WINDOW_DESC
-	{
-		WINDOW_DESC()
-			: module(nullptr), monitor(nullptr), parent(nullptr), external(nullptr), width(0), height(0), fullscreen(false)
-			, hidden(false), left(-1), top(-1), title(""), border(WindowBorder::Normal), outerDimensions(false)
-			, enableDoubleClick(true), toolWindow(false), creationParams(nullptr), alphaBlending(false)
-		{ }
-
-		HINSTANCE module; /**< Instance to the local module. */
-		HMONITOR monitor; /**< Handle ot the monitor onto which to display the window. */
-		HWND parent; /**< Optional handle to the parent window if this window is to be a child of an existing window. */
-		HWND external; /**< Optional external window handle if the window was created externally. */
-		void* creationParams; /**< Parameter that will be passed through the WM_CREATE message. */
-		UINT32 width; /**< Width of the window in pixels. */
-		UINT32 height; /**< Height of the window in pixels. */
-		bool fullscreen; /**< Should the window be opened in fullscreen mode. */
-		bool hidden; /**< Should the window be hidden initially. */
-		INT32 left; /**< Window origin on X axis in pixels. -1 == screen center. Relative to provided monitor. */
-		INT32 top; /**< Window origin on Y axis in pixels. -1 == screen center. Relative to provided monitor. */
-		String title; /**< Title of the window. */
-		WindowBorder border; /**< Type of border to create the window with. */
-		bool outerDimensions; /**< Do our dimensions include space for things like title-bar and border. */
-		bool enableDoubleClick; /**< Does window accept double-clicks. */
-		bool toolWindow; /**< Tool windows have a different style than normal windows and can be created with no border or title bar. */
-		PixelDataPtr background; /**< Optional background image to apply to the window. */
-		bool alphaBlending; /**< If true the window will support transparency based on the alpha channel of the background image. */
-	};
-
-	/**
-	 * @brief	Represents a Windows native window.
-	 */
-	class BS_CORE_EXPORT Win32Window
-	{
-	public:
-		Win32Window(const WINDOW_DESC& desc);
-		~Win32Window();
-
-		/**
-         * @brief	Returns position of the left-most border of the window, relative to the screen.
-         */
-		INT32 getLeft() const;
-
-		/**
-         * @brief	Returns position of the top-most border of the window, relative to the screen.
-         */
-		INT32 getTop() const;
-
-		/**
-         * @brief	Returns width of the window in pixels.
-         */
-		UINT32 getWidth() const;
-
-		/**
-         * @brief	Returns height of the window in pixels.
-         */
-		UINT32 getHeight() const;
-
-		/**
-         * @brief	Returns the native window handle.
-         */
-		HWND getHWnd() const;
-
-        /**
-         * @brief	Hide or show the window.
-         */
-        void setHidden(bool hidden);
-
-		/**
-		 * @brief	Restores or minimizes the window.
-		 */
-		void setActive(bool state);
-
-		/**
-		 * @brief	Minimizes the window to the taskbar.
-		 */
-		void minimize();
-
-		/**
-		 * @brief	Maximizes the window over the entire current screen.
-		 */
-		void maximize();
-
-		/**
-		 * @brief	Restores the window to original position and size if it is
-		 *			minimized or maximized.
-		 */
-		void restore();
-
-        /**
-         * @brief	Change the size of the window.
-         */
-        void resize(UINT32 width, UINT32 height);
-
-        /**
-         * @brief	Reposition the window.
-         */
-		void move(INT32 top, INT32 left);
-
-		/**
-		 * @brief	Converts screen position into window local position.
-		 */
-		Vector2I screenToWindowPos(const Vector2I& screenPos) const;
-
-		/**
-		 * @brief	Converts window local position to screen position.
-		 */
-		Vector2I windowToScreenPos(const Vector2I& windowPos) const;
-
-		/**
-		 * @brief	Returns the window style flags used for creating it.
-		 */
-		DWORD getStyle() const;
-
-		/**
-		 * @brief	Returns the extended window style flags used for creating it.
-		 */
-		DWORD getStyleEx() const;
-
-		/**
-		 * @brief	Called when window is moved or resized externally.
-		 *
-		 * @note	Internal method.
-		 */
-		void _windowMovedOrResized();
-
-	private:
-		struct Pimpl;
-		Pimpl* m;
-	};
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsVector2I.h"
+#include "windows.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Descriptor used for creating a platform specific native window.
+	 */
+	struct BS_CORE_EXPORT WINDOW_DESC
+	{
+		WINDOW_DESC()
+			: module(nullptr), monitor(nullptr), parent(nullptr), external(nullptr), width(0), height(0), fullscreen(false)
+			, hidden(false), left(-1), top(-1), title(""), border(WindowBorder::Normal), outerDimensions(false)
+			, enableDoubleClick(true), toolWindow(false), creationParams(nullptr), alphaBlending(false)
+		{ }
+
+		HINSTANCE module; /**< Instance to the local module. */
+		HMONITOR monitor; /**< Handle ot the monitor onto which to display the window. */
+		HWND parent; /**< Optional handle to the parent window if this window is to be a child of an existing window. */
+		HWND external; /**< Optional external window handle if the window was created externally. */
+		void* creationParams; /**< Parameter that will be passed through the WM_CREATE message. */
+		UINT32 width; /**< Width of the window in pixels. */
+		UINT32 height; /**< Height of the window in pixels. */
+		bool fullscreen; /**< Should the window be opened in fullscreen mode. */
+		bool hidden; /**< Should the window be hidden initially. */
+		INT32 left; /**< Window origin on X axis in pixels. -1 == screen center. Relative to provided monitor. */
+		INT32 top; /**< Window origin on Y axis in pixels. -1 == screen center. Relative to provided monitor. */
+		String title; /**< Title of the window. */
+		WindowBorder border; /**< Type of border to create the window with. */
+		bool outerDimensions; /**< Do our dimensions include space for things like title-bar and border. */
+		bool enableDoubleClick; /**< Does window accept double-clicks. */
+		bool toolWindow; /**< Tool windows have a different style than normal windows and can be created with no border or title bar. */
+		PixelDataPtr background; /**< Optional background image to apply to the window. */
+		bool alphaBlending; /**< If true the window will support transparency based on the alpha channel of the background image. */
+	};
+
+	/**
+	 * @brief	Represents a Windows native window.
+	 */
+	class BS_CORE_EXPORT Win32Window
+	{
+	public:
+		Win32Window(const WINDOW_DESC& desc);
+		~Win32Window();
+
+		/**
+         * @brief	Returns position of the left-most border of the window, relative to the screen.
+         */
+		INT32 getLeft() const;
+
+		/**
+         * @brief	Returns position of the top-most border of the window, relative to the screen.
+         */
+		INT32 getTop() const;
+
+		/**
+         * @brief	Returns width of the window in pixels.
+         */
+		UINT32 getWidth() const;
+
+		/**
+         * @brief	Returns height of the window in pixels.
+         */
+		UINT32 getHeight() const;
+
+		/**
+         * @brief	Returns the native window handle.
+         */
+		HWND getHWnd() const;
+
+        /**
+         * @brief	Hide or show the window.
+         */
+        void setHidden(bool hidden);
+
+		/**
+		 * @brief	Restores or minimizes the window.
+		 */
+		void setActive(bool state);
+
+		/**
+		 * @brief	Minimizes the window to the taskbar.
+		 */
+		void minimize();
+
+		/**
+		 * @brief	Maximizes the window over the entire current screen.
+		 */
+		void maximize();
+
+		/**
+		 * @brief	Restores the window to original position and size if it is
+		 *			minimized or maximized.
+		 */
+		void restore();
+
+        /**
+         * @brief	Change the size of the window.
+         */
+        void resize(UINT32 width, UINT32 height);
+
+        /**
+         * @brief	Reposition the window.
+         */
+		void move(INT32 left, INT32 top);
+
+		/**
+		 * @brief	Converts screen position into window local position.
+		 */
+		Vector2I screenToWindowPos(const Vector2I& screenPos) const;
+
+		/**
+		 * @brief	Converts window local position to screen position.
+		 */
+		Vector2I windowToScreenPos(const Vector2I& windowPos) const;
+
+		/**
+		 * @brief	Returns the window style flags used for creating it.
+		 */
+		DWORD getStyle() const;
+
+		/**
+		 * @brief	Returns the extended window style flags used for creating it.
+		 */
+		DWORD getStyleEx() const;
+
+		/**
+		 * @brief	Called when window is moved or resized externally.
+		 *
+		 * @note	Internal method.
+		 */
+		void _windowMovedOrResized();
+
+	private:
+		struct Pimpl;
+		Pimpl* m;
+	};
 }

+ 1 - 1
BansheeCore/Source/Win32/BsWin32Window.cpp

@@ -211,7 +211,7 @@ namespace BansheeEngine
 		bs_delete(m);
 	}
 
-	void Win32Window::move(INT32 top, INT32 left)
+	void Win32Window::move(INT32 left, INT32 top)
 	{
 		if (m->hWnd)
 		{

+ 2 - 2
BansheeD3D11RenderAPI/Source/BsD3D11RenderWindow.cpp

@@ -176,7 +176,7 @@ namespace BansheeEngine
 		}
 	}
 
-	void D3D11RenderWindowCore::move(INT32 top, INT32 left)
+	void D3D11RenderWindowCore::move(INT32 left, INT32 top)
 	{
 		THROW_IF_NOT_CORE_THREAD;
 
@@ -184,7 +184,7 @@ namespace BansheeEngine
 
 		if (!props.mIsFullScreen)
 		{
-			mWindow->move(top, left);
+			mWindow->move(left, top);
 
 			props.mTop = mWindow->getTop();
 			props.mLeft = mWindow->getLeft();

+ 2 - 2
BansheeD3D9RenderAPI/Source/BsD3D9RenderWindow.cpp

@@ -251,7 +251,7 @@ namespace BansheeEngine
 		mWindow->restore();
 	}
 
-	void D3D9RenderWindowCore::move(INT32 top, INT32 left)
+	void D3D9RenderWindowCore::move(INT32 left, INT32 top)
 	{
 		THROW_IF_NOT_CORE_THREAD;
 
@@ -259,7 +259,7 @@ namespace BansheeEngine
 
 		if (!props.mIsFullScreen)
 		{
-			mWindow->move(top, left);
+			mWindow->move(left, top);
 
 			props.mTop = mWindow->getTop();
 			props.mLeft = mWindow->getLeft();

+ 1 - 1
BansheeGLRenderAPI/Source/BsWin32RenderWindow.cpp

@@ -321,7 +321,7 @@ namespace BansheeEngine
 		Win32RenderWindowProperties& props = mProperties;
 		if (!props.mIsFullScreen)
 		{
-			mWindow->move(top, left);
+			mWindow->move(left, top);
 
 			props.mTop = mWindow->getTop();
 			props.mLeft = mWindow->getLeft();

+ 0 - 75
TODO.txt

@@ -8,8 +8,6 @@ Other polish:
   - Edit: Cut/Copy/Paste/Duplicate/Delete(need to make sure it works in Hierarchy, with shortcuts), View/Move/rotate/scale
   - Game Object (also add to context): Create(Empty, Empty Child, Camera, Renderable, Point/Spot/Directional Light), Apply prefab, Break prefab, Revert prefab
  - Inspector persistance (See below for details)
-
-Optional:
  - Ortographic camera views (+ gizmo in scene view corner that shows camera orientation) (Use custom handles and implement this?)
  - Add tooltips to toolbar items and other buttons with icons
  - Undo/Redo
@@ -18,11 +16,8 @@ Optional:
   - There should be a CmdRecordSO equivalent for resources (probably)
   - Add commands for breaking or reverting a scene object 
   - Test & finalize undo/redo system
- - Test VS 2015 Community as code editor (possibly also move the code to VS 2015)
-  - Add drop down in Settings with external code editor
  - Drag and drop of a mesh into Hierarchy doesn't instantiate it
  - Drag and dropping a prefab onto the scene (or hierarchy) should work the same as with meshes
- - Undocking of editor window doesn't work (they just get lost)
  - Start editor in fullscreen
  - If user clears the default shader he has no way of re-assigning it - add default shader to project folder? (needs to be packaged with project)
  - Toggle to enable/disable SceneObject in Inspector (+ Fade out disabled objects in hierarchy)
@@ -30,36 +25,6 @@ Optional:
  - Cursors should be replaced with better ones, or at least hot-spots fixed
  - Either disable light tool icons before release or make them functional (With gizmos)
 
- More optional:
- - Gizmo icons for camera & light
- - Add a way to use GUI elements in game window (Default GUI available to all, plus GUIWidget component for custom ones. Make sure skin can be changed for both.)
- - If a field gets optimized out from a material's GPU program it won't get persisted by the inspector (or serialized)
-  - (i.e. the field exists in shader desc but not as a GPU variable)
-  - I should probably store a copy of all shader fields in Material itself (and serialize that)
-   - When I modify this make sure to copy parameter copying method that is called when shader changes (that persist parameters)
- - When starting play-in-editor, automatically make the Game Window active
- - Need to list all script components in the Components menu
- - When resizing library window while docked, selection area appears
- - Slow camera rotation at high fps (just limit FPS probably)
- - When starting drag from hierarchy tree view it tends to select another object (can't repro)
- - Handle seems to lag behind the selected mesh
- - Move all the code files into subfolders so their hierarchy is similar to VS filters
- - MenuBar - will likely need a way to mark elements as disabled when not appropriate (e.g. no "frame selected unless scene is focused")
-   - Likely use a user-provided callback to trigger when populating the menus (I already added a callback to MenuItem, just need to implement it)
- - Word wrap weirdness
-   - When a GUI element containing a long piece of text is created, and it has flexible size, the initial optimal size
-     calculation will try to fit all the text in one row, even if during the actual size calculation that turns out to be impossible.
-     What happens then is that the text is rendered into multiple rows but its visible area only shows the first row.
-
-Seriously optional:
- - Drag to select in scene view
- - Coroutines
- - Automatically generate readable inspector names and add [Name] attribute that allows custom naming
- - Add Range[] attribute to C# that forces a float/int to be displayed as a slider
- - GUI tabbing to switch between elements
- - Better Prefab inspector - display SceneObject inspector of top-level object, and possibly prefab hierarchy?
- - Do another optimization pass
-
 Finalizing:
  - Add copyright notices in all files & change license to GPL
  - Need to generate a proper merge of dev and preview branches
@@ -113,46 +78,6 @@ the message loop and causes another exception. Make sure to look for the origina
 Finalizers on attribute members will get called more than once. This causes issues if some of the members reference native 
 objects as already deleted native objects will try to be deleted again. 
 
-----------------------------------------------------------------------
-MenuItem
-
- - Add keyboard controls to GUIMenuBar (left/right arrows should move between entries if user is not browsing a sub-menu)
-  - esc should cancel out of the menu bar
-  - alt should focus the menu bar
-
-----------------------------------------------------------------------
-VisualStudio integration
-
- - VS integration will likely not work with VSExpress or Community edition
-  - VSExpress doesn't support EnvDTE so the only option is to open it using a shell command which doesn't seem to offer precise parameters
-  - Community edition should work similarily to Pro, but might have a different executable and/or registry paths
- - Make sure that 3rd party assemblies can be imported in the project, and that they are properly referenced in VS project generation and compilation
- - Support Visual Studio Code on other platforms
-
-----------------------------------------------------------------------
-Library window
-
- - Might need to improve search (need to test). Do multiple search keywords work properly?
- - Consider delaying search until user stops pressing keys (so not to have thousands of search results in the initial stages)
- - Save & restore scroll position when Refresh happens
-
-----------------------------------------------------------------------
-Handles
-
- - Ideally free scale handle indicator should always render and be interactable and never be hidden by axis scale indicators (Not high priority)
- - Raycast snapping Ribek suggested
-
-----------------------------------------------------------------------
-Include files:
-
- - Test if default values work
- - Test project library dependant resources (e.g. changing an include and seeing if shader is reimported)
-
-----------------------------------------------------------------------
-Scene View
-
-Test custom handles from C#
-
 ----------------------------------------------------------------------
 C# Material/Shader