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.
 
 
 

66 rivejä
1.2 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://www.wtfpl.net/ for more details.
  9. //
  10. #pragma once
  11. //
  12. // The Text class
  13. // --------------
  14. //
  15. #include "engine/entity.h"
  16. namespace lol
  17. {
  18. class TextData;
  19. enum class TextAlign
  20. {
  21. Left,
  22. Right,
  23. Center,
  24. };
  25. class Text : public Entity
  26. {
  27. public:
  28. Text(String const &text, char const *font);
  29. virtual ~Text();
  30. /** Set the text that will be displayed */
  31. void SetText(String const &text);
  32. void SetInt(int val);
  33. /** Set the position of the text object, in the 3D world. */
  34. void SetPos(vec3 pos);
  35. /** Set the text scaling */
  36. void SetScale(vec2 scale);
  37. /** Set the spacing between characters, as a fraction of character width */
  38. void SetSpacing(float spacing);
  39. /** Set the alignment method */
  40. void SetAlign(TextAlign align);
  41. vec3 GetPos();
  42. ivec2 GetFontSize();
  43. protected:
  44. virtual void TickDraw(float seconds, Scene &scene);
  45. private:
  46. TextData *data;
  47. };
  48. } /* namespace lol */