Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

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. }