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.cpp 611B

12345678910111213141516171819202122232425262728293031
  1. /*!
  2. * \file src/Font.cpp
  3. * \brief Font implementation
  4. *
  5. * \author xythobuz
  6. */
  7. #include "global.h"
  8. #include "utils/strings.h"
  9. #include "Window.h"
  10. #include "Font.h"
  11. #include "FontManager.h"
  12. Font &getFont() {
  13. static FontManager gFont;
  14. return gFont;
  15. }
  16. Font::~Font() {
  17. }
  18. void Font::setFont(std::string font) {
  19. assert(mFontInit == false);
  20. mFontName = font;
  21. }
  22. void Font::drawTextCentered(unsigned int x, unsigned int y, float scale,
  23. const unsigned char color[4], unsigned int width, std::string s) {
  24. drawText(x + ((width / 2) - (widthText(scale, s) / 2)), y, scale, color, s);
  25. }