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 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. #include "Font.h"
  10. /*!
  11. * \brief Tomb Raider Level Editor Font loader
  12. */
  13. class FontTRLE : public Font {
  14. public:
  15. /*!
  16. * \brief Constructs an object of FontTRLE
  17. */
  18. FontTRLE();
  19. /*!
  20. * \brief Deconstructs an object of FontTRLE
  21. */
  22. virtual ~FontTRLE();
  23. virtual int initialize();
  24. virtual unsigned int widthText(float scale, std::string s);
  25. virtual void drawText(unsigned int x, unsigned int y, float scale,
  26. const unsigned char color[4], std::string s);
  27. virtual unsigned int heightText(float scale, unsigned int maxWidth, std::string s);
  28. virtual void drawTextWrapped(unsigned int x, unsigned int y, float scale,
  29. const unsigned char color[4], unsigned int maxWidth, std::string s);
  30. private:
  31. void loadLPS(std::string f);
  32. void writeChar(unsigned int index, unsigned int xDraw, unsigned int yDraw,
  33. float scale, const unsigned char color[4]);
  34. unsigned int mFontTexture;
  35. // 106 entries: (x, y, w, h, offset)
  36. int offsets[106][5] = {
  37. { 174, 52, 3, 12, -11 },
  38. { 98, 58, 6, 4, -10 },
  39. { 82, 26, 13, 11, -10 },
  40. { 78, 38, 9, 13, -10 },
  41. { 214, 13, 14, 11, -9 },
  42. { 40, 26, 13, 11, -10 },
  43. { 157, 57, 5, 6, -11 },
  44. { 204, 39, 5, 15, -12 },
  45. { 34, 40, 5, 15, -12 },
  46. { 184, 59, 4, 4, -11 },
  47. { 22, 40, 10, 10, -9 },
  48. { 178, 59, 4, 4, -2 },
  49. { 106, 60, 7, 2, -4 },
  50. { 114, 60, 4, 3, -2 },
  51. { 212, 38, 8, 14, -12 },
  52. { 88, 49, 9, 9, -8 },
  53. { 200, 55, 5, 9, -8 },
  54. { 46, 52, 8, 9, -8 },
  55. { 88, 38, 7, 10, -8 },
  56. { 62, 40, 10, 10, -8 },
  57. { 142, 48, 8, 11, -9 },
  58. { 232, 50, 8, 10, -9 },
  59. { 120, 47, 8, 11, -9 },
  60. { 22, 51, 8, 10, -9 },
  61. { 110, 49, 8, 10, -8 },
  62. { 152, 57, 4, 7, -7 },
  63. { 136, 57, 4, 9, -7 },
  64. { 178, 40, 11, 9, -8 },
  65. { 210, 53, 10, 6, -7 },
  66. { 240, 40, 11, 9, -7 },
  67. { 12, 39, 9, 12, -11 },
  68. { 66, 13, 15, 13, -10 },
  69. { 130, 13, 13, 12, -11 },
  70. { 214, 25, 12, 12, -11 },
  71. { 132, 35, 10, 12, -11 },
  72. { 0, 26, 12, 12, -11 },
  73. { 14, 26, 12, 12, -11 },
  74. { 66, 27, 11, 12, -11 },
  75. { 182, 27, 11, 12, -11 },
  76. { 200, 13, 13, 12, -11 },
  77. { 222, 54, 4, 12, -11 },
  78. { 56, 52, 4, 15, -11 },
  79. { 230, 15, 12, 12, -11 },
  80. { 144, 35, 10, 12, -11 },
  81. { 48, 13, 17, 12, -11 },
  82. { 144, 13, 13, 12, -11 },
  83. { 54, 26, 11, 12, -11 },
  84. { 200, 26, 11, 12, -11 },
  85. { 240, 0, 13, 14, -11 },
  86. { 158, 13, 13, 12, -11 },
  87. { 156, 35, 10, 12, -11 },
  88. { 172, 13, 13, 12, -11 },
  89. { 98, 13, 14, 12, -11 },
  90. { 82, 13, 14, 12, -11 },
  91. { 24, 13, 22, 12, -11 },
  92. { 186, 13, 12, 13, -11 },
  93. { 114, 13, 14, 12, -11 },
  94. { 228, 28, 11, 12, -11 },
  95. { 62, 60, 5, 3, -4 },
  96. { 248, 59, 5, 3, -4 },
  97. { 88, 59, 7, 3, -4 },
  98. { 142, 60, 6, 2, -3 },
  99. { 120, 59, 7, 3, -4 },
  100. { 242, 59, 4, 4, -11 },
  101. { 98, 49, 10, 8, -7 },
  102. { 96, 35, 10, 13, -12 },
  103. { 72, 52, 8, 8, -7 },
  104. { 0, 39, 10, 11, -10 },
  105. { 164, 52, 8, 8, -7 },
  106. { 168, 38, 9, 13, -12 },
  107. { 120, 35, 11, 11, -7 },
  108. { 108, 35, 10, 13, -12 },
  109. { 194, 27, 5, 11, -10 },
  110. { 40, 51, 5, 15, -10 },
  111. { 28, 26, 11, 13, -12 },
  112. { 82, 52, 5, 12, -11 },
  113. { 96, 26, 17, 8, -7 },
  114. { 152, 48, 11, 8, -7 },
  115. { 62, 51, 9, 8, -7 },
  116. { 244, 15, 10, 12, -7 },
  117. { 52, 39, 9, 12, -7 },
  118. { 10, 52, 9, 8, -7 },
  119. { 190, 52, 8, 8, -7 },
  120. { 0, 51, 8, 10, -9 },
  121. { 178, 50, 10, 8, -7 },
  122. { 130, 48, 11, 8, -7 },
  123. { 132, 26, 17, 8, -7 },
  124. { 242, 50, 10, 8, -7 },
  125. { 40, 38, 10, 12, -7 },
  126. { 232, 41, 7, 8, -7 },
  127. { 222, 41, 8, 12, -7 },
  128. { 130, 57, 5, 8, -7 },
  129. { 194, 39, 9, 12, -10 },
  130. { 32, 56, 4, 11, -10 },
  131. { 1, 14, 22, 11, -10 },
  132. { 192, 0, 23, 13, -10 },
  133. { 168, 0, 23, 12, -10 },
  134. { 216, 0, 23, 12, -10 },
  135. { 150, 26, 17, 8, -8 },
  136. { 168, 26, 11, 11, -9 },
  137. { 114, 26, 17, 8, -8 },
  138. { 240, 28, 12, 11, -9 },
  139. { 0, 0, 40, 12, -10 },
  140. { 84, 0, 39, 11, -10 },
  141. { 42, 0, 39, 11, -10 },
  142. { 126, 0, 39, 11, -10 },
  143. };
  144. };
  145. #endif