OGRE  2.0
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 isAA () const { return mFSAA != 0; }
55  bool isHidden () const { return mHidden; }
56  void setHidden (bool hidden);
57  void setVSyncEnabled (bool vsync);
58  bool isVSyncEnabled () const;
59  void setVSyncInterval (unsigned int interval);
60  unsigned int getVSyncInterval () const;
61  void reposition (int left, int top);
62  void resize (unsigned int width, unsigned int height);
63  void swapBuffers ();
64  HWND getWindowHandle () const { return mHWnd; }
65  IDirect3DDevice9* getD3D9Device ();
66  D3D9Device* getDevice ();
67  void setDevice (D3D9Device* device);
68 
69  void getCustomAttribute (const String& name, void* pData);
70 
73  void copyContentsToMemory (const PixelBox &dst, FrameBuffer buffer);
74  bool requiresTextureFlipping () const { return false; }
75 
76  // Method for dealing with resize / move & 3d library
77  void windowMovedOrResized ();
78 
80  void buildPresentParameters (D3DPRESENT_PARAMETERS* presentParams);
81 
82 
84  virtual void _beginUpdate();
85 
87  virtual void _updateViewportRenderPhase02( Viewport* viewport, Camera *camera,
88  const Camera *lodCamera, uint8 firstRq,
89  uint8 lastRq, bool updateStatistics );
90 
92  virtual void _endUpdate();
93 
95  IDirect3DSurface9* getRenderSurface();
96 
98  bool _getSwitchingFullscreen() const;
99 
101  void _finishSwitchingFullscreen();
102 
104  bool isDepthBuffered() const;
105 
107  bool isNvPerfHUDEnable() const;
108 
110  bool _validateDevice();
111 
112  void adjustWindow(unsigned int clientWidth, unsigned int clientHeight,
113  unsigned int* winWidth, unsigned int* winHeight);
114 
115  protected:
117  void updateWindowRect();
118 
120  DWORD getWindowStyle(bool fullScreen) const { if (fullScreen) return mFullscreenWinStyle; return mWindowedWinStyle; }
121 
122  protected:
123  HINSTANCE mInstance; // Process instance
124  D3D9Device* mDevice; // D3D9 device wrapper class.
125  bool mDeviceValid; // Device was validation succeeded.
126  HWND mHWnd; // Win32 Window handle
127  bool mIsExternal; // window not created by Ogre
128  bool mClosed; // Is this window destroyed.
129  bool mHidden; // True if this is hidden render window.
130  bool mSwitchingFullscreen; // Are we switching from fullscreen to windowed or vice versa
131  D3DMULTISAMPLE_TYPE mFSAAType; // AA type.
132  DWORD mFSAAQuality; // AA quality.
133  UINT mDisplayFrequency; // Display frequency.
134  bool mVSync; // Use vertical sync or not.
135  unsigned int mVSyncInterval; // The vsync interval.
136  bool mUseNVPerfHUD; // Use NV Perf HUD.
137  DWORD mWindowedWinStyle; // Windowed mode window style flags.
138  DWORD mFullscreenWinStyle; // Fullscreen mode window style flags.
139  unsigned int mDesiredWidth; // Desired width after resizing
140  unsigned int mDesiredHeight; // Desired height after resizing
141  };
142 }
143 #endif
Manages the target rendering window.
unsigned char uint8
Definition: OgrePlatform.h:422
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:82
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
Definition: OgreCommon.h:580
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:56
_StringBase String
Definition: OgreCommon.h:53
D3DMULTISAMPLE_TYPE mFSAAType