## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# csplugincommon/directx/directdetection.h

Go to the documentation of this file.

    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 #include "csutil/array.h"
    00024
    00025 #include <windows.h>
    00026 #include <ddraw.h>
    00027
    00034
    00035 class CS_CSPLUGINCOMMON_DX_EXPORT DirectDetectionDevice
    00036 {
    00037 public:
    00038   DirectDetectionDevice() : Windowed(false), IsPrimary2D(true),
    00039     DeviceName2D(0), DeviceDescription2D(0)
    00040   {
    00041     ZeroMemory (&Guid2D, sizeof(GUID));
    00042   }
    00043   DirectDetectionDevice (const DirectDetectionDevice& other) :
    00044     Windowed (other.Windowed), IsPrimary2D (other.IsPrimary2D)
    00045   {
    00046     memcpy (&Guid2D, &other.Guid2D, sizeof (GUID));
    00047     DeviceName2D = csStrNew (other.DeviceName2D);
    00048     DeviceDescription2D = csStrNew (other.DeviceDescription2D);
    00049   }
    00050   ~DirectDetectionDevice()
    00051   {
    00052     delete[] DeviceName2D;
    00053     delete[] DeviceDescription2D;
    00054   }
    00055
    00057   GUID Guid2D;
    00059   bool Windowed;
    00061   bool IsPrimary2D;
    00063   char * DeviceName2D;
    00065   char * DeviceDescription2D;
    00066 };
    00067
    00069 class CS_CSPLUGINCOMMON_DX_EXPORT DirectDetection
    00070 {
    00071 public:
    00072   bool Have2DDevice();
    00073   DirectDetection();
    00074   virtual ~DirectDetection();
    00075   const DirectDetectionDevice* FindBestDevice (int displayNumber = 0);
    00076   int AddDevice (const DirectDetectionDevice& dd2d);
    00077   bool CheckDevices();
    00078   bool CheckDevices2D();
    00079
    00080   void ReportResult (int severity, char *str, HRESULT hRes);
    00081   void SystemFatalError (char *str, HRESULT hRes);
    00082
    00084   csArray<DirectDetectionDevice> Devices;
    00085   iObjectRegistry* object_reg;
    00086 };
    00087
    00090 #endif // __CS_DIRECTDETECTION_H__