root/cafu/trunk/CaWE/GameConfig.hpp

Revision 457, 4.2 KB (checked in by Carsten, 4 months ago)

Using UltraEdit's multi-line search-and-replace-in-files feature, replaced


^#ifndef _(CAFU|CF|CFS|CA)_(.*)_$
^#define _\1_\2_$

with

#ifndef CAFU_\2_INCLUDED
#define CAFU_\2_INCLUDED

and


^#ifndef _(.*)_HPP_$
^#define _\1_HPP_$

with

#ifndef CAFU_\1_HPP_INCLUDED
#define CAFU_\1_HPP_INCLUDED

Closes #91.

Line 
1/*
2=================================================================================
3This file is part of Cafu, the open-source game engine and graphics engine
4for multiplayer, cross-platform, real-time 3D action.
5Copyright (C) 2002-2012 Carsten Fuchs Software.
6
7Cafu is free software: you can redistribute it and/or modify it under the terms
8of the GNU General Public License as published by the Free Software Foundation,
9either version 3 of the License, or (at your option) any later version.
10
11Cafu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13PURPOSE. See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with Cafu. If not, see <http://www.gnu.org/licenses/>.
17
18For support and more information about Cafu, visit us at <http://www.cafu.de>.
19=================================================================================
20*/
21
22#ifndef CAFU_GAME_CONFIG_HPP_INCLUDED
23#define CAFU_GAME_CONFIG_HPP_INCLUDED
24
25#include "EditorMaterialManager.hpp"
26#include "GuiSys/GuiImpl.hpp"
27#include "Math3D/BoundingBox.hpp"
28#include "Models/ModelManager.hpp"
29#include "Templates/Array.hpp"
30#include "wx/wx.h"
31
32
33namespace cf
34{
35    namespace FileSys
36    {
37        class FileSystemT;
38    }
39}
40
41class EntityClassT;
42class wxFileConfig;
43
44
45/// The class describes the settings for a game/MOD.
46/// Some of the settings are loaded from the CaWE-spefific config file (edited by the user in the main "Configure CaWE" dialog).
47/// Some of the settings are loaded from the games EntityClassDefs.lua script.
48/// Other settings are loaded directly from the files and data in the game/MOD directory.
49class GameConfigT
50{
51    public:
52
53    class InitErrorT { };
54
55    GameConfigT(wxFileConfig& CfgFile, const wxString& Name_, const wxString& ModDir_);
56    ~GameConfigT();
57
58    const EntityClassT* FindClass(const wxString& Name) const;
59    const ArrayT<const EntityClassT*>& GetEntityClasses() const { return m_EntityClasses; }
60    EditorMatManT& GetMatMan() { return m_MatMan; }
61    const EditorMatManT& GetMatMan() const { return m_MatMan; }
62
63    /// Returns the model for the given FileName that is relative to ModDir.
64    const CafuModelT* GetModel(const wxString& FileName, wxString* ErrorMsg=NULL) const;
65
66    /// All GUIs that are created in this game config (no matter if in the Map Editor, the Gui Editor, or the Model Editor)
67    /// share their font and model resources via the returned GuiResourcesT instance.
68    cf::GuiSys::GuiResourcesT& GetGuiResources() { return m_GuiResources; }
69
70    int GetMaxMapCoord() const { return  m_MaxMapCoord; }
71    int GetMinMapCoord() const { return -m_MaxMapCoord; }
72    BoundingBox3fT GetMaxMapBB() const;
73
74    /// Saves this game configuration to CfgFile that has been set to the proper path (directory / group) by the caller.
75    void Save(wxFileConfig& CfgFile) const;
76
77
78    // Settings obtained from the CfgFile.
79    const wxString Name;
80    const wxString ModDir;
81
82    wxString       DefaultPointEntity;
83    wxString       DefaultSolidEntity;
84
85    float          DefaultTextureScale;
86    float          DefaultLightmapScale;
87    wxString       CordonTexture;
88
89
90    private:
91
92    GameConfigT(const GameConfigT&);        ///< Use of the Copy Constructor    is not allowed.
93    void operator = (const GameConfigT&);   ///< Use of the Assignment Operator is not allowed.
94
95    ArrayT<cf::FileSys::FileSystemT*> m_MountedFileSystems;     ///< The file systems that have been mounted for this game config.
96    ArrayT<const EntityClassT*>       m_EntityClasses;          ///< The entity classes as obtained from the EntityClassDefs.lua script.
97    EditorMatManT                     m_MatMan;                 ///< The material manager for this game config.
98    ModelManagerT                     m_ModelMan;               ///< The model manager for this game config.
99    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).
100    int                               m_MaxMapCoord;
101};
102
103#endif
Note: See TracBrowser for help on using the browser.