2
0

BsGUIRenderTexture.h 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsPrerequisites.h"
  5. #include "BsGUITexture.h"
  6. namespace BansheeEngine
  7. {
  8. /** @addtogroup GUI
  9. * @{
  10. */
  11. /**
  12. * Allows you to display a render texture in the GUI. Has the same functionality as GUITexture, but also forwards any
  13. * input to underlying GUI elements being rendered on the provided render texture.
  14. */
  15. class BS_EXPORT GUIRenderTexture : public GUITexture
  16. {
  17. public:
  18. /** Returns type name of the GUI element used for finding GUI element styles. */
  19. static const String& getGUITypeName();
  20. /**
  21. * Creates a new element with the provided render texture.
  22. *
  23. * @param[in] texture Render texture to display.
  24. * @param[in] transparent Determines should the texture be rendered with transparency active.
  25. * @param[in] styleName Optional style to use for the element. Style will be retrieved from GUISkin of the
  26. * GUIWidget the element is used on. If not specified default style is used.
  27. */
  28. static GUIRenderTexture* create(const SPtr<RenderTexture>& texture, bool transparent,
  29. const String& styleName = StringUtil::BLANK);
  30. /**
  31. * Creates a new element with the provided render texture.
  32. *
  33. * @param[in] texture Render texture to display.
  34. * @param[in] transparent Determines should the texture be rendered with transparency active.
  35. * @param[in] options Options that allow you to control how is the element positioned and sized.
  36. * This will override any similar options set by style.
  37. * @param[in] styleName Optional style to use for the element. Style will be retrieved from GUISkin of the
  38. * GUIWidget the element is used on. If not specified default style is used.
  39. */
  40. static GUIRenderTexture* create(const SPtr<RenderTexture>& texture, bool transparent, const GUIOptions& options,
  41. const String& styleName = StringUtil::BLANK);
  42. /**
  43. * Creates a new element with the provided render texture.
  44. *
  45. * @param[in] texture Render texture to display.
  46. * @param[in] styleName Optional style to use for the element. Style will be retrieved from GUISkin of the
  47. * GUIWidget the element is used on. If not specified default style is used.
  48. */
  49. static GUIRenderTexture* create(const SPtr<RenderTexture>& texture, const String& styleName = StringUtil::BLANK);
  50. /**
  51. * Creates a new element with the provided render texture.
  52. *
  53. * @param[in] texture Render texture to display.
  54. * @param[in] options Options that allow you to control how is the element positioned and sized.
  55. * This will override any similar options set by style.
  56. * @param[in] styleName Optional style to use for the element. Style will be retrieved from GUISkin of the
  57. * GUIWidget the element is used on. If not specified default style is used.
  58. */
  59. static GUIRenderTexture* create(const SPtr<RenderTexture>& texture, const GUIOptions& options,
  60. const String& styleName = StringUtil::BLANK);
  61. /** Changes the active render texture whose contents to display in the GUI element. */
  62. void setRenderTexture(const SPtr<RenderTexture>& texture);
  63. protected:
  64. GUIRenderTexture(const String& styleName, const SPtr<RenderTexture>& texture, bool transparent,
  65. const GUIDimensions& dimensions);
  66. virtual ~GUIRenderTexture();
  67. /** @copydoc GUIElement::updateRenderElementsInternal */
  68. virtual void updateRenderElementsInternal() override;
  69. SPtr<RenderTexture> mSourceTexture;
  70. bool mTransparent;
  71. };
  72. /** @} */
  73. }