Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreD3D9RenderWindow.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
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 __D3D9RENDERWINDOW_H__
00026 #define __D3D9RENDERWINDOW_H__
00027 
00028 #include "OgreD3D9Prerequisites.h"
00029 #include "OgreRenderWindow.h"
00030 #include "OgreD3D9Driver.h"
00031 
00032 namespace Ogre 
00033 {
00034     class D3D9RenderWindow : public RenderWindow
00035     {
00036     public:
00037         D3D9RenderWindow();
00038         ~D3D9RenderWindow();
00039 
00040         void create( const String& name, unsigned int width, unsigned int height, unsigned int colourDepth,
00041             bool fullScreen, int left, int top, bool depthBuffer, void* miscParam, ... );
00042 
00043         void destroy(void);
00044         bool isActive() const { return mActive; }
00045         bool isClosed() const { return mClosed; }
00046         void reposition( int left, int top ) {}
00047         void resize( unsigned int width, unsigned int height );
00048         void swapBuffers( bool waitForVSync = true );
00049         HWND getWindowHandle() const { return mHWnd; }
00050         HWND getParentWindowHandle() const { return mParentHWnd; }
00051 
00052         D3D9Driver* getDirectD3DDriver() { return mpD3DDriver; }
00053         LPDIRECT3DDEVICE9 getD3DDevice() { return mpD3DDevice; }
00054 
00055         void outputText( int x, int ty, const String& text );
00056         void getCustomAttribute( const String& name, void* pData );
00059         void writeContentsToFile(const String& filename);
00060         bool requiresTextureFlipping() const { return false; }
00061 
00062         // Method for dealing with resize / move & 3d library
00063         virtual void WindowMovedOrResized(void);
00064         // Method for passing a external window handle before creation ;)
00065         void SetExternalWindowHandle(HWND externalHandle) {mExternalHandle = externalHandle;};
00066 
00067         bool isReady() const { return mReady; }
00068         void setReady(bool set) { mReady = set; }
00069         void setActive(bool set) { mActive = set; }
00070 
00071     protected:
00072         HWND    mExternalHandle;        // External Win32 window handle
00073         HWND    mHWnd;                  // Win32 Window handle
00074         HWND    mParentHWnd;            // Parent Win32 window handle
00075         bool    mActive;                // Is active i.e. visible
00076         bool    mReady;                 // Is ready i.e. available for update
00077         bool    mClosed;
00078 
00079         static LRESULT CALLBACK WndProc(
00080             HWND hWnd,
00081             UINT uMsg,
00082             WPARAM wParam,
00083             LPARAM lParam );
00084 
00085         // -------------------------------------------------------
00086         // DirectX-specific
00087         // -------------------------------------------------------
00088 
00089         // Pointer to D3DDriver encapsulating Direct3D driver
00090         D3D9Driver* mpD3DDriver;
00091 
00092         // Pointer to the 3D device specific for this window
00093         LPDIRECT3DDEVICE9   mpD3DDevice;
00094         D3DPRESENT_PARAMETERS md3dpp;
00095         LPDIRECT3DSURFACE9 mpRenderSurface;
00096         LPDIRECT3DSURFACE9 mpRenderZBuffer;
00097 
00098         // just check if the multisampling requested is supported by the device
00099         bool _checkMultiSampleQuality(D3DMULTISAMPLE_TYPE type, DWORD *outQuality, D3DFORMAT format, UINT adapterNum, D3DDEVTYPE deviceType, BOOL fullScreen);
00100     };
00101 }
00102 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:05 2004