UGDK  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
label.h
Go to the documentation of this file.
1 #ifndef UGDK_TEXT_LABEL_H_
2 #define UGDK_TEXT_LABEL_H_
3 
4 #include <ugdk/graphic.h>
5 #include <ugdk/text.h>
6 
7 #include <ugdk/ui/drawable.h>
9 #include <ugdk/util/utf8.h>
10 #include <ugdk/structure/types.h>
11 #include <ugdk/math/vector2D.h>
12 
13 #include <string>
14 #include <cstddef>
15 #include <vector>
16 #include <memory>
17 
18 namespace ugdk {
19 namespace text {
20 
21 class Label : public ui::Drawable {
22  public:
23  Label(const std::string& utf8_message, Font* font);
24  Label(const std::u32string& ucs4_message, Font* font);
25  ~Label();
26 
28  void ChangeMessage(const std::string& utf8_message);
29  void ChangeMessage(const std::u32string& ucs4_message);
30 
31  void Draw(graphic::Canvas&) const override;
32  const ugdk::math::Vector2D& size() const override;
33 
34  private:
35  Font* font_;
36  std::unique_ptr<graphic::VertexData> buffer_;
37  std::vector<int> first_vector_, size_vector_;
38 
40  std::size_t num_characters_;
41 };
42 
43 } // namespace text
44 } // namespace ugdk
45 
46 #endif // UGDK_TEXT_LABEL_H_
Definition: canvas.h:28
Definition: vector2D.h:18
Definition: font.h:16
void ChangeMessage(const std::string &utf8_message)
This operation is slow.
Definition: animation.h:11
Definition: label.h:21
Definition: drawable.h:13
void Draw(graphic::Canvas &) const override
Label(const std::string &utf8_message, Font *font)
const ugdk::math::Vector2D & size() const override