[657] | 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 __D3D7RenderWindow_H__
|
---|
| 26 | #define __D3D7RenderWindow_H__
|
---|
| 27 |
|
---|
| 28 | // Precompiler options
|
---|
| 29 | #include "OgreD3D7Prerequisites.h"
|
---|
| 30 |
|
---|
| 31 | #include "OgreRenderWindow.h"
|
---|
| 32 | #include "OgreDDDriver.h"
|
---|
| 33 | #include "OgreD3D7DeviceList.h"
|
---|
| 34 | #include "OgreD3D7Device.h"
|
---|
| 35 |
|
---|
| 36 | namespace Ogre {
|
---|
| 37 | /** Defines the rendering window on Win32 systems
|
---|
| 38 | @remarks
|
---|
| 39 | This class represents the rendering window on the
|
---|
| 40 | Windows family of operating systems.
|
---|
| 41 | */
|
---|
| 42 | class D3D7RenderWindow : public RenderWindow
|
---|
| 43 | {
|
---|
| 44 | public:
|
---|
| 45 | D3D7RenderWindow(HINSTANCE instance, DDDriver *driver);
|
---|
| 46 | ~D3D7RenderWindow();
|
---|
| 47 |
|
---|
| 48 | void create(const String& name, unsigned int width, unsigned int height,
|
---|
| 49 | bool fullScreen, const NameValuePairList *miscParams);
|
---|
| 50 |
|
---|
| 51 | /** Overridden - see RenderWindow
|
---|
| 52 | */
|
---|
| 53 | void destroy(void);
|
---|
| 54 |
|
---|
| 55 | /** Overridden - see RenderWindow
|
---|
| 56 | */
|
---|
| 57 | bool isActive(void) const;
|
---|
| 58 |
|
---|
| 59 | /** Overridden - see RenderWindow
|
---|
| 60 | */
|
---|
| 61 | bool isClosed(void) const;
|
---|
| 62 |
|
---|
| 63 | /** Overridden - see RenderWindow
|
---|
| 64 | */
|
---|
| 65 | void reposition(int left, int top);
|
---|
| 66 |
|
---|
| 67 | /** Overridden - see RenderWindow
|
---|
| 68 | */
|
---|
| 69 | void resize(unsigned int width, unsigned int height);
|
---|
| 70 |
|
---|
| 71 | /** Overridden - see RenderWindow
|
---|
| 72 | */
|
---|
| 73 | void swapBuffers(bool waitForVSync);
|
---|
| 74 |
|
---|
| 75 | /** Retrieves a handle to the window (Win32 specific)
|
---|
| 76 | */
|
---|
| 77 | HWND getWindowHandle(void) const;
|
---|
| 78 |
|
---|
| 79 | /** Retrieves a handle to the window's parent, or 0 if there is no parent.
|
---|
| 80 | */
|
---|
| 81 | HWND getParentWindowHandle(void) const;
|
---|
| 82 |
|
---|
| 83 | /** Returns true if this window is using DirectDraw.
|
---|
| 84 | */
|
---|
| 85 | bool isUsingDirectDraw(void) const;
|
---|
| 86 | /** Retrieves a pointer to the DirectDraw wrapper object used to
|
---|
| 87 | manage the window's surface. (Win32 specific)
|
---|
| 88 | @note
|
---|
| 89 | Only applicable for windows using DirectDraw.
|
---|
| 90 | */
|
---|
| 91 | DDDriver* getDirectDrawDriver(void);
|
---|
| 92 |
|
---|
| 93 | /** Returns a pointer to a DirectDraw surface containing the
|
---|
| 94 | front buffer.
|
---|
| 95 | @note
|
---|
| 96 | Only applicable for windows using DirectDraw.
|
---|
| 97 | */
|
---|
| 98 | LPDIRECTDRAWSURFACE7 getDDFrontBuffer(void);
|
---|
| 99 |
|
---|
| 100 | /** Returns a pointer to a DirectDraw surface containing the back
|
---|
| 101 | buffer. Only applicable if using DirectDraw.
|
---|
| 102 | */
|
---|
| 103 | LPDIRECTDRAWSURFACE7 getDDBackBuffer(void);
|
---|
| 104 |
|
---|
| 105 | /** Returns a pointer to the Direct3D device that works with this
|
---|
| 106 | window
|
---|
| 107 | @note
|
---|
| 108 | Only applicable for windows using DirectDraw.
|
---|
| 109 | */
|
---|
| 110 | LPDIRECT3DDEVICE7 getD3DDevice(void);
|
---|
| 111 |
|
---|
| 112 | bool requiresTextureFlipping() const { return false; }
|
---|
| 113 |
|
---|
| 114 | /** Overridden - see RenderTarget.
|
---|
| 115 | */
|
---|
| 116 | void getCustomAttribute(const String& name, void* pData);
|
---|
| 117 |
|
---|
| 118 | /** Overridden - see RenderTarget.
|
---|
| 119 | */
|
---|
| 120 | void writeContentsToFile(const String& filename);
|
---|
| 121 | // DirectDraw Methods
|
---|
| 122 | void createDDSurfaces(void);
|
---|
| 123 | void releaseDDSurfaces(void);
|
---|
| 124 | void restoreDDSurfaces(void);
|
---|
| 125 | void createDepthBuffer(void);
|
---|
| 126 | #ifdef GTP_VISIBILITY_MODIFIED_OGRE
|
---|
| 127 | uchar *getBufferContents(int &dimx, int &dimy);
|
---|
| 128 | #endif // GTP_VISIBILITY_MODIFIED_OGRE
|
---|
| 129 |
|
---|
| 130 | protected:
|
---|
| 131 | HINSTANCE mInstance; // Process instance
|
---|
| 132 | DDDriver *mDriver; // D3D9 driver
|
---|
| 133 | // Win32-specific data members
|
---|
| 134 | bool mIsUsingDirectDraw;
|
---|
| 135 | HWND mHWnd; // Win32 Window handle
|
---|
| 136 | HWND mParentHWnd;
|
---|
| 137 | bool mActive; // Is active i.e. visible
|
---|
| 138 | bool mReady; // Is ready i.e. available for update
|
---|
| 139 | bool mClosed;
|
---|
| 140 |
|
---|
| 141 | RECT rcBlitDest; // Target for blit operation
|
---|
| 142 | // == window client area
|
---|
| 143 |
|
---|
| 144 |
|
---|
| 145 | static LRESULT CALLBACK WndProc(
|
---|
| 146 | HWND hWnd,
|
---|
| 147 | UINT uMsg,
|
---|
| 148 | WPARAM wParam,
|
---|
| 149 | LPARAM lParam);
|
---|
| 150 |
|
---|
| 151 | // ---------------------------------------------------------
|
---|
| 152 | // DirectX-specific
|
---|
| 153 | // ---------------------------------------------------------
|
---|
| 154 |
|
---|
| 155 | // Pointer to DDDriver encapsulating DirectDraw driver (if DirectX in use)
|
---|
| 156 | DDDriver* mlpDDDriver;
|
---|
| 157 |
|
---|
| 158 | // Pointers to DX surfaces
|
---|
| 159 | LPDIRECTDRAWSURFACE7 mlpDDSFront; // Pointer to primary (front) buffer surface
|
---|
| 160 | LPDIRECTDRAWSURFACE7 mlpDDSBack; // Pointer to back buffer
|
---|
| 161 |
|
---|
| 162 | // Pointer to the 3D Device specific for this window
|
---|
| 163 | LPDIRECT3DDEVICE7 mlpD3DDevice;
|
---|
| 164 |
|
---|
| 165 |
|
---|
| 166 | // Method for dealing with resize / move & 3d library
|
---|
| 167 | void windowMovedOrResized(void);
|
---|
| 168 |
|
---|
| 169 | // ---------------------------------------------------------
|
---|
| 170 | // OpenGL-specific details
|
---|
| 171 | // ---------------------------------------------------------
|
---|
| 172 |
|
---|
| 173 | // TODO
|
---|
| 174 | };
|
---|
| 175 | }
|
---|
| 176 | #endif
|
---|