Open Source Tomb Raider Engine
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

FontTRLE.h 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 "system/Shader.h"
  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. glm::vec4 color, std::string s);
  22. static void drawTextWrapped(unsigned int x, unsigned int y, float scale,
  23. glm::vec4 color, 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. static ShaderBuffer vertexBuffer;
  35. static ShaderBuffer uvBuffer;
  36. };
  37. #endif