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-2013 Torus Knot Software Ltd
00008 
00009 Permission is hereby granted, free of charge, to any person obtaining a copy
00010 of this software and associated documentation files (the "Software"), to deal
00011 in the Software without restriction, including without limitation the rights
00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00013 copies of the Software, and to permit persons to whom the Software is
00014 furnished to do so, subject to the following conditions:
00015 
00016 The above copyright notice and this permission notice shall be included in
00017 all copies or substantial portions of the Software.
00018 
00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00025 THE SOFTWARE.
00026 -----------------------------------------------------------------------------
00027 */
00028 #ifndef __D3D9RENDERWINDOW_H__
00029 #define __D3D9RENDERWINDOW_H__
00030 
00031 #include "OgreD3D9Prerequisites.h"
00032 #include "OgreRenderWindow.h"
00033 #include "OgreD3D9Device.h"
00034 
00035 namespace Ogre 
00036 {
00037     class _OgreD3D9Export D3D9RenderWindow : public RenderWindow
00038     {
00039     public:
00043         D3D9RenderWindow                        (HINSTANCE instance);
00044         ~D3D9RenderWindow                       (); 
00045         
00046         void                create              (const String& name, unsigned int width, unsigned int height,
00047                                                  bool fullScreen, const NameValuePairList *miscParams);
00048         void                setFullscreen       (bool fullScreen, unsigned int width, unsigned int height);
00049         void                destroy             (void);
00050         bool                isActive            () const;
00051         bool                isVisible           () const;
00052         bool                isClosed            () const { return mClosed; }
00053         bool                isVSync             () const { return mVSync; }
00054         bool                isHidden            () const { return mHidden; }
00055         void                setHidden           (bool hidden);
00056         void                setVSyncEnabled     (bool vsync);
00057         bool                isVSyncEnabled      () const;
00058         void                setVSyncInterval    (unsigned int interval);
00059         unsigned int        getVSyncInterval    () const;
00060         void                reposition          (int left, int top);
00061         void                resize              (unsigned int width, unsigned int height);
00062         void                swapBuffers         ();
00063         HWND                getWindowHandle     () const { return mHWnd; }              
00064         IDirect3DDevice9*   getD3D9Device       ();
00065         D3D9Device*         getDevice           ();
00066         void                setDevice           (D3D9Device* device);
00067 
00068         void                getCustomAttribute  (const String& name, void* pData);
00069         
00072         void                copyContentsToMemory    (const PixelBox &dst, FrameBuffer buffer);
00073         bool                requiresTextureFlipping () const { return false; }
00074 
00075         // Method for dealing with resize / move & 3d library
00076         void                windowMovedOrResized    ();
00077     
00079         void                buildPresentParameters  (D3DPRESENT_PARAMETERS* presentParams);
00080         
00081 
00083         void _beginUpdate();
00084     
00086         void _updateViewport(Viewport* viewport, bool updateStatistics = true);
00087 
00089         void _endUpdate();
00090 
00092         IDirect3DSurface9* getRenderSurface();
00093 
00095         bool _getSwitchingFullscreen() const;
00096         
00098         void _finishSwitchingFullscreen();
00099     
00101         bool isDepthBuffered() const;
00102 
00104         bool isNvPerfHUDEnable() const;
00105 
00107         bool _validateDevice();
00108 
00109         void adjustWindow(unsigned int clientWidth, unsigned int clientHeight, 
00110             unsigned int* winWidth, unsigned int* winHeight);
00111 
00112     protected:
00114         void updateWindowRect();
00115 
00117         DWORD getWindowStyle(bool fullScreen) const { if (fullScreen) return mFullscreenWinStyle; return mWindowedWinStyle; }
00118 
00119     protected:
00120         HINSTANCE                   mInstance;              // Process instance
00121         D3D9Device*                 mDevice;                // D3D9 device wrapper class.
00122         bool                        mDeviceValid;           // Device was validation succeeded.
00123         HWND                        mHWnd;                  // Win32 Window handle      
00124         bool                        mIsExternal;            // window not created by Ogre
00125         bool                        mClosed;                // Is this window destroyed.        
00126         bool                        mHidden;                // True if this is hidden render window. 
00127         bool                        mSwitchingFullscreen;   // Are we switching from fullscreen to windowed or vice versa       
00128         D3DMULTISAMPLE_TYPE         mFSAAType;              // AA type.
00129         DWORD                       mFSAAQuality;           // AA quality.
00130         UINT                        mDisplayFrequency;      // Display frequency.
00131         bool                        mVSync;                 // Use vertical sync or not.
00132         unsigned int                mVSyncInterval;         // The vsync interval.
00133         bool                        mUseNVPerfHUD;          // Use NV Perf HUD.
00134         DWORD                       mWindowedWinStyle;      // Windowed mode window style flags.
00135         DWORD                       mFullscreenWinStyle;    // Fullscreen mode window style flags.       
00136         unsigned int                mDesiredWidth;          // Desired width after resizing
00137         unsigned int                mDesiredHeight;         // Desired height after resizing
00138     };
00139 }
00140 #endif

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:42