1 | /*
|
---|
2 | -----------------------------------------------------------------------------
|
---|
3 | This source file is part of OGRE
|
---|
4 | (Object-oriented Graphics Rendering Engine)
|
---|
5 | For the latest info, see http://www.ogre3d.org/
|
---|
6 |
|
---|
7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
8 | Also see acknowledgements in Readme.html
|
---|
9 |
|
---|
10 | This program is free software; you can redistribute it and/or modify it under
|
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
13 | version.
|
---|
14 |
|
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
23 | -----------------------------------------------------------------------------
|
---|
24 | */
|
---|
25 | #ifndef __DDDRIVER_H__
|
---|
26 | #define __DDDRIVER_H__
|
---|
27 |
|
---|
28 | // Precompiler options
|
---|
29 | #include "OgreD3D7Prerequisites.h"
|
---|
30 |
|
---|
31 | // Declaration
|
---|
32 | #include "OgreString.h"
|
---|
33 |
|
---|
34 | namespace Ogre {
|
---|
35 |
|
---|
36 | class D3DDeviceList;
|
---|
37 | class DDVideoModeList;
|
---|
38 | class DDVideoMode;
|
---|
39 | class D3DDevice;
|
---|
40 |
|
---|
41 |
|
---|
42 | /**
|
---|
43 | Encapsulates a DirectDraw driver. Utility class for D3DRenderSystem.
|
---|
44 | */
|
---|
45 | class _OgreD3DExport DDDriver
|
---|
46 | {
|
---|
47 | private:
|
---|
48 |
|
---|
49 | String mDriverName;
|
---|
50 | String mDriverDesc;
|
---|
51 | GUID mGuid; // Note - copy of GUID, not pointer to
|
---|
52 | bool mPrimaryDisplay;
|
---|
53 |
|
---|
54 | LPDIRECTDRAW7 lpDD7; // pointer to IDirectDraw7 interface
|
---|
55 | LPDIRECT3D7 lpD3D; // pointer to IDirect3D7 interface (if required)
|
---|
56 | D3DDeviceList* mDeviceList; // List of Direct3D devices
|
---|
57 | DDVideoModeList* mVideoModeList; // List of video modes
|
---|
58 | D3DDevice* active3DDevice;
|
---|
59 | DDVideoMode* activeVideoMode;
|
---|
60 | HWND activeHWnd;
|
---|
61 |
|
---|
62 | DDCAPS mSWCaps; // Software capabilities
|
---|
63 | DDCAPS mHWCaps; // Hardware capabilities
|
---|
64 | void logCaps(void) const;
|
---|
65 |
|
---|
66 | LPDIRECTDRAWSURFACE7 lpDDSPrimary; // Pointer to primary surface
|
---|
67 | LPDIRECTDRAWSURFACE7 lpDDSBack; // Pointer to back buffer
|
---|
68 |
|
---|
69 | bool runningFullScreen;
|
---|
70 | bool using3DMode;
|
---|
71 |
|
---|
72 | RECT rcViewport; //Only used for windowed mode
|
---|
73 | LPDIRECTDRAWCLIPPER lpDDClipper;
|
---|
74 |
|
---|
75 | // Private accessor functions
|
---|
76 |
|
---|
77 | void RestoreSurfaces(void);
|
---|
78 |
|
---|
79 |
|
---|
80 |
|
---|
81 | public:
|
---|
82 | // Constructors
|
---|
83 | DDDriver(); // Default
|
---|
84 | DDDriver(const DDDriver &ob); // Copy
|
---|
85 | DDDriver(GUID FAR *lpGuid, // Create from enum
|
---|
86 | LPSTR lpDriverDescription,
|
---|
87 | LPSTR lpDriverName);
|
---|
88 | // Destructor
|
---|
89 | ~DDDriver();
|
---|
90 |
|
---|
91 | /** Creates DirectDraw surfaces appropriate for a render window.
|
---|
92 |
|
---|
93 | @remarks
|
---|
94 | This method creates double-buffered surfaces for a window. Note that in this case the
|
---|
95 | metrics supplied (width, height) must be of the CLIENT area of a window only
|
---|
96 | if fullScreen = false; i.e. the metrics must be ignoring title bar, menu bar etc.
|
---|
97 |
|
---|
98 | @param hWnd
|
---|
99 | Window handle to the window for which the surfaces are created.
|
---|
100 | @param width
|
---|
101 | The width of the surfaces required (see note above).
|
---|
102 | @param height
|
---|
103 | The height of the surfaces required (see note above).
|
---|
104 | @param colourDepth
|
---|
105 | The colour depth in bits per pixel. Only relevant if fullScreen = true.
|
---|
106 | @param fullScreen
|
---|
107 | Specify true to make these surfaces full screen exclusive.
|
---|
108 | @param front
|
---|
109 | Pointer to a pointer which will be filled with the interface to the front buffer on return.
|
---|
110 | @param back
|
---|
111 | Pointer to a pointer which will be filled with the interface to the back buffer on return.
|
---|
112 | Only relevant if fullScreen = false.
|
---|
113 | */
|
---|
114 | void createWindowSurfaces(HWND hWnd, unsigned int width, unsigned int height, unsigned int colourDepth, bool fullScreen,
|
---|
115 | LPDIRECTDRAWSURFACE7 *front, LPDIRECTDRAWSURFACE7 *back);
|
---|
116 |
|
---|
117 | void Cleanup(void);
|
---|
118 | void CheckWindow(void);
|
---|
119 |
|
---|
120 | // Overloaded operator =
|
---|
121 | DDDriver operator=(const DDDriver &orig);
|
---|
122 |
|
---|
123 | // Information accessors
|
---|
124 | String DriverName(void) const;
|
---|
125 | String DriverDescription(void) const;
|
---|
126 | LPDIRECTDRAW7 directDraw(); // Gets lpDD7 (instantiates if required)
|
---|
127 |
|
---|
128 | D3DDeviceList* get3DDeviceList(void);
|
---|
129 | DDVideoModeList* getVideoModeList(void);
|
---|
130 | DDVideoMode* getActiveVideoMode(void);
|
---|
131 |
|
---|
132 | // Retrieval of other objects
|
---|
133 | D3DDevice* get3DDevice(void);
|
---|
134 |
|
---|
135 | void OutputText(int x, int y, char* text);
|
---|
136 | void FlipBuffers(void);
|
---|
137 | bool RunningFullScreen(void) const;
|
---|
138 | RECT ViewportRect(void) const;
|
---|
139 |
|
---|
140 | // Capabilities
|
---|
141 | bool Has3DAcceleration(void) const;
|
---|
142 | bool CanRenderWindowed(void) const;
|
---|
143 |
|
---|
144 | // Generalised info
|
---|
145 | void GetDisplayDetails(unsigned int& width, unsigned int& height, unsigned int& colourDepth);
|
---|
146 | };
|
---|
147 | }
|
---|
148 |
|
---|
149 | #endif
|
---|