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 1019B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*!
  2. * \file include/Font.h
  3. * \brief Font interface
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _FONT_H_
  8. #define _FONT_H_
  9. typedef struct {
  10. char *text;
  11. unsigned int x;
  12. unsigned int y;
  13. int w;
  14. int h;
  15. float scale;
  16. unsigned char color[4];
  17. } FontString;
  18. /*!
  19. * \brief Font interface
  20. */
  21. class Font {
  22. public:
  23. /*!
  24. * \brief Deconstructs an object of Font
  25. */
  26. virtual ~Font();
  27. virtual void setFont(const char *font);
  28. virtual int initialize() = 0;
  29. virtual void writeString(FontString &s) = 0;
  30. virtual void drawText(unsigned int x, unsigned int y, float scale,
  31. const unsigned char color[4], const char *s, ...)
  32. __attribute__((format(printf, 6, 0)));
  33. virtual void drawTextCentered(unsigned int x, unsigned int y, float scale,
  34. const unsigned char color[4], unsigned int width, const char *s, ...)
  35. __attribute__((format(printf, 7, 0)));
  36. protected:
  37. bool mFontInit;
  38. char *mFontName;
  39. };
  40. Font &getFont();
  41. #endif