/*--------------------------------------------------------

    DirectX utility library for sample

    Copyright (C) 2008 SEGA Corporation Library R&D Dept.
    All Rights Reserved.

    Module  : DirectX utility library for sample
    File    : smpDx.h
    Create  : 2008/06/13 (Ver.0.10.01)
    Modify  : 2009/01/19 (Ver.0.10.02)
			    ・setIncludeCallbackFunc 関数を追加。
				・getD3DXInclude 関数を追加。
    Version : 0.10.02
    Note    : 

--------------------------------------------------------*/

#ifndef __SMPDX_H__
#define __SMPDX_H__

//--------------------
// 組み込みファイル名
//--------------------
#include <d3d9.h>
#include <d3dx9.h>

#ifndef _smpDxRelease
#define _smpDxRelease(p)      { if(p) { (p)->Release(); (p)=NULL; } }
#endif

//-
//
//-
class CSmpDx{
public:
	enum{
		FLAG_QUIT		= (1<<0)
	};

public:
	enum{
		INCLUDE_MODE_OPEN,
		INCLUDE_MODE_CLOSE
	};
	typedef HRESULT (*INCLUDE_CALLBACK_FUNC)( UINT mode, UINT argc, LPCVOID argv[]);

private:
	static LPDIRECT3D9				m_pD3d;
	static LPDIRECT3DDEVICE9		m_pD3ddev;
	static D3DPRESENT_PARAMETERS	m_d3dpp;

	static UINT32					m_flag;

public:
	static void		init(HWND hWnd);
	static void		initFullScreen(UINT width, UINT height, D3DFORMAT format, UINT refreshRate, BOOL enb=FALSE);

	static HRESULT	create(void);
	static void		release(void);

private:
	static void						changeFullScreenStyle(void);
public:
	static HRESULT					changeFullScreenMode(void);
	static HRESULT					changeWindowMode(void);

public:
	static LPDIRECT3D9				getDirect3D(void){return(m_pD3d);}
	static LPDIRECT3DDEVICE9		getDirect3DDevice(void){return(m_pD3ddev);}
	static D3DPRESENT_PARAMETERS	*getD3DPresentParameters(void){return(&m_d3dpp);}

	static void						addFlag(UINT32 fg){m_flag|=fg;}
	static void                     setFlag(UINT32 fg){m_flag=fg;}
	static UINT32					getFlag(void){return(m_flag);}

	static void						setIncludeCallbackFunc(INCLUDE_CALLBACK_FUNC func);
	static LPD3DXINCLUDE			getD3DXInclude(void);
};

#endif	// ifndef __SMPDX_H__
