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-2013 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
Ogre::D3D9RenderWindow::mDeviceValid
bool mDeviceValid
Definition: OgreD3D9RenderWindow.h:122
Ogre::D3D9Device
High level interface of Direct3D9 Device.
Definition: OgreD3D9Device.h:42
Ogre::D3D9RenderWindow::getWindowHandle
HWND getWindowHandle() const
Definition: OgreD3D9RenderWindow.h:63
Ogre::D3D9RenderWindow::mClosed
bool mClosed
Definition: OgreD3D9RenderWindow.h:125
Ogre::D3D9RenderWindow::mFSAAType
D3DMULTISAMPLE_TYPE mFSAAType
Definition: OgreD3D9RenderWindow.h:128
Ogre::D3D9RenderWindow::mWindowedWinStyle
DWORD mWindowedWinStyle
Definition: OgreD3D9RenderWindow.h:134
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::D3D9RenderWindow::mHidden
bool mHidden
Definition: OgreD3D9RenderWindow.h:126
OgreD3D9Prerequisites.h
Ogre::D3D9RenderWindow::mFSAAQuality
DWORD mFSAAQuality
Definition: OgreD3D9RenderWindow.h:129
Ogre::D3D9RenderWindow::mVSync
bool mVSync
Definition: OgreD3D9RenderWindow.h:131
Ogre::RenderWindow
Manages the target rendering window.
Definition: OgreRenderWindow.h:62
Ogre::D3D9RenderWindow::mFullscreenWinStyle
DWORD mFullscreenWinStyle
Definition: OgreD3D9RenderWindow.h:135
Ogre::D3D9RenderWindow::mDevice
D3D9Device * mDevice
Definition: OgreD3D9RenderWindow.h:121
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::NameValuePairList
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
Definition: OgreCommon.h:550
Ogre::D3D9RenderWindow::mInstance
HINSTANCE mInstance
Definition: OgreD3D9RenderWindow.h:120
Ogre::D3D9RenderWindow::requiresTextureFlipping
bool requiresTextureFlipping() const
Definition: OgreD3D9RenderWindow.h:73
Ogre::D3D9RenderWindow::mDesiredWidth
unsigned int mDesiredWidth
Definition: OgreD3D9RenderWindow.h:136
Ogre::Viewport
An abstraction of a viewport, i.e.
Definition: OgreViewport.h:57
Ogre::D3D9RenderWindow::isHidden
bool isHidden() const
Indicates whether the window was set to hidden (not displayed)
Definition: OgreD3D9RenderWindow.h:54
OgreD3D9Device.h
Ogre::D3D9RenderWindow::mDesiredHeight
unsigned int mDesiredHeight
Definition: OgreD3D9RenderWindow.h:137
Ogre::D3D9RenderWindow::mIsExternal
bool mIsExternal
Definition: OgreD3D9RenderWindow.h:124
Ogre::D3D9RenderWindow::mUseNVPerfHUD
bool mUseNVPerfHUD
Definition: OgreD3D9RenderWindow.h:133
Ogre::D3D9RenderWindow::getWindowStyle
DWORD getWindowStyle(bool fullScreen) const
Return the target window style depending on the fullscreen parameter.
Definition: OgreD3D9RenderWindow.h:117
Ogre::D3D9RenderWindow::isVSync
bool isVSync() const
Definition: OgreD3D9RenderWindow.h:53
OgreRenderWindow.h
Ogre::D3D9RenderWindow::mVSyncInterval
unsigned int mVSyncInterval
Definition: OgreD3D9RenderWindow.h:132
Ogre::D3D9RenderWindow::mSwitchingFullscreen
bool mSwitchingFullscreen
Definition: OgreD3D9RenderWindow.h:127
Ogre::PixelBox
A primitive describing a volume (3D), image (2D) or line (1D) of pixels in memory.
Definition: OgrePixelFormat.h:304
_OgreD3D9Export
#define _OgreD3D9Export
Definition: OgreD3D9Prerequisites.h:118
Ogre::D3D9RenderWindow::mHWnd
HWND mHWnd
Definition: OgreD3D9RenderWindow.h:123
Ogre::D3D9RenderWindow
Definition: OgreD3D9RenderWindow.h:37
Ogre::D3D9RenderWindow::isClosed
bool isClosed() const
Indicates whether the window has been closed by the user.
Definition: OgreD3D9RenderWindow.h:52
Ogre::D3D9RenderWindow::mDisplayFrequency
UINT mDisplayFrequency
Definition: OgreD3D9RenderWindow.h:130

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 Tue Apr 13 2021 08:53:15