OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OgreD3D9RenderWindow.h
Go to the documentation of this file.
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-2011 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __D3D9RENDERWINDOW_H__
29 #define __D3D9RENDERWINDOW_H__
30 
31 #include "OgreD3D9Prerequisites.h"
32 #include "OgreRenderWindow.h"
33 #include "OgreD3D9Device.h"
34 
35 namespace Ogre
36 {
38  {
39  public:
46  D3D9RenderWindow (HINSTANCE instance);
47  ~D3D9RenderWindow ();
48 
49 
50  void create (const String& name, unsigned int width, unsigned int height,
51  bool fullScreen, const NameValuePairList *miscParams);
52  void setFullscreen (bool fullScreen, unsigned int width, unsigned int height);
53  void destroy (void);
54  bool isActive () const;
55  bool isVisible () const;
56  bool isClosed () const { return mClosed; }
57  bool isVSync () const { return mVSync; }
58  void reposition (int left, int top);
59  void resize (unsigned int width, unsigned int height);
60  void swapBuffers ( bool waitForVSync = true );
61  HWND getWindowHandle () const { return mHWnd; }
62  IDirect3DDevice9* getD3D9Device ();
63  D3D9Device* getDevice ();
64  void setDevice (D3D9Device* device);
65 
66  void getCustomAttribute (const String& name, void* pData);
67 
70  void copyContentsToMemory (const PixelBox &dst, FrameBuffer buffer);
71  bool requiresTextureFlipping () const { return false; }
72 
73  // Method for dealing with resize / move & 3d library
74  void windowMovedOrResized ();
75 
77  void buildPresentParameters (D3DPRESENT_PARAMETERS* presentParams);
78 
79 
81  void _beginUpdate();
82 
84  void _updateViewport(Viewport* viewport, bool updateStatistics = true);
85 
87  void _endUpdate();
88 
90  IDirect3DSurface9* getRenderSurface();
91 
93  bool _getSwitchingFullscreen() const;
94 
96  void _finishSwitchingFullscreen();
97 
99  bool isDepthBuffered() const;
100 
102  bool isNvPerfHUDEnable() const;
103 
105  bool _validateDevice();
106 
107  void adjustWindow(unsigned int clientWidth, unsigned int clientHeight,
108  DWORD style, unsigned int* winWidth, unsigned int* winHeight);
109 
110  protected:
111  HINSTANCE mInstance; // Process instance
112  D3D9Device* mDevice; // D3D9 device wrapper class.
113  bool mDeviceValid; // Device was validation succeeded.
114  HWND mHWnd; // Win32 Window handle
115  bool mIsExternal; // window not created by Ogre
116  bool mClosed; // Is this window destroyed.
117  bool mSwitchingFullscreen; // Are we switching from fullscreen to windowed or vice versa
118  D3DMULTISAMPLE_TYPE mFSAAType; // AA type.
119  DWORD mFSAAQuality; // AA quality.
120  UINT mDisplayFrequency; // Display frequency.
121  bool mVSync; // Use vertical sync or not.
122  unsigned int mVSyncInterval;
123  bool mUseNVPerfHUD; // Use NV Perf HUD.
124  DWORD mStyle; // Window style currently used for this window.
125  // Desired width / height after resizing
126  unsigned int mDesiredWidth;
127  unsigned int mDesiredHeight;
128 
129 
130  void updateWindowRect();
131  };
132 }
133 #endif
Manages the target rendering window.
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
Definition: OgreCommon.h:524
bool requiresTextureFlipping() const
bool isClosed() const
Indicates whether the window has been closed by the user.
#define _OgreD3D9Export
High level interface of Direct3D9 Device.
An abstraction of a viewport, i.e.
Definition: OgreViewport.h:56
_StringBase String
D3DMULTISAMPLE_TYPE mFSAAType
A primitive describing a volume (3D), image (2D) or line (1D) of pixels in memory.