CmWin32Window.h 2.6 KB

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