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.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*!
  2. * \file include/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. /*!
  10. * \brief Tomb Raider Level Editor Font loader
  11. */
  12. class FontTRLE {
  13. public:
  14. static void shutdown();
  15. static int initialize(std::string font);
  16. static unsigned int widthText(float scale, std::string s);
  17. static unsigned int heightText(float scale, unsigned int maxWidth, std::string s);
  18. static void drawText(unsigned int x, unsigned int y, float scale,
  19. const unsigned char color[4], std::string s);
  20. static void drawTextWrapped(unsigned int x, unsigned int y, float scale,
  21. const unsigned char color[4], unsigned int maxWidth, std::string s);
  22. private:
  23. static void setDefaultOffsets();
  24. static void loadLPS(std::string f);
  25. static void writeChar(unsigned int index, unsigned int xDraw, unsigned int yDraw,
  26. float scale, const unsigned char color[4]);
  27. static bool mFontInit;
  28. static unsigned int mFontTexture;
  29. // 106 entries: (x, y, w, h, offset)
  30. static int offsets[106][5];
  31. static int defaultOffsets[106][5];
  32. };
  33. #endif