Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages
directdetection.h
00001 /* 00002 Copyright (C) 1998 by Jorrit Tyberghein 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_DIRECTDETECTION_H__ 00020 #define __CS_DIRECTDETECTION_H__ 00021 00022 #include "csextern.h" 00023 00024 #if WINVER >= 0x0500 00025 #define DIRECTINPUT_VERSION 0x0800 00026 #else 00027 #define DIRECTINPUT_VERSION 0x0300 00028 #endif 00029 00030 #include <windows.h> 00031 #include <ddraw.h> 00032 #include <d3d.h> 00033 #include <d3dcaps.h> 00034 00035 #include "csplugincommon/directx/iddetect.h" 00036 00038 class CS_CSPLUGINCOMMON_DX_EXPORT DirectDetection2D 00039 { 00040 public: 00041 DirectDetection2D() 00042 { 00043 Mipmap = false; Texture = false; Can3D = false; Windowed = false; 00044 IsPrimary2D = true; DeviceName2D = 0; DeviceDescription2D = 0; 00045 ZeroMemory(&Guid2D, sizeof(GUID)); 00046 } 00047 virtual ~DirectDetection2D() 00048 { 00049 } 00050 00051 bool Mipmap; // Can enable ddraw surface as mipmap ? 00052 bool Texture; // Can enable ddraw surface as texture ? 00053 GUID Guid2D; // Guid for DirectDraw device 00054 bool Can3D; // Have a support for d3d device ? 00055 bool Windowed; // Can enable windowed mode for graphics ? 00056 bool IsPrimary2D; // Is a primary ddraw device ? 00057 char * DeviceName2D; // Name of device 00058 char * DeviceDescription2D; // Description of device 00059 }; 00060 00062 class CS_CSPLUGINCOMMON_DX_EXPORT DirectDetection3D : public DirectDetection2D 00063 { 00064 public: 00065 // construct a device from ddraw (2d) device 00066 DirectDetection3D(DirectDetection2D * dd2d) 00067 { 00068 Hardware = false; AlphaBlendType = 0; AlphaBlend = false, AlphaBlendHalo = false; 00069 Perspective = false; HighColor = false; ZBuffer = false; 00070 ZeroMemory(&Desc3D, sizeof(D3DDEVICEDESC)); 00071 ZeroMemory(&Guid3D, sizeof(GUID)); 00072 DeviceName3D = 0; DeviceDescription3D = 0; 00073 IsPrimary3D = true; 00074 00075 memcpy((DirectDetection2D *)this, dd2d, sizeof(DirectDetection2D)); 00076 } 00077 DirectDetection3D():DirectDetection2D() 00078 { 00079 Hardware = false; AlphaBlendType = 0; AlphaBlend = false, AlphaBlendHalo = false; 00080 Perspective = false; HighColor = false; ZBuffer = false; 00081 ZeroMemory(&Desc3D, sizeof(D3DDEVICEDESC)); 00082 ZeroMemory(&Guid3D, sizeof(GUID)); 00083 DeviceName3D = 0; DeviceDescription3D = 0; 00084 IsPrimary3D = true; 00085 } 00086 virtual ~DirectDetection3D() {} 00087 00088 bool Hardware; // Is hardware device ? 00089 bool AlphaBlend; // Can enable AlphaBlend for lightmap ? 00090 bool AlphaBlendHalo; // Can enable AlphaBlend for halo ? 00091 int AlphaBlendType; // type of AphaBlend supported 00092 bool Perspective; // Can enable perspective ? 00093 bool VideoMemoryTexture; // Can push texture in video memory ? 00094 bool HighColor; // Can enable 16 bit mode 00095 bool ZBuffer; // Have a ZBuffer ? 00096 D3DDEVICEDESC Desc3D; // D3DDEVICEDESC for complete information 00097 GUID Guid3D; // Guid for Direct3D device 00098 bool IsPrimary3D; // Is a primary d3d device ? 00099 char * DeviceName3D; // Device name 00100 char * DeviceDescription3D; // Device description 00101 }; 00102 00104 class CS_CSPLUGINCOMMON_DX_EXPORT DirectDetectionDevice : public DirectDetection3D, 00105 public IDirectDetectionInternal 00106 { 00107 public: 00108 DirectDetectionDevice():DirectDetection3D() {next = 0; Only2D = true;} 00109 virtual ~DirectDetectionDevice() {} 00110 00111 bool Only2D; // Is only a 2d device ? 00112 DirectDetectionDevice * next; 00113 00114 STDMETHODIMP_(LPD3DDEVICEDESC) GetDesc3D() { return &Desc3D; } 00115 STDMETHODIMP_(LPGUID) GetGuid3D() { return &Guid3D; } 00116 STDMETHODIMP_(bool) GetMipmap() { return Mipmap; } 00117 STDMETHODIMP_(bool) GetAlphaBlend() { return AlphaBlend; } 00118 STDMETHODIMP_(int) GetAlphaBlendType() { return AlphaBlendType; } 00119 STDMETHODIMP_(bool) GetAlphaBlendHalo() { return AlphaBlendHalo; } 00120 STDMETHODIMP_(bool) GetHardware() { return Hardware; } 00121 }; 00122 00123 // master class of the device detection of direct3d and directdraw 00124 class CS_CSPLUGINCOMMON_DX_EXPORT DirectDetection 00125 { 00126 public: 00127 bool Have2DDevice(); 00128 bool Have3DDevice(); 00129 DirectDetection(); 00130 virtual ~DirectDetection(); 00131 DirectDetectionDevice * findBestDevice3D(bool fscreen); 00132 DirectDetectionDevice * findBestDevice2D(int displayNumber = 0); 00133 int addDevice(DirectDetection2D * dd2d); 00134 int addDevice(DirectDetection3D * dd3d); 00135 bool checkDevices(); 00136 bool checkDevices2D(); 00137 bool checkDevices3D(); 00138 00139 void ReportResult (int severity, char *str, HRESULT hRes); 00140 void SystemFatalError (char *str, HRESULT hRes); 00141 00142 DirectDetectionDevice * Devices; // list of devices 00143 iObjectRegistry* object_reg; 00144 }; 00145 00146 #endif // __CS_DIRECTDETECTION_H__
Generated for Crystal Space by doxygen 1.3.9.1