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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. float 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, const float color[4], const char *s, ...)
  31. __attribute__((format(printf, 6, 0)));
  32. protected:
  33. bool mFontInit;
  34. char *mFontName;
  35. FontString tempText;
  36. };
  37. Font &getFont();
  38. #endif