Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FontTRLE.h 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*!
  2. * \file include/system/FontTRLE.h
  3. * \brief Tomb Raider Level Editor Font loader
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _FONT_TRLE_H_
  8. #define _FONT_TRLE_H_
  9. #include <vector>
  10. #include <glm/vec2.hpp>
  11. /*!
  12. * \brief Tomb Raider Level Editor Font loader
  13. */
  14. class FontTRLE {
  15. public:
  16. static void shutdown();
  17. static int initialize(std::string font);
  18. static unsigned int widthText(float scale, std::string s);
  19. static unsigned int heightText(float scale, unsigned int maxWidth, std::string s);
  20. static void drawText(unsigned int x, unsigned int y, float scale,
  21. const unsigned char color[4], std::string s);
  22. static void drawTextWrapped(unsigned int x, unsigned int y, float scale,
  23. const unsigned char color[4], unsigned int maxWidth, std::string s);
  24. private:
  25. static void setDefaultOffsets();
  26. static void loadLPS(std::string f);
  27. static void writeChar(unsigned int index, unsigned int xDraw, unsigned int yDraw, float scale,
  28. std::vector<glm::vec2>& vertices, std::vector<glm::vec2>& uvs);
  29. static bool mFontInit;
  30. static unsigned int mFontTexture;
  31. // 106 entries: (x, y, w, h, offset)
  32. static int offsets[106][5];
  33. static int defaultOffsets[106][5];
  34. };
  35. #endif