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.

Font.h 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*!
  2. * \file include/system/Font.h
  3. * \brief Font Interface
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _FONT_H_
  8. #define _FONT_H_
  9. #include <string>
  10. /*!
  11. * \brief Font interface
  12. */
  13. class Font {
  14. public:
  15. static void shutdown();
  16. static int initialize(std::string font = "");
  17. static std::string getFontName() { return fontName; }
  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. static void drawTextCentered(unsigned int x, unsigned int y, float scale,
  25. glm::vec4 color, unsigned int width, std::string s);
  26. static void setShowFontBox(bool s) { showFontBox = s; }
  27. static bool getShowFontBox() { return showFontBox; }
  28. private:
  29. static void drawFontBox(unsigned int x, unsigned int y, unsigned int w, unsigned int h);
  30. static bool isInit;
  31. static std::string fontName;
  32. static bool showFontBox;
  33. };
  34. #endif