Glyph.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /**
  2. * Copyright (c) 2006-2010 LOVE Development Team
  3. *
  4. * This software is provided 'as-is', without any express or implied
  5. * warranty. In no event will the authors be held liable for any damages
  6. * arising from the use of this software.
  7. *
  8. * Permission is granted to anyone to use this software for any purpose,
  9. * including commercial applications, and to alter it and redistribute it
  10. * freely, subject to the following restrictions:
  11. *
  12. * 1. The origin of this software must not be misrepresented; you must not
  13. * claim that you wrote the original software. If you use this software
  14. * in a product, an acknowledgment in the product documentation would be
  15. * appreciated but is not required.
  16. * 2. Altered source versions must be plainly marked as such, and must not be
  17. * misrepresented as being the original software.
  18. * 3. This notice may not be removed or altered from any source distribution.
  19. **/
  20. #ifndef LOVE_GRAPHICS_OPENGL_GLYPH_H
  21. #define LOVE_GRAPHICS_OPENGL_GLYPH_H
  22. // LOVE
  23. #include <common/config.h>
  24. #include <common/math.h>
  25. #include <common/Matrix.h>
  26. #include <font/GlyphData.h>
  27. #include <graphics/Drawable.h>
  28. #include <graphics/Volatile.h>
  29. // OpenGL
  30. #include "GLee.h"
  31. #include <SDL/SDL_opengl.h>
  32. namespace love
  33. {
  34. namespace graphics
  35. {
  36. namespace opengl
  37. {
  38. class Glyph : public Drawable, public Volatile
  39. {
  40. private:
  41. love::font::GlyphData * data;
  42. float width, height;
  43. GLuint texture;
  44. vertex vertices[4];
  45. public:
  46. Glyph(love::font::GlyphData * data);
  47. virtual ~Glyph();
  48. bool load();
  49. void unload();
  50. // Implements Volatile.
  51. bool loadVolatile();
  52. void unloadVolatile();
  53. float getWidth() const;
  54. float getHeight() const;
  55. void draw(float x, float y, float angle, float sx, float sy, float ox, float oy) const;
  56. }; // Glyph
  57. } // opengl
  58. } // graphics
  59. } // love
  60. #endif // LOVE_GRAPHICS_OPENGL_GLYPH_H