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-2012 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: 00046 D3D9RenderWindow (HINSTANCE instance); 00047 ~D3D9RenderWindow (); 00048 00049 00050 void create (const String& name, unsigned int width, unsigned int height, 00051 bool fullScreen, const NameValuePairList *miscParams); 00052 void setFullscreen (bool fullScreen, unsigned int width, unsigned int height); 00053 void destroy (void); 00054 bool isActive () const; 00055 bool isVisible () const; 00056 bool isClosed () const { return mClosed; } 00057 bool isVSync () const { return mVSync; } 00058 bool isHidden () const { return mHidden; } 00059 void setHidden (bool hidden); 00060 void setVSyncEnabled (bool vsync); 00061 bool isVSyncEnabled () const; 00062 void setVSyncInterval (unsigned int interval); 00063 unsigned int getVSyncInterval () const; 00064 void reposition (int left, int top); 00065 void resize (unsigned int width, unsigned int height); 00066 void swapBuffers ( bool waitForVSync = true ); 00067 HWND getWindowHandle () const { return mHWnd; } 00068 IDirect3DDevice9* getD3D9Device (); 00069 D3D9Device* getDevice (); 00070 void setDevice (D3D9Device* device); 00071 00072 void getCustomAttribute (const String& name, void* pData); 00073 00076 void copyContentsToMemory (const PixelBox &dst, FrameBuffer buffer); 00077 bool requiresTextureFlipping () const { return false; } 00078 00079 // Method for dealing with resize / move & 3d library 00080 void windowMovedOrResized (); 00081 00083 void buildPresentParameters (D3DPRESENT_PARAMETERS* presentParams); 00084 00085 00087 void _beginUpdate(); 00088 00090 void _updateViewport(Viewport* viewport, bool updateStatistics = true); 00091 00093 void _endUpdate(); 00094 00096 IDirect3DSurface9* getRenderSurface(); 00097 00099 bool _getSwitchingFullscreen() const; 00100 00102 void _finishSwitchingFullscreen(); 00103 00105 bool isDepthBuffered() const; 00106 00108 bool isNvPerfHUDEnable() const; 00109 00111 bool _validateDevice(); 00112 00113 void adjustWindow(unsigned int clientWidth, unsigned int clientHeight, 00114 unsigned int* winWidth, unsigned int* winHeight); 00115 00116 protected: 00118 void updateWindowRect(); 00119 00121 DWORD getWindowStyle(bool fullScreen) const { if (fullScreen) return mFullscreenWinStyle; return mWindowedWinStyle; } 00122 00123 protected: 00124 HINSTANCE mInstance; // Process instance 00125 D3D9Device* mDevice; // D3D9 device wrapper class. 00126 bool mDeviceValid; // Device was validation succeeded. 00127 HWND mHWnd; // Win32 Window handle 00128 bool mIsExternal; // window not created by Ogre 00129 bool mClosed; // Is this window destroyed. 00130 bool mHidden; // True if this is hidden render window. 00131 bool mSwitchingFullscreen; // Are we switching from fullscreen to windowed or vice versa 00132 D3DMULTISAMPLE_TYPE mFSAAType; // AA type. 00133 DWORD mFSAAQuality; // AA quality. 00134 UINT mDisplayFrequency; // Display frequency. 00135 bool mVSync; // Use vertical sync or not. 00136 unsigned int mVSyncInterval; // The vsync interval. 00137 bool mUseNVPerfHUD; // Use NV Perf HUD. 00138 DWORD mWindowedWinStyle; // Windowed mode window style flags. 00139 DWORD mFullscreenWinStyle; // Fullscreen mode window style flags. 00140 unsigned int mDesiredWidth; // Desired width after resizing 00141 unsigned int mDesiredHeight; // Desired height after resizing 00142 }; 00143 } 00144 #endif
Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 2012 21:48:49