?? dx8enumeration.h
字號:
#ifndef __DX8ENUMERAIION_H__
#define __DX8ENUMERATION_H__
#ifndef __D3D8PREREQUISITES_H__
# include "DX8Prerequisites.h"
#endif
//錯誤代碼
#define D3DAPPERR_NODIRECT3D 0x82000001
#define D3DAPPERR_NOWINDOW 0x82000002
#define D3DAPPERR_NOCOMPATIBLEDEVICES 0x82000003
#define D3DAPPERR_NOWINDOWABLEDEVICES 0x82000004
#define D3DAPPERR_NOHARDWAREDEVICE 0x82000005
#define D3DAPPERR_HALNOTCOMPATIBLE 0x82000006
#define D3DAPPERR_NOWINDOWEDHAL 0x82000007
#define D3DAPPERR_NODESKTOPHAL 0x82000008
#define D3DAPPERR_NOHALTHISMODE 0x82000009
#define D3DAPPERR_NONZEROREFCOUNT 0x8200000a
#define D3DAPPERR_MEDIANOTFOUND 0x8200000b
#define D3DAPPERR_RESIZEFAILED 0x8200000c
#define D3DAPPERR_NULLREFDEVICE 0x8200000d
namespace QGE
{
namespace VISUAL
{
//-----------------------------------------------------------------------------
// Name: struct D3DModeInfo
// Desc: Structure for holding information about a display mode
//-----------------------------------------------------------------------------
struct D3DModeInfo
{
DWORD Width; // Screen width in this mode
DWORD Height; // Screen height in this mode
D3DFORMAT Format; // Pixel format in this mode
DWORD dwBehavior; // Hardware / Software / Mixed vertex processing
D3DFORMAT DepthStencilFormat; // Which depth/stencil format to use with this mode
};
//-----------------------------------------------------------------------------
// Name: struct D3DDeviceInfo
// Desc: Structure for holding information about a Direct3D device, including
// a list of modes compatible with this device
//-----------------------------------------------------------------------------
struct D3DDeviceInfo
{
// Device data
D3DDEVTYPE DeviceType; // Reference, HAL, etc.
D3DCAPS8 d3dCaps; // Capabilities of this device
const TCHAR* strDesc; // Name of this device
BOOL bCanDoWindowed; // Whether this device can work in windowed mode
// Modes for this device
DWORD dwNumModes;
D3DModeInfo modes[150];
// Current state
DWORD dwCurrentMode;
BOOL bWindowed;
D3DMULTISAMPLE_TYPE MultiSampleTypeWindowed;
D3DMULTISAMPLE_TYPE MultiSampleTypeFullscreen;
};
//-----------------------------------------------------------------------------
// Name: struct D3DAdapterInfo
// Desc: Structure for holding information about an adapter, including a list
// of devices available on this adapter
//-----------------------------------------------------------------------------
struct D3DAdapterInfo
{
// Adapter data
D3DADAPTER_IDENTIFIER8 d3dAdapterIdentifier;
D3DDISPLAYMODE d3ddmDesktop; // Desktop display mode for this adapter
// Devices for this adapter
DWORD dwNumDevices;
D3DDeviceInfo devices[5];
// Current state
DWORD dwCurrentDevice;
};
class _D3D8Export DX8Enumeration
{
public:
DX8Enumeration(LPDIRECT3D8 pd3d,
Bool bDepthStencil=true,Bool bMixedVP=false,Int32 minDepthBits=16,Int32 MinStencilBits=0);
/************************************************************************/
/* 創建設備列表 */
/************************************************************************/
HRESULT BuildDeviceList();
/************************************************************************/
/* 查找合適的深度和模版緩沖模式 */
/************************************************************************/
BOOL FindDepthStencilFormat( UINT iAdapter, D3DDEVTYPE DeviceType,
D3DFORMAT TargetFormat, D3DFORMAT* pDepthStencilFormat );
/************************************************************************/
/* 設備選擇對話框 */
/************************************************************************/
D3DAdapterInfo& GetAdapter(Int32 idx) const;
Int32 GetAdapterNum() const;
D3DAdapterInfo& GetCurrentAdapter() const;
Int32 GetCurrentAdapterIdx() const;
void SetCurrentAdapterIdx(Int32 idx);
Bool IsUseDepthStencilBuffer();
void UseDepthStencilBuffer(Bool use);
Bool IsMixedVertexProcessing();
void UseMixedVertexProcessing(Bool use);
private:
LPDIRECT3D8 m_pd3d;
D3DAdapterInfo m_Adapters[10];
Int32 m_dwNumAdapters;
Bool m_bDepthStencil;
Bool m_bMixedVertexProcessing;
DWORD m_dwMinDepthBits;
DWORD m_dwMinStencilBits;
DWORD m_CurrentAdapter;
};
}
}
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -