//-----------------------------------------------------------------------------------------------
// Application_Win32.hpp
//
#pragma once
#ifndef include_Application_Win32
#define include_Application_Win32

//-----------------------------------------------------------------------------------------------
#include "Engine/Core/Application.hpp"
#include "Engine/Core/PlatformSpecificHeaders.hpp"


/////////////////////////////////////////////////////////////////////////////////////////////////
class Application_Win32 : public Application
{
public:
	Application_Win32( HINSTANCE applicationInstanceHandle );
	virtual ~Application_Win32();
	virtual void		BeginFrame();
	virtual void		ShutDown();
	virtual void		CreateOSWindow( bool isFullscreen, const IntVector2& clientAreaSize );
	virtual void		DestroyOSWindow();
	virtual IntVector2	GetDesktopResolution() const;
	virtual void		SleepSeconds( double secondsToSleep );

protected:
	virtual void		UpdateCursorNormalizedCoords();
	virtual void		SetNativeCursorVisibility( bool isVisible );

protected:
	void				PopulateWindowClassDescription( WNDCLASSEX& out_windowClassDescription );
	void				PopulateWindowStyleFlags( bool isFullscreen, DWORD& out_windowStyleFlags, DWORD& out_windowStyleExFlags );
	void				PopulateClientAndWindowRect( const IntVector2& clientAreaSize, DWORD windowStyleFlags, DWORD windowStyleExFlags );
	RECT				GetWindowsDesktopRect() const;
	void				ClampWindowRectToDesktop( const bool forceResize );
	void				RunWin32MessagePump();
	virtual void		SnapCursorToNormalizedCoords( const Vector2& newNormalizedCoords );
	virtual IntVector2	GetCursorPhysicalClientCoords() const;
	virtual void		SnapCursorToPhysicalClientCoords( const IntVector2& newCursorClientCoords );

protected:
	HINSTANCE			m_applicationInstanceHandle; // the Windows app "hInstance"
	HWND				m_windowHandle; // the main window Windows "hWnd"
	RECT				m_clientRect; // Usable area within the window frame (where we can render 3D graphics) - entire screen if fullscreen
	RECT				m_windowRect; // Total area including the outer window frame - entire screen if fullscreen
	IntVector2			m_clientAreaOffset;
	bool				m_hasFocus;
	HCURSOR				m_defaultCursor;
	HCURSOR				m_customCursor;
};


#endif // include_Application_Win32
