RenderTarget.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef RENDERTARGET_H_
  2. #define RENDERTARGET_H_
  3. #include "Base.h"
  4. #include "Texture.h"
  5. namespace gameplay
  6. {
  7. /**
  8. * Represents a linear area of display memory and usually reside
  9. * in the display memory of the display card.
  10. */
  11. class RenderTarget : public Ref
  12. {
  13. public:
  14. /**
  15. * Create a RenderTarget and add it to the list of available RenderTargets.
  16. *
  17. * The created RenderTarget contains a 32-bit texture with a single/base mipmap level only.
  18. *
  19. * @param id The ID of the new RenderTarget.
  20. * @param width The width of the new RenderTarget.
  21. * @param height The height of the new RenderTarget.
  22. *
  23. * @return A newly created RenderTarget.
  24. */
  25. static RenderTarget* create(const char* id, unsigned int width, unsigned int height);
  26. /**
  27. * Get a named RenderTarget from its ID.
  28. *
  29. * @param id The ID of the RenderTarget to search for.
  30. *
  31. * @return The RenderTarget with the specified ID, or NULL if one was not found.
  32. */
  33. static RenderTarget* getRenderTarget(const char* id);
  34. /**
  35. * Get the ID of this RenderTarget.
  36. *
  37. * @return The ID of this RenderTarget.
  38. */
  39. const char* getID() const;
  40. /**
  41. * Get the backing texture of this RenderTarget.
  42. *
  43. * @return The backing texture of this RenderTarget.
  44. */
  45. Texture* getTexture() const;
  46. private:
  47. /**
  48. * Constructor.
  49. */
  50. RenderTarget(const char* id);
  51. /**
  52. * Destructor.
  53. */
  54. ~RenderTarget();
  55. std::string _id;
  56. Texture* _texture;
  57. };
  58. }
  59. #endif