Cafu Engine
GameConfig.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_GAME_CONFIG_HPP_INCLUDED
8 #define CAFU_GAME_CONFIG_HPP_INCLUDED
9 
10 #include "EditorMaterialManager.hpp"
11 #include "GuiSys/GuiResources.hpp"
12 #include "Math3D/BoundingBox.hpp"
13 #include "Models/ModelManager.hpp"
14 #include "Templates/Array.hpp"
15 #include "wx/wx.h"
16 
17 
18 namespace cf
19 {
20  namespace FileSys
21  {
22  class FileSystemT;
23  }
24 }
25 
26 class wxFileConfig;
27 
28 
29 /// The class describes the settings for a game/MOD.
30 /// Some of the settings are loaded from the CaWE-spefific config file (edited by the user in the main "Configure CaWE" dialog).
31 /// Other settings are loaded directly from the files and data in the game/MOD directory.
33 {
34  public:
35 
36  class InitErrorT { };
37 
38  GameConfigT(wxFileConfig& CfgFile, const wxString& Name_, const wxString& ModDir_);
39  ~GameConfigT();
40 
41  EditorMatManT& GetMatMan() { return m_MatMan; }
42  const EditorMatManT& GetMatMan() const { return m_MatMan; }
43 
44  ModelManagerT& GetModelMan() { return m_ModelMan; }
45 
46  /// Returns the model for the given FileName that is relative to ModDir.
47  const CafuModelT* GetModel(const wxString& FileName, wxString* ErrorMsg=NULL) const;
48 
49  /// All GUIs that are created in this game config (no matter if in the Map Editor, the Gui Editor, or the Model Editor)
50  /// share their font and model resources via the returned GuiResourcesT instance.
51  cf::GuiSys::GuiResourcesT& GetGuiResources() { return m_GuiResources; }
52 
53  int GetMaxMapCoord() const { return m_MaxMapCoord; }
54  int GetMinMapCoord() const { return -m_MaxMapCoord; }
55  BoundingBox3fT GetMaxMapBB() const;
56 
57  /// Saves this game configuration to CfgFile that has been set to the proper path (directory / group) by the caller.
58  void Save(wxFileConfig& CfgFile) const;
59 
60 
61  // Settings obtained from the CfgFile.
62  const wxString Name;
63  const wxString ModDir;
64 
65  float DefaultTextureScale;
66  float DefaultLightmapScale;
67  wxString CordonTexture;
68 
69 
70  private:
71 
72  GameConfigT(const GameConfigT&); ///< Use of the Copy Constructor is not allowed.
73  void operator = (const GameConfigT&); ///< Use of the Assignment Operator is not allowed.
74 
75  ArrayT<cf::FileSys::FileSystemT*> m_MountedFileSystems; ///< The file systems that have been mounted for this game config.
76  EditorMatManT m_MatMan; ///< The material manager for this game config.
77  ModelManagerT m_ModelMan; ///< The model manager for this game config.
78  cf::GuiSys::GuiResourcesT m_GuiResources; ///< The provider for resources (fonts and models) for all GUIs in this game config (no matter if in the Map Editor, the Gui Editor, or the Model Editor).
79  int m_MaxMapCoord;
80 };
81 
82 #endif
This class represents a native Cafu model.
Definition: Model_cmdl.hpp:45
Definition: GameConfig.hpp:36
This class manages the editor materials for a game configuration.
Definition: EditorMaterialManager.hpp:20
cf::GuiSys::GuiResourcesT & GetGuiResources()
All GUIs that are created in this game config (no matter if in the Map Editor, the Gui Editor...
Definition: GameConfig.hpp:51
The class describes the settings for a game/MOD.
Definition: GameConfig.hpp:32
const CafuModelT * GetModel(const wxString &FileName, wxString *ErrorMsg=NULL) const
Returns the model for the given FileName that is relative to ModDir.
Definition: GameConfig.cpp:60
This class is used for managing model instances.
Definition: ModelManager.hpp:31
This class represents an axis-aligned bounding-box ("AABB") in 3-dimensional space.
Definition: BoundingBox.hpp:23
void Save(wxFileConfig &CfgFile) const
Saves this game configuration to CfgFile that has been set to the proper path (directory / group) by ...
Definition: GameConfig.cpp:80
This class manages and provides resources (fonts and models) for GuiImplT instances.
Definition: GuiResources.hpp:26