Text3D.pkg 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. $#include "Text3D.h"
  2. /// 3D text component.
  3. class Text3D : public Drawable
  4. {
  5. public:
  6. /// Construct.
  7. Text3D(Context* context);
  8. /// Destruct.
  9. ~Text3D();
  10. /// Set font and font size. Return true if successful.
  11. bool SetFont(const String& fontName, int size = DEFAULT_FONT_SIZE);
  12. /// Set font and font size. Return true if successful.
  13. bool SetFont(Font* font, int size = DEFAULT_FONT_SIZE);
  14. /// Set material.
  15. void SetMaterial(Material* material);
  16. /// Set text. Text is assumed to be either ASCII or UTF8-encoded.
  17. void SetText(const String& text);
  18. /// Set horizontal and vertical alignment.
  19. void SetAlignment(HorizontalAlignment hAlign, VerticalAlignment vAlign);
  20. /// Set horizontal alignment.
  21. void SetHorizontalAlignment(HorizontalAlignment align);
  22. /// Set vertical alignment.
  23. void SetVerticalAlignment(VerticalAlignment align);
  24. /// Set row alignment.
  25. void SetTextAlignment(HorizontalAlignment align);
  26. /// Set row spacing, 1.0 for original font spacing.
  27. void SetRowSpacing(float spacing);
  28. /// Set wordwrap. In wordwrap mode the text element will respect its current width. Otherwise it resizes itself freely.
  29. void SetWordwrap(bool enable);
  30. /// Set text width. Only has effect in word wrap mode.
  31. void SetWidth(int width);
  32. /// Set color on all corners.
  33. void SetColor(const Color& color);
  34. /// Set color on one corner.
  35. void SetColor(Corner corner, const Color& color);
  36. /// Set opacity.
  37. void SetOpacity(float opacity);
  38. /// Set whether to face camera automatically.
  39. void SetFaceCamera(bool enable);
  40. /// Return font.
  41. Font* GetFont() const;
  42. /// Return material.
  43. Material* GetMaterial() const;
  44. /// Return font size.
  45. int GetFontSize() const;
  46. /// Return text.
  47. const String& GetText() const;
  48. /// Return row alignment.
  49. HorizontalAlignment GetTextAlignment() const;
  50. /// Return horizontal alignment.
  51. HorizontalAlignment GetHorizontalAlignment() const;
  52. /// Return vertical alignment.
  53. VerticalAlignment GetVerticalAlignment() const;
  54. /// Return row spacing.
  55. float GetRowSpacing() const;
  56. /// Return wordwrap mode.
  57. bool GetWordwrap() const;
  58. /// Return text width.
  59. int GetWidth() const;
  60. /// Return row height.
  61. int GetRowHeight() const;
  62. /// Return number of rows.
  63. unsigned GetNumRows() const;
  64. /// Return corner color.
  65. const Color& GetColor(Corner corner) const;
  66. /// Return opacity.
  67. float GetOpacity() const;
  68. /// Return whether faces camera automatically.
  69. bool GetFaceCamera() const { return faceCamera_; }
  70. };