UGDK  0.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
textmanager.h
Go to the documentation of this file.
1 #ifndef HORUSEYE_FRAMEWORK_TEXTMANAGER_H_
2 #define HORUSEYE_FRAMEWORK_TEXTMANAGER_H_
3 
4 #include <vector>
5 #include <map>
6 #include <ugdk/math/vector2D.h>
7 #include <ugdk/graphic.h>
8 
9 #define TEXT_MANAGER() ugdk::Engine::reference()->text_manager()
10 
11 namespace ugdk {
12 namespace graphic {
13 
14 class TextManager {
15  public:
16  TextManager() : current_font_(NULL) {}
17  ~TextManager();
18 
19  bool Initialize();
20  bool Release();
21 
22  Text* GetText( const std::wstring& text);
23  Text* GetText( const std::wstring& text, const std::string& font, int width = -1);
24  Text* GetTextFromFile(const std:: string& path);
25  Text* GetTextFromFile(const std:: string& path, const std::string& font, int width = -1);
26 
27  void AddFont(const std::string& name, const std::string& path, int size, char ident, bool fancy);
28 
29  private:
30  Font *current_font_;
31  std::map<std::string, Texture**> font_images_;
32  std::map<std::string, Font*> fonts_;
33 };
34 
35 } // namespace graphic
36 } // namespace ugdk
37 
38 #endif