ScummVM API documentation
Resources.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * Copyright (C) 2006-2010 - Frictional Games
24 *
25 * This file is part of HPL1 Engine.
26 */
27
28#ifndef HPL_RESOURCES_H
29#define HPL_RESOURCES_H
30
31#include "hpl1/engine/system/SystemTypes.h"
32#include "common/stablemap.h"
33
34#include "hpl1/engine/graphics/GPUProgram.h"
35
36#include "hpl1/engine/game/Updateable.h"
37
38class TiXmlElement;
39
40namespace hpl {
41
42class cImageEntity;
43
44class LowLevelResources;
45class iLowLevelGraphics;
46class LowLevelSystem;
47class cSystem;
48class iResourceManager;
49class cFileSearcher;
50class cImageManager;
51class cGpuProgramManager;
52class cTileSetManager;
53class cImageEntityManager;
54class cParticleManager;
55class cSoundManager;
56class cFontManager;
57class cScriptManager;
58class cTextureManager;
59class cMaterialManager;
60class cSoundEntityManager;
61class cAnimationManager;
62class cMeshManager;
63class cVideoManager;
64class cConfigFile;
65class cArea2D;
66class cSound;
67class cMeshLoaderHandler;
68class cScene;
69class cGraphics;
70class iRenderable;
71class cWorld3D;
72class iEntity3D;
73class cLanguageFile;
74class cGui;
75
76//-------------------------------------------------------
77
79public:
80 iEntity2DLoader(const tString &asName) : msName(asName) {}
81 virtual ~iEntity2DLoader() {}
82
83 const tString &GetName() { return msName; }
84
85 virtual void Load(cImageEntity *apImageEntity) = 0;
86
87protected:
88 tString msName;
89};
90
92typedef tEntity2DLoaderMap::iterator tEntity2DLoaderMapIt;
93
94//-------------------------------------------------------
95
97public:
98 iArea2DLoader(const tString &asName) : msName(asName) {}
99 virtual ~iArea2DLoader() {}
100
101 const tString &GetName() { return msName; }
102
103 virtual void Load(cArea2D *apArea) = 0;
104
105protected:
106 tString msName;
107};
108
110typedef tArea2DLoaderMap::iterator tArea2DLoaderMapIt;
111
112//-------------------------------------------------------
113
115public:
116 iEntity3DLoader(const tString &asName) : msName(asName) {}
117 virtual ~iEntity3DLoader() {}
118
119 const tString &GetName() { return msName; }
120
121 virtual iEntity3D *Load(const tString &asName, TiXmlElement *apRootElem, const cMatrixf &a_mtxTransform,
122 cWorld3D *apWorld, const tString &asFileName, bool abLoadReferences) = 0;
123
124protected:
125 tString msName;
126};
127
129typedef tEntity3DLoaderMap::iterator tEntity3DLoaderMapIt;
130
131//-------------------------------------------------------
132
134public:
135 iArea3DLoader(const tString &asName) : msName(asName) {}
136 virtual ~iArea3DLoader() {}
137
138 const tString &GetName() { return msName; }
139
140 virtual iEntity3D *Load(const tString &asName, const cVector3f &avSize, const cMatrixf &a_mtxTransform, cWorld3D *apWorld) = 0;
141
142protected:
143 tString msName;
144};
145
147typedef tArea3DLoaderMap::iterator tArea3DLoaderMapIt;
148
149//-------------------------------------------------------
150
151// Should this be made a map so you can do
152// GetManager(tString) when getting a manager?
153// This way you would be able to add your own resource types
154// easily.
157
158//-------------------------------------------------------
159
160class cResources : public iUpdateable {
161public:
162 cResources(LowLevelResources *apLowLevelResources, iLowLevelGraphics *apLowLevelGraphics);
163 virtual ~cResources();
164
165 void Init(cGraphics *apGraphics, cSystem *apSystem, cSound *apSound, cScene *apScene, cGui *apGui);
166
167 void Update(float afTimeStep);
168
169 LowLevelResources *GetLowLevel();
170 cFileSearcher *GetFileSearcher();
171
172 bool AddResourceDir(const tString &asDir, const tString &asMask = "*.*");
173 void ClearResourceDirs();
174
175 bool SetLanguageFile(const tString &asFile);
176 const tWString &Translate(const tString &asCat, const tString &asName);
177
178 void AddEntity2DLoader(iEntity2DLoader *apLoader);
179 iEntity2DLoader *GetEntity2DLoader(const tString &asName);
180
181 void AddEntity3DLoader(iEntity3DLoader *apLoader, bool abSetAsDefault = false);
182 iEntity3DLoader *GetEntity3DLoader(const tString &asName);
183
184 void AddArea3DLoader(iArea3DLoader *apLoader, bool abSetAsDefault = false);
185 iArea3DLoader *GetArea3DLoader(const tString &asName);
186
187 void AddArea2DLoader(iArea2DLoader *apLoader);
188 iArea2DLoader *GetArea2DLoader(const tString &asName);
189
190 bool LoadResourceDirsFile(const tString &asFile);
191
192 cImageManager *GetImageManager() { return mpImageManager; }
193 cGpuProgramManager *GetGpuProgramManager() { return mpGpuProgramManager; }
194 cTileSetManager *GetTileSetManager() { return mpTileSetManager; }
195 cImageEntityManager *GetImageEntityManager() { return mpImageEntityManager; }
196 cParticleManager *GetParticleManager() { return mpParticleManager; }
197 cSoundManager *GetSoundManager() { return mpSoundManager; }
198 cFontManager *GetFontManager() { return mpFontManager; }
199 cScriptManager *GetScriptManager() { return mpScriptManager; }
200 cTextureManager *GetTextureManager() { return mpTextureManager; }
201 cMaterialManager *GetMaterialManager() { return mpMaterialManager; }
202 cMeshManager *GetMeshManager() { return mpMeshManager; }
203 cMeshLoaderHandler *GetMeshLoaderHandler() { return mpMeshLoaderHandler; }
204 cSoundEntityManager *GetSoundEntityManager() { return mpSoundEntityManager; }
205 cAnimationManager *GetAnimationManager() { return mpAnimationManager; }
206 cVideoManager *GetVideoManager() { return mpVideoManager; }
207
208 LowLevelSystem *GetLowLevelSystem() { return mpLowLevelSystem; }
209
210private:
211 LowLevelResources *mpLowLevelResources;
212 iLowLevelGraphics *mpLowLevelGraphics;
213 LowLevelSystem *mpLowLevelSystem;
214 cFileSearcher *mpFileSearcher;
215
216 tResourceManagerList mlstManagers;
217 cImageManager *mpImageManager;
218 cGpuProgramManager *mpGpuProgramManager;
219 cTileSetManager *mpTileSetManager;
220 cImageEntityManager *mpImageEntityManager;
221 cParticleManager *mpParticleManager;
222 cSoundManager *mpSoundManager;
223 cFontManager *mpFontManager;
224 cScriptManager *mpScriptManager;
225 cTextureManager *mpTextureManager;
226 cMaterialManager *mpMaterialManager;
227 cSoundEntityManager *mpSoundEntityManager;
228 cAnimationManager *mpAnimationManager;
229 cVideoManager *mpVideoManager;
230
231 cLanguageFile *mpLanguageFile;
232
233 cMeshManager *mpMeshManager;
234 cMeshLoaderHandler *mpMeshLoaderHandler;
235
236 tEntity2DLoaderMap m_mMapEntity2DLoaders;
237 tArea2DLoaderMap m_mMapArea2DLoaders;
238
239 tEntity3DLoaderMap m_mEntity3DLoaders;
240 iEntity3DLoader *mpDefaultEntity3DLoader;
241
242 tArea3DLoaderMap m_mArea3DLoaders;
243 iArea3DLoader *mpDefaultArea3DLoader;
244
245 tWString mwsEmptyString;
246};
247
248} // namespace hpl
249
250#endif // HPL_RESOURCES_H
typename TreeT::BasicIterator iterator
Definition: stablemap.h:48
Definition: str.h:59
Definition: ustr.h:57
Definition: tinyxml.h:864
Definition: low_level_resources.h:40
Definition: low_level_system.h:95
Definition: AnimationManager.h:39
Definition: Area2D.h:39
Definition: FileSearcher.h:43
Definition: FontManager.h:40
Definition: GpuProgramManager.h:39
Definition: Graphics.h:46
Definition: Gui.h:73
Definition: ImageEntity.h:44
Definition: ImageEntityManager.h:40
Definition: ImageManager.h:48
Definition: LanguageFile.h:64
Definition: MaterialManager.h:41
Definition: MeshLoaderHandler.h:50
Definition: MeshManager.h:39
Definition: ParticleManager.h:50
Definition: Resources.h:160
Definition: Scene.h:61
Definition: ScriptManager.h:39
Definition: SoundEntityManager.h:39
Definition: Sound.h:40
Definition: SoundManager.h:39
Definition: System.h:36
Definition: TextureManager.h:47
Definition: TileSetManager.h:39
Definition: VideoManager.h:52
Definition: World3D.h:179
Definition: Resources.h:96
Definition: Resources.h:133
Definition: Resources.h:78
Definition: Entity3D.h:81
Definition: Resources.h:114
Definition: LowLevelGraphics.h:200
Definition: Updateable.h:35
Definition: list_intern.h:54