Cafu Engine
GuiResources.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_GUISYS_GUI_RESOURCES_HPP_INCLUDED
8 #define CAFU_GUISYS_GUI_RESOURCES_HPP_INCLUDED
9 
10 #include "Templates/Array.hpp"
11 
12 #include <string>
13 
14 
15 namespace cf { class TrueTypeFontT; }
16 class CafuModelT;
17 class ModelManagerT;
18 
19 
20 namespace cf
21 {
22  namespace GuiSys
23  {
24  /// This class manages and provides resources (fonts and models) for GuiImplT instances.
25  /// One GuiResourcesT can be commonly used for several GuiImplT instances at once.
27  {
28  public:
29 
30  /// The constructor.
31  GuiResourcesT(ModelManagerT& ModelMan);
32 
33  /// The destructor.
35 
36  /// Returns (a pointer to) a font instance for the given filename.
37  /// The returned font instance is possibly shared with other users, and must not be deleted.
38  /// @param FontName The name of the font to return.
39  /// @returns A pointer to the specified font, or NULL if there was an error (e.g. the font could not be loaded).
40  TrueTypeFontT* GetFont(const std::string& FontName);
41 
42  /// Returns (a pointer to) a model instance for the given filename.
43  /// @see ModelManagerT::GetModel() for more details.
44  const CafuModelT* GetModel(const std::string& FileName, std::string& ErrorMsg);
45 
46 
47  private:
48 
49  GuiResourcesT(const GuiResourcesT&); ///< Use of the Copy Constructor is not allowed.
50  void operator = (const GuiResourcesT&); ///< Use of the Assignment Operator is not allowed.
51 
52  ArrayT<TrueTypeFontT*> m_Fonts; ///< The fonts that are used within the GUIs.
53  ModelManagerT& m_ModelMan; ///< The model manager from which any models that occur in the GUIs are aquired.
54  };
55  }
56 }
57 
58 #endif
This class represents a native Cafu model.
Definition: Model_cmdl.hpp:45
~GuiResourcesT()
The destructor.
Definition: GuiResources.cpp:23
TrueTypeFontT * GetFont(const std::string &FontName)
Returns (a pointer to) a font instance for the given filename.
Definition: GuiResources.cpp:30
GuiResourcesT(ModelManagerT &ModelMan)
The constructor.
Definition: GuiResources.cpp:17
A class for rendering fonts that have been created with the Cafu MakeFont tool.
Definition: FontTT.hpp:22
This class is used for managing model instances.
Definition: ModelManager.hpp:31
const CafuModelT * GetModel(const std::string &FileName, std::string &ErrorMsg)
Returns (a pointer to) a model instance for the given filename.
Definition: GuiResources.cpp:56
Definition: Renderer.hpp:16
This class manages and provides resources (fonts and models) for GuiImplT instances.
Definition: GuiResources.hpp:26