2
0

BsWin32Window.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #pragma once
  2. #include "BsWin32Prerequisites.h"
  3. #include "BsRenderWindow.h"
  4. namespace BansheeEngine
  5. {
  6. class BS_RSGL_EXPORT Win32Window : public RenderWindow
  7. {
  8. public:
  9. ~Win32Window();
  10. /**
  11. * @copydoc RenderWindow::setFullscreen(UINT32, UINT32, float, UINT32)
  12. */
  13. void setFullscreen(UINT32 width, UINT32 height, float refreshRate = 60.0f, UINT32 monitorIdx = 0);
  14. /**
  15. * @copydoc RenderWindow::setFullscreen(const VideoMode&)
  16. */
  17. void setFullscreen(const VideoMode& mode);
  18. /**
  19. * @copydoc RenderWindow::setWindowed
  20. */
  21. void setWindowed(UINT32 width, UINT32 height);
  22. /**
  23. * @copydoc RenderWindow::setHidden
  24. */
  25. void setHidden(bool hidden);
  26. /**
  27. * @copydoc RenderWindow::isActive
  28. */
  29. bool isActive() const;
  30. /**
  31. * @copydoc RenderWindow::isVisible
  32. */
  33. bool isVisible() const;
  34. /**
  35. * @copydoc RenderWindow::isClosed
  36. */
  37. bool isClosed() const;
  38. /**
  39. * @copydoc RenderWindow::reposition
  40. */
  41. void move(INT32 left, INT32 top);
  42. /**
  43. * @copydoc RenderWindow::resize
  44. */
  45. void resize(UINT32 width, UINT32 height);
  46. /**
  47. * @copydoc RenderWindow::copyContentsToMemory
  48. */
  49. void copyToMemory(const PixelData &dst, FrameBuffer buffer);
  50. /**
  51. * @copydoc RenderWindow::swapBuffers
  52. */
  53. void swapBuffers();
  54. /**
  55. * @copydoc RenderWindow::requiresTextureFlipping
  56. */
  57. bool requiresTextureFlipping() const { return false; }
  58. /**
  59. * @copydoc RenderWindow::screenToWindowPos
  60. */
  61. Vector2I screenToWindowPos(const Vector2I& screenPos) const;
  62. /**
  63. * @copydoc RenderWindow::windowToScreenPos
  64. */
  65. Vector2I windowToScreenPos(const Vector2I& windowPos) const;
  66. /**
  67. * @copydoc RenderWindow::getCustomAttribute
  68. */
  69. void getCustomAttribute(const String& name, void* pData) const;
  70. /**
  71. * @copydoc RenderWindow::setActive
  72. */
  73. virtual void setActive( bool state );
  74. /**
  75. * @copydoc RenderWindow::_windowMovedOrResized
  76. */
  77. void _windowMovedOrResized(void);
  78. HWND _getWindowHandle() const { return mHWnd; }
  79. HDC _getHDC() const { return mHDC; }
  80. void _adjustWindow(unsigned int clientWidth, unsigned int clientHeight,
  81. unsigned int* winWidth, unsigned int* winHeight);
  82. protected:
  83. friend class GLRenderWindowManager;
  84. friend class Win32GLSupport;
  85. Win32Window(const RENDER_WINDOW_DESC& desc, Win32GLSupport &glsupport);
  86. /**
  87. * @copydoc RenderWindow::initialize_internal().
  88. */
  89. void initialize_internal();
  90. /**
  91. * @copydoc RenderWindow::destroy_internal().
  92. */
  93. void destroy_internal();
  94. protected:
  95. Win32GLSupport &mGLSupport;
  96. HWND mHWnd; // Win32 Window handle
  97. HDC mHDC;
  98. DWORD mWindowedStyle;
  99. DWORD mWindowedStyleEx;
  100. bool mIsExternal;
  101. bool mIsChild;
  102. char* mDeviceName;
  103. bool mIsExternalGLControl;
  104. bool mSizing;
  105. bool mClosed;
  106. int mDisplayFrequency; // fullscreen only, to restore display
  107. Win32Context *mContext;
  108. };
  109. }