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

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