# 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 (c) 2000-2005 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:
    00043         D3D9RenderWindow(HINSTANCE instance, D3D9Driver *driver, LPDIRECT3DDEVICE9 deviceIfSwapChain = 0);
    00044         ~D3D9RenderWindow();
    00045         void create(const String& name, unsigned int width, unsigned int height,
    00046                 bool fullScreen, const NameValuePairList *miscParams);
    00047         void destroy(void);
    00048         bool isVisible() const;
    00049         bool isClosed() const { return mClosed; }
    00050         void reposition(int left, int top);
    00051         void resize(unsigned int width, unsigned int height);
    00052         void swapBuffers( bool waitForVSync = true );
    00053         HWND getWindowHandle() const { return mHWnd; }
    00054
    00055         D3D9Driver* getDirectD3DDriver() { return mDriver; }
    00056         // changed to access driver member
    00057         LPDIRECT3DDEVICE9 getD3DDevice() { return mDriver->getD3DDevice(); }
    00058
    00059         void getCustomAttribute( const String& name, void* pData );
    00062         void writeContentsToFile(const String& filename);
    00063         bool requiresTextureFlipping() const { return false; }
    00064
    00065         // Method for dealing with resize / move & 3d library
    00066         void windowMovedOrResized();
    00067
    00069         D3DPRESENT_PARAMETERS* getPresentationParameters(void)
    00070         { return &md3dpp; }
    00071
    00073         void update();
    00074
    00077         void createD3DResources();
    00078
    00081         void destroyD3DResources();
    00082
    00083     protected:
    00084         HINSTANCE mInstance;            // Process instance
    00085         D3D9Driver *mDriver;            // D3D9 driver
    00086         HWND    mHWnd;                  // Win32 Window handle
    00087         bool    mIsExternal;            // window not created by Ogre
    00088         bool    mSizing;
    00089         bool    mClosed;
    00090         bool    mIsSwapChain;           // Is this a secondary window?
    00091
    00092         static LRESULT CALLBACK WndProc(
    00093             HWND hWnd,
    00094             UINT uMsg,
    00095             WPARAM wParam,
    00096             LPARAM lParam );
    00097
    00098         // -------------------------------------------------------
    00099         // DirectX-specific
    00100         // -------------------------------------------------------
    00101
    00102         // Pointer to swap chain, only valid if mIsSwapChain
    00103         LPDIRECT3DSWAPCHAIN9 mpSwapChain;
    00104         D3DPRESENT_PARAMETERS md3dpp;
    00105         LPDIRECT3DSURFACE9 mpRenderSurface;
    00106         LPDIRECT3DSURFACE9 mpRenderZBuffer;
    00107         D3DMULTISAMPLE_TYPE mFSAAType;
    00108         DWORD mFSAAQuality;
    00109         bool mVSync;
    00110
    00111         // just check if the multisampling requested is supported by the device
    00112         bool _checkMultiSampleQuality(D3DMULTISAMPLE_TYPE type, DWORD *outQuality, D3DFORMAT format, UINT adapterNum, D3DDEVTYPE deviceType, BOOL fullScreen);
    00113
    00114     };
    00115 }
    00116 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 12:59:43 2006