CmRenderWindow.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. #include "CmRenderWindow.h"
  25. #include "CmCoreThread.h"
  26. #include "CmRenderWindowManager.h"
  27. #include "CmViewport.h"
  28. namespace CamelotFramework
  29. {
  30. RenderWindow::RenderWindow(const RENDER_WINDOW_DESC& desc)
  31. : RenderTarget()
  32. , mIsFullScreen(false)
  33. , mDesc(desc)
  34. , mHasFocus(false)
  35. {
  36. }
  37. RenderWindow::~RenderWindow()
  38. {
  39. }
  40. void RenderWindow::getMetrics(UINT32& width, UINT32& height, UINT32& colourDepth,
  41. INT32& left, INT32& top)
  42. {
  43. width = mWidth;
  44. height = mHeight;
  45. colourDepth = mColorDepth;
  46. left = mLeft;
  47. top = mTop;
  48. }
  49. void RenderWindow::setVisible(bool visible)
  50. {
  51. THROW_IF_NOT_CORE_THREAD;
  52. }
  53. bool RenderWindow::isFullScreen(void) const
  54. {
  55. return mIsFullScreen;
  56. }
  57. void RenderWindow::_windowMovedOrResized()
  58. {
  59. THROW_IF_NOT_CORE_THREAD;
  60. if(!onMovedOrResized.empty())
  61. onMovedOrResized(this);
  62. RenderWindowManager::instance().windowMovedOrResized(this);
  63. }
  64. void RenderWindow::_windowFocusReceived()
  65. {
  66. THROW_IF_NOT_CORE_THREAD;
  67. mHasFocus = true;
  68. RenderWindowManager::instance().windowFocusReceived(this);
  69. }
  70. void RenderWindow::_windowFocusLost()
  71. {
  72. THROW_IF_NOT_CORE_THREAD;
  73. mHasFocus = false;
  74. }
  75. void RenderWindow::destroy()
  76. {
  77. RenderWindowManager::instance().windowDestroyed(this);
  78. RenderTarget::destroy();
  79. }
  80. RenderWindowPtr RenderWindow::create(RENDER_WINDOW_DESC& desc, RenderWindowPtr parentWindow)
  81. {
  82. return RenderWindowManager::instance().create(desc, parentWindow);
  83. }
  84. }