00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://ogre.sourceforge.net/ 00006 00007 Copyright © 2000-2002 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 #ifndef __DDDRIVER_H__ 00026 #define __DDDRIVER_H__ 00027 00028 // Precompiler options 00029 #include "OgreD3D7Prerequisites.h" 00030 00031 // Declaration 00032 #include "OgreString.h" 00033 #include <ddraw.h> 00034 #include <d3d.h> 00035 00036 namespace Ogre { 00037 00038 class D3DDeviceList; 00039 class DDVideoModeList; 00040 class DDVideoMode; 00041 class D3DDevice; 00042 00043 00047 class _OgreD3DExport DDDriver 00048 { 00049 private: 00050 00051 String mDriverName; 00052 String mDriverDesc; 00053 GUID mGuid; // Note - copy of GUID, not pointer to 00054 bool mPrimaryDisplay; 00055 00056 LPDIRECTDRAW7 lpDD7; // pointer to IDirectDraw7 interface 00057 LPDIRECT3D7 lpD3D; // pointer to IDirect3D7 interface (if required) 00058 D3DDeviceList* mDeviceList; // List of Direct3D devices 00059 DDVideoModeList* mVideoModeList; // List of video modes 00060 D3DDevice* active3DDevice; 00061 DDVideoMode* activeVideoMode; 00062 HWND activeHWnd; 00063 00064 DDCAPS mSWCaps; // Software capabilities 00065 DDCAPS mHWCaps; // Hardware capabilities 00066 void logCaps(void); 00067 00068 LPDIRECTDRAWSURFACE7 lpDDSPrimary; // Pointer to primary surface 00069 LPDIRECTDRAWSURFACE7 lpDDSBack; // Pointer to back buffer 00070 00071 bool runningFullScreen; 00072 bool using3DMode; 00073 00074 RECT rcViewport; //Only used for windowed mode 00075 LPDIRECTDRAWCLIPPER lpDDClipper; 00076 00077 // Private accessor functions 00078 00079 void RestoreSurfaces(void); 00080 00081 00082 00083 public: 00084 // Constructors 00085 DDDriver(); // Default 00086 DDDriver(const DDDriver &ob); // Copy 00087 DDDriver(GUID FAR *lpGuid, // Create from enum 00088 LPSTR lpDriverDescription, 00089 LPSTR lpDriverName); 00090 // Destructor 00091 ~DDDriver(); 00092 00116 void createWindowSurfaces(HWND hWnd, int width, int height, int colourDepth, bool fullScreen, 00117 LPDIRECTDRAWSURFACE7 *front, LPDIRECTDRAWSURFACE7 *back); 00118 00119 void Cleanup(void); 00120 void CheckWindow(void); 00121 00122 // Overloaded operator = 00123 DDDriver operator=(const DDDriver &orig); 00124 00125 // Information accessors 00126 String DriverName(void); 00127 String DriverDescription(void); 00128 LPDIRECTDRAW7 directDraw(); // Gets lpDD7 (instantiates if required) 00129 00130 D3DDeviceList* get3DDeviceList(void); 00131 DDVideoModeList* getVideoModeList(void); 00132 DDVideoMode* getActiveVideoMode(void); 00133 00134 // Retrieval of other objects 00135 D3DDevice* get3DDevice(void); 00136 00137 void OutputText(int x, int y, char* text); 00138 void FlipBuffers(void); 00139 bool RunningFullScreen(void); 00140 RECT ViewportRect(void); 00141 00142 // Capabilities 00143 bool Has3DAcceleration(void); 00144 bool CanRenderWindowed(void); 00145 00146 // Generalised info 00147 void GetDisplayDetails(int& width, int& height, int& colourDepth); 00148 }; 00149 } 00150 00151 #endif
Copyright © 2002 by The OGRE Team