Overte C++ Documentation
TextEntityItem.h
1 //
2 // TextEntityItem.h
3 // libraries/entities/src
4 //
5 // Created by Brad Hefta-Gaub on 12/4/13.
6 // Copyright 2013 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_TextEntityItem_h
13 #define hifi_TextEntityItem_h
14 
15 #include "EntityItem.h"
16 
17 #include "PulsePropertyGroup.h"
18 
19 class TextEntityItem : public EntityItem {
20 public:
21  static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
22 
23  TextEntityItem(const EntityItemID& entityItemID);
24 
25  ALLOW_INSTANTIATION // This class can be instantiated
26 
28  virtual void setUnscaledDimensions(const glm::vec3& value) override;
29  virtual ShapeType getShapeType() const override { return SHAPE_TYPE_BOX; }
30 
31  // methods for getting/setting all properties of an entity
32  virtual EntityItemProperties getProperties(const EntityPropertyFlags& desiredProperties, bool allowEmptyDesiredProperties) const override;
33  virtual bool setSubClassProperties(const EntityItemProperties& properties) override;
34 
35  virtual EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const override;
36 
37  virtual void appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params,
38  EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData,
39  EntityPropertyFlags& requestedProperties,
40  EntityPropertyFlags& propertyFlags,
41  EntityPropertyFlags& propertiesDidntFit,
42  int& propertyCount,
43  OctreeElement::AppendState& appendState) const override;
44 
45  virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
46  ReadBitstreamToTreeParams& args,
47  EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
48  bool& somethingChanged) override;
49 
50  static const QString DEFAULT_TEXT;
51  void setText(const QString& value);
52  QString getText() const;
53 
54  static const float DEFAULT_LINE_HEIGHT;
55  void setLineHeight(float value);
56  float getLineHeight() const;
57 
58  static const glm::u8vec3 DEFAULT_TEXT_COLOR;
59  glm::u8vec3 getTextColor() const;
60  void setTextColor(const glm::u8vec3& value);
61 
62  static const float DEFAULT_TEXT_ALPHA;
63  float getTextAlpha() const;
64  void setTextAlpha(float value);
65 
66  static const glm::u8vec3 DEFAULT_BACKGROUND_COLOR;
67  glm::u8vec3 getBackgroundColor() const;
68  void setBackgroundColor(const glm::u8vec3& value);
69 
70  float getBackgroundAlpha() const;
71  void setBackgroundAlpha(float value);
72 
73  static const float DEFAULT_MARGIN;
74  float getLeftMargin() const;
75  void setLeftMargin(float value);
76 
77  float getRightMargin() const;
78  void setRightMargin(float value);
79 
80  float getTopMargin() const;
81  void setTopMargin(float value);
82 
83  float getBottomMargin() const;
84  void setBottomMargin(float value);
85 
86  bool getUnlit() const;
87  void setUnlit(bool value);
88 
89  void setFont(const QString& value);
90  QString getFont() const;
91 
92  TextEffect getTextEffect() const;
93  void setTextEffect(TextEffect value);
94 
95  glm::u8vec3 getTextEffectColor() const;
96  void setTextEffectColor(const glm::u8vec3& value);
97 
98  static const float DEFAULT_TEXT_EFFECT_THICKNESS;
99  float getTextEffectThickness() const;
100  void setTextEffectThickness(float value);
101 
102  TextAlignment getAlignment() const;
103  void setAlignment(TextAlignment value);
104 
105  PulsePropertyGroup getPulseProperties() const;
106 
107 private:
108  QString _text;
109  float _lineHeight;
110  glm::u8vec3 _textColor;
111  float _textAlpha;
112  glm::u8vec3 _backgroundColor;
113  float _backgroundAlpha;
114  PulsePropertyGroup _pulseProperties;
115  float _leftMargin;
116  float _rightMargin;
117  float _topMargin;
118  float _bottomMargin;
119  bool _unlit { false };
120 
121  QString _font;
122  TextAlignment _alignment;
123  TextEffect _effect;
124  glm::u8vec3 _effectColor;
125  float _effectThickness;
126 };
127 
128 #endif // hifi_TextEntityItem_h
Definition: EntityItem.h:82
virtual ShapeType getShapeType() const
return preferred shape type (actual physical shape may differ)
Definition: EntityItem.h:390
Abstract ID for editing model items. Used in EntityItem JS API.
Definition: EntityItemID.h:28
Definition: EntityItemProperties.h:106
Handles packing of the data portion of PacketType_OCTREE_DATA messages.
Definition: OctreePacketData.h:93