OGRE  1.9
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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-2014 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:
43  D3D9RenderWindow (HINSTANCE instance);
44  ~D3D9RenderWindow ();
45 
46  void create (const String& name, unsigned int width, unsigned int height,
47  bool fullScreen, const NameValuePairList *miscParams);
48  void setFullscreen (bool fullScreen, unsigned int width, unsigned int height);
49  void destroy (void);
50  bool isActive () const;
51  bool isVisible () const;
52  bool isClosed () const { return mClosed; }
53  bool isVSync () const { return mVSync; }
54  bool isHidden () const { return mHidden; }
55  void setHidden (bool hidden);
56  void setVSyncEnabled (bool vsync);
57  bool isVSyncEnabled () const;
58  void setVSyncInterval (unsigned int interval);
59  unsigned int getVSyncInterval () const;
60  void reposition (int left, int top);
61  void resize (unsigned int width, unsigned int height);
62  void swapBuffers ();
63  HWND getWindowHandle () const { return mHWnd; }
64  IDirect3DDevice9* getD3D9Device ();
65  D3D9Device* getDevice ();
66  void setDevice (D3D9Device* device);
67 
68  void getCustomAttribute (const String& name, void* pData);
69 
72  void copyContentsToMemory (const PixelBox &dst, FrameBuffer buffer);
73  bool requiresTextureFlipping () const { return false; }
74 
75  // Method for dealing with resize / move & 3d library
76  void windowMovedOrResized ();
77 
79  void buildPresentParameters (D3DPRESENT_PARAMETERS* presentParams);
80 
81 
83  void _beginUpdate();
84 
86  void _updateViewport(Viewport* viewport, bool updateStatistics = true);
87 
89  void _endUpdate();
90 
92  IDirect3DSurface9* getRenderSurface();
93 
95  bool _getSwitchingFullscreen() const;
96 
98  void _finishSwitchingFullscreen();
99 
101  bool isDepthBuffered() const;
102 
104  bool isNvPerfHUDEnable() const;
105 
107  bool _validateDevice();
108 
109  void adjustWindow(unsigned int clientWidth, unsigned int clientHeight,
110  unsigned int* winWidth, unsigned int* winHeight);
111 
112  protected:
114  void updateWindowRect();
115 
117  DWORD getWindowStyle(bool fullScreen) const { if (fullScreen) return mFullscreenWinStyle; return mWindowedWinStyle; }
118 
119  protected:
120  HINSTANCE mInstance; // Process instance
121  D3D9Device* mDevice; // D3D9 device wrapper class.
122  bool mDeviceValid; // Device was validation succeeded.
123  HWND mHWnd; // Win32 Window handle
124  bool mIsExternal; // window not created by Ogre
125  bool mClosed; // Is this window destroyed.
126  bool mHidden; // True if this is hidden render window.
127  bool mSwitchingFullscreen; // Are we switching from fullscreen to windowed or vice versa
128  D3DMULTISAMPLE_TYPE mFSAAType; // AA type.
129  DWORD mFSAAQuality; // AA quality.
130  UINT mDisplayFrequency; // Display frequency.
131  bool mVSync; // Use vertical sync or not.
132  unsigned int mVSyncInterval; // The vsync interval.
133  bool mUseNVPerfHUD; // Use NV Perf HUD.
134  DWORD mWindowedWinStyle; // Windowed mode window style flags.
135  DWORD mFullscreenWinStyle; // Fullscreen mode window style flags.
136  unsigned int mDesiredWidth; // Desired width after resizing
137  unsigned int mDesiredHeight; // Desired height after resizing
138  };
139 }
140 #endif
Manages the target rendering window.
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
Definition: OgreCommon.h:550
bool requiresTextureFlipping() const
bool isHidden() const
Indicates whether the window was set to hidden (not displayed)
DWORD getWindowStyle(bool fullScreen) const
Return the target window style depending on the fullscreen parameter.
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:57
_StringBase String
D3DMULTISAMPLE_TYPE mFSAAType
A primitive describing a volume (3D), image (2D) or line (1D) of pixels in memory.