UGDK  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
manager.h
Go to the documentation of this file.
1 #ifndef UGDK_TEXT_MANAGER_H_
2 #define UGDK_TEXT_MANAGER_H_
3 
4 #include <ugdk/math/vector2D.h>
5 #include <ugdk/text.h>
6 
7 #include <unordered_map>
8 #include <memory>
9 #include <string>
10 
11 namespace ugdk {
12 namespace text {
13 
14 class Manager {
15  public:
16  Manager(const std::string& default_language_code);
17  ~Manager();
18 
19  bool Initialize();
20  bool Release();
21 
22  TextBox* GetText( const std::string& text);
23  TextBox* GetText( const std::string& text, const std::string& font, int width = -1);
24  TextBox* GetTextFromFile(const std::string& path);
25  TextBox* GetTextFromFile(const std::string& path, const std::string& font, int width = -1);
26 
27  Font* current_font() const { return current_font_; }
28  Font* GetFont(const std::string& name) const;
29 
30  Font* AddFont(const std::string& name, const std::string& path, double size);
31 
32  //================
33  const std::string& default_language() const { return default_language_; }
34  const std::string& active_language() const { return active_language_; }
35 
36  bool RegisterLanguage(const std::string& code, const std::string& language_file);
37 
39  bool Setup(const std::string& active_language);
40 
41  private:
42  Font *current_font_;
43  std::unordered_map<std::string, std::unique_ptr<Font>> fonts_;
44 
45  std::string default_language_;
46  std::string active_language_;
47  std::unordered_map<std::string, std::string> registered_languages_;
48 };
49 
50 } // namespace text
51 } // namespace ugdk
52 
53 #endif // UGDK_TEXT_MANAGER_H_
Font * current_font() const
Definition: manager.h:27
Manager(const std::string &default_language_code)
Definition: font.h:16
Definition: manager.h:14
Definition: animation.h:11
Font * GetFont(const std::string &name) const
TextBox * GetTextFromFile(const std::string &path)
bool RegisterLanguage(const std::string &code, const std::string &language_file)
const std::string & active_language() const
Definition: manager.h:34
const std::string & default_language() const
Definition: manager.h:33
Font * AddFont(const std::string &name, const std::string &path, double size)
TextBox * GetText(const std::string &text)
bool Setup(const std::string &active_language)
Definition: textbox.h:18