BsD3D9RenderWindow.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #pragma once
  2. #include "BsD3D9Prerequisites.h"
  3. #include "BsRenderWindow.h"
  4. #include "BsD3D9Device.h"
  5. namespace BansheeEngine
  6. {
  7. class BS_D3D9_EXPORT D3D9RenderWindow : public RenderWindow
  8. {
  9. public:
  10. ~D3D9RenderWindow();
  11. /**
  12. * @copydoc RenderWindow::setFullscreen(UINT32, UINT32, float, UINT32)
  13. */
  14. void setFullscreen(UINT32 width, UINT32 height, float refreshRate = 60.0f, UINT32 monitorIdx = 0);
  15. /**
  16. * @copydoc RenderWindow::setFullscreen(const VideoMode&)
  17. */
  18. void setFullscreen(const VideoMode& mode);
  19. /**
  20. * @copydoc RenderWindow::setWindowed
  21. */
  22. void setWindowed(UINT32 width, UINT32 height);
  23. /**
  24. * @copydoc RenderWindow::setHidden
  25. */
  26. void setHidden(bool hidden);
  27. /**
  28. * @copydoc RenderWindow::isActive
  29. */
  30. bool isActive() const;
  31. /**
  32. * @copydoc RenderWindow::isVisible
  33. */
  34. bool isVisible() const;
  35. /**
  36. * @copydoc RenderWindow::isClosed
  37. */
  38. bool isClosed() const { return mClosed; }
  39. /**
  40. * @copydoc RenderWindow::isVSync
  41. */
  42. bool isVSync() const { return mVSync; }
  43. /**
  44. * @copydoc RenderWindow::reposition
  45. */
  46. void move(INT32 left, INT32 top);
  47. /**
  48. * @copydoc RenderWindow::resize
  49. */
  50. void resize(UINT32 width, UINT32 height);
  51. /**
  52. * @copydoc RenderWindow::getCustomAttribute
  53. */
  54. void getCustomAttribute(const String& name, void* pData) const;
  55. /**
  56. * @copydoc RenderWindow::copyContentsToMemory
  57. */
  58. void copyToMemory(const PixelData &dst, FrameBuffer buffer);
  59. /**
  60. * @copydoc RenderWindow::requiresTextureFlipping
  61. */
  62. bool requiresTextureFlipping() const { return false; }
  63. /**
  64. * @copydoc RenderWindow::swapBuffers
  65. */
  66. void swapBuffers();
  67. /**
  68. * @copydoc RenderWindow::screenToWindowPos
  69. */
  70. Vector2I screenToWindowPos(const Vector2I& screenPos) const;
  71. /**
  72. * @copydoc RenderWindow::windowToScreenPos
  73. */
  74. Vector2I windowToScreenPos(const Vector2I& windowPos) const;
  75. /**
  76. * @copydoc RenderWindow::_windowMovedOrResized
  77. */
  78. void _windowMovedOrResized();
  79. HWND _getWindowHandle() const { return mHWnd; }
  80. IDirect3DDevice9* _getD3D9Device() const;
  81. D3D9Device* _getDevice() const;
  82. void _setDevice(D3D9Device* device);
  83. /**
  84. * @brief Build the presentation parameters used with this window.
  85. */
  86. void _buildPresentParameters(D3DPRESENT_PARAMETERS* presentParams) const;
  87. /**
  88. * @brief Accessor for render surface.
  89. */
  90. IDirect3DSurface9* _getRenderSurface() const;
  91. /**
  92. * @brief Returns true if this window use depth buffer.
  93. */
  94. bool _isDepthBuffered() const;
  95. /**
  96. * @brief Validate the device for this window.
  97. */
  98. bool _validateDevice();
  99. void _adjustWindow(unsigned int clientWidth, unsigned int clientHeight,
  100. DWORD style, unsigned int* winWidth, unsigned int* winHeight);
  101. protected:
  102. friend class D3D9RenderWindowManager;
  103. D3D9RenderWindow (const RENDER_WINDOW_DESC& desc, HINSTANCE instance);
  104. void updateWindowRect();
  105. /**
  106. * @copydoc RenderWindow::initialize_internal().
  107. */
  108. void initialize_internal();
  109. /**
  110. * @copydoc RenderWindow::destroy_internal().
  111. */
  112. void destroy_internal();
  113. protected:
  114. HINSTANCE mInstance;
  115. D3D9Device* mDevice;
  116. bool mDeviceValid;
  117. HWND mHWnd;
  118. bool mIsExternal;
  119. bool mClosed;
  120. D3DMULTISAMPLE_TYPE mMultisampleType;
  121. DWORD mMultisampleQuality;
  122. UINT mDisplayFrequency;
  123. bool mVSync;
  124. unsigned int mVSyncInterval;
  125. DWORD mStyle;
  126. DWORD mWindowedStyle;
  127. DWORD mWindowedStyleEx;
  128. bool mIsDepthBuffered;
  129. bool mIsChild;
  130. };
  131. }