Texture.h 715 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. GWEN
  3. Copyright (c) 2010 Facepunch Studios
  4. See license in Gwen.h
  5. */
  6. #pragma once
  7. #ifndef GWEN_TEXTURE_H
  8. #define GWEN_TEXTURE_H
  9. #include <string>
  10. #include "Gwen/BaseRender.h"
  11. #include "Gwen/TextObject.h"
  12. namespace Gwen
  13. {
  14. //
  15. // Texture
  16. //
  17. struct Texture
  18. {
  19. TextObject name;
  20. void* data;
  21. int m_intData;
  22. bool failed;
  23. int width;
  24. int height;
  25. Texture()
  26. {
  27. data = NULL;
  28. m_intData = 0;
  29. width = 4;
  30. height = 4;
  31. failed = false;
  32. }
  33. ~Texture()
  34. {
  35. }
  36. void Load( const TextObject& str, Gwen::Renderer::Base* render )
  37. {
  38. name = str;
  39. render->LoadTexture( this );
  40. }
  41. void Release( Gwen::Renderer::Base* render )
  42. {
  43. render->FreeTexture( this );
  44. }
  45. };
  46. }
  47. #endif