2
0

Font.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include "Base.h"
  2. #include "Font.h"
  3. namespace gameplay
  4. {
  5. Font::Font(void) :
  6. style(0),
  7. size(0),
  8. texMapWidth(0),
  9. texMapHeight(0)
  10. {
  11. }
  12. Font::~Font(void)
  13. {
  14. }
  15. unsigned int Font::getTypeId(void) const
  16. {
  17. return FONT_ID;
  18. }
  19. const char* Font::getElementName(void) const
  20. {
  21. return "Font";
  22. }
  23. void Font::writeBinary(FILE* file)
  24. {
  25. Object::writeBinary(file);
  26. write(family, file);
  27. write(style, file);
  28. write(size, file);
  29. write(charset, file);
  30. writeBinaryObjects(glyphs, file);
  31. write(texMapWidth, file);
  32. write(texMapHeight, file);
  33. write(texMap, file);
  34. }
  35. void Font::writeText(FILE* file)
  36. {
  37. fprintElementStart(file);
  38. fprintfElement(file, "family", family);
  39. fprintfElement(file, "style", style);
  40. fprintfElement(file, "size", size);
  41. fprintfElement(file, "alphabet", charset);
  42. //fprintfElement(file, "glyphs", glyphs);
  43. fprintfElement(file, "texMapWidth", texMapWidth);
  44. fprintfElement(file, "texMapHeight", texMapHeight);
  45. //fprintfElement(file, "texMap", texMap);
  46. fprintElementEnd(file);
  47. }
  48. }