/* -*- c++ -*- FILE: WrapD3D.h RCS REVISION: $Revision: 1.8 $ COPYRIGHT: (c) 1999 -- 2003 Melinda Green, Don Hatch, and Jay Berkenbilt - Superliminal Software LICENSE: Free to use and modify for non-commercial purposes as long as the following conditions are adhered to: 1) Obvious credit for the source of this code and the designs it embodies are clearly made, and 2) Ports and derived versions of 4D Magic Cube programs are not distributed without the express written permission of the authors. DESCRIPTION: Abstraction on top of DirectX */ #ifndef WrapD3D_h #define WrapD3D_h #include "WrapDD.h" #include class WrapD3D:public WrapDD { struct Direct3DDeviceInfo { char Desc[50]; char Name[30]; D3DDEVICEDESC HWDesc; D3DDEVICEDESC HELDesc; GUID Guid; void Initialize(const GUID * pGuid, const char *pDeviceDescription, const char *pDeviceName, const LPD3DDEVICEDESC pHWDesc, const LPD3DDEVICEDESC pHELDesc) { memcpy(&Guid, pGuid, sizeof(GUID)); strcpy(Desc, pDeviceDescription); strcpy(Name, pDeviceName); memcpy(&HWDesc, pHWDesc, sizeof(HWDesc)); memcpy(&HELDesc, pHELDesc, sizeof(HELDesc)); } }; enum { maxDeviceInfoCount = 5 }; public: WrapD3D(); ~WrapD3D(); BOOL Create(HWND, BOOL fullScreen, int width, int height, int bpp, const PALETTEENTRY * pPaletteEntries, int pPaletteEntryCount, bool software_render_only = false); void Destroy(); void DestroyButNotDirectDraw(); const char *ErrorToString(HRESULT); IDirect3D *Direct3D() { return m_pDirect3D; } IDirect3DDevice *Direct3DDevice() { return m_pDirect3DDevice; } protected: BOOL D3DCreate(); BOOL D3DInit(); BOOL D3DSetMode(); int ZBufferDepth(Direct3DDeviceInfo *); BOOL FilterDisplayModes(LPDDSURFACEDESC); HRESULT EnumDevicesCallback(GUID *, char *, char *, LPD3DDEVICEDESC, LPD3DDEVICEDESC); static HRESULT CALLBACK EnumDevicesCallback(GUID *, char *, char *, LPD3DDEVICEDESC, LPD3DDEVICEDESC, void *); private: Direct3DDeviceInfo m_deviceInfo[maxDeviceInfoCount]; Direct3DDeviceInfo *m_pCurrentDeviceInfo; int m_deviceInfoCount; IDirect3D *m_pDirect3D; IDirect3DDevice *m_pDirect3DDevice; BOOL m_bTexturesDisabled; }; #endif /* WrapD3D_h */ // Local Variables: // c-basic-offset: 4 // c-comment-only-line-offset: 0 // c-file-offsets: ((defun-block-intro . +) (block-open . 0) (substatement-open . 0) (statement-cont . +) (statement-case-open . +4) (arglist-intro . +) (arglist-close . +) (inline-open . 0)) // indent-tabs-mode: nil // End: