CmWin32Window.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. Copyright (c) 2000-2011 Torus Knot Software Ltd
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. THE SOFTWARE.
  22. -----------------------------------------------------------------------------
  23. */
  24. #ifndef __Win32Window_H__
  25. #define __Win32Window_H__
  26. #include "CmWin32Prerequisites.h"
  27. #include "CmRenderWindow.h"
  28. namespace CamelotEngine {
  29. class CM_RSGL_EXPORT Win32Window : public RenderWindow
  30. {
  31. public:
  32. Win32Window(Win32GLSupport &glsupport);
  33. ~Win32Window();
  34. void initialize(const String& name, unsigned int width, unsigned int height,
  35. bool fullScreen, const NameValuePairList *miscParams);
  36. void setFullscreen(bool fullScreen, unsigned int width, unsigned int height);
  37. void destroy(void);
  38. bool isActive(void) const;
  39. bool isVisible() const;
  40. bool isClosed(void) const;
  41. void reposition(int left, int top);
  42. void resize(unsigned int width, unsigned int height);
  43. void swapBuffers(bool waitForVSync);
  44. /** Overridden - see RenderTarget. */
  45. virtual void copyContentsToMemory(const PixelData &dst, FrameBuffer buffer);
  46. bool requiresTextureFlipping() const { return false; }
  47. HWND getWindowHandle() const { return mHWnd; }
  48. HDC getHDC() const { return mHDC; }
  49. // Method for dealing with resize / move & 3d library
  50. virtual void windowMovedOrResized(void);
  51. void getCustomAttribute_internal( const String& name, void* pData );
  52. /** Used to set the active state of the render target.
  53. */
  54. virtual void setActive( bool state );
  55. void adjustWindow(unsigned int clientWidth, unsigned int clientHeight,
  56. unsigned int* winWidth, unsigned int* winHeight);
  57. protected:
  58. Win32GLSupport &mGLSupport;
  59. HWND mHWnd; // Win32 Window handle
  60. HDC mHDC;
  61. HGLRC mGlrc;
  62. bool mIsExternal;
  63. char* mDeviceName;
  64. bool mIsExternalGLControl;
  65. bool mIsExternalGLContext;
  66. bool mSizing;
  67. bool mClosed;
  68. int mDisplayFrequency; // fullscreen only, to restore display
  69. Win32Context *mContext;
  70. };
  71. }
  72. #endif