CrystalSpace

Public API Reference

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | 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_dx.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 
00036 class CS_CSPLUGINCOMMON_DX_EXPORT DirectDetectionDevice
00037 {
00038 public:
00039   DirectDetectionDevice() : Windowed(false), IsPrimary2D(true), 
00040     DeviceName2D(0), DeviceDescription2D(0)
00041   {
00042     ZeroMemory (&Guid2D, sizeof(GUID));
00043   }
00044   DirectDetectionDevice (const DirectDetectionDevice& other) :
00045     Windowed (other.Windowed), IsPrimary2D (other.IsPrimary2D)
00046   {
00047     memcpy (&Guid2D, &other.Guid2D, sizeof (GUID));
00048     DeviceName2D = csStrNew (other.DeviceName2D);
00049     DeviceDescription2D = csStrNew (other.DeviceDescription2D);
00050   }
00051   ~DirectDetectionDevice()
00052   {
00053     delete[] DeviceName2D;
00054     delete[] DeviceDescription2D;
00055   }
00056 
00057   GUID Guid2D;                // Guid for DirectDraw device
00058   bool Windowed;              // Can enable windowed mode for graphics ?
00059   bool IsPrimary2D;           // Is a primary ddraw device ?
00060   char * DeviceName2D;        // Name of device
00061   char * DeviceDescription2D; // Description of device
00062 };
00063 
00064 // master class of the device detection of direct3d and directdraw
00065 class CS_CSPLUGINCOMMON_DX_EXPORT DirectDetection
00066 {
00067 public:
00068   bool Have2DDevice();
00069   DirectDetection();
00070   virtual ~DirectDetection();
00071   const DirectDetectionDevice* FindBestDevice (int displayNumber = 0);
00072   int AddDevice (const DirectDetectionDevice& dd2d);
00073   bool CheckDevices();
00074   bool CheckDevices2D();
00075 
00076   void ReportResult (int severity, char *str, HRESULT hRes);
00077   void SystemFatalError (char *str, HRESULT hRes);
00078 
00079   csArray<DirectDetectionDevice> Devices; // list of devices
00080   iObjectRegistry* object_reg;
00081 };
00082 
00083 #endif // __CS_DIRECTDETECTION_H__

Generated for Crystal Space by doxygen 1.4.4