FIFE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
maploader.h
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright (C) 2005-2013 by the FIFE team *
3 * http://www.fifengine.net *
4 * This file is part of FIFE. *
5 * *
6 * FIFE is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Lesser General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2.1 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * Lesser General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20 ***************************************************************************/
21 
22 #ifndef FIFE_MAPLOADER_H_
23 #define FIFE_MAPLOADER_H_
24 
25 // Standard C++ library includes
26 #include <string>
27 #include <vector>
28 
29 // 3rd party library includes
30 
31 // FIFE includes
32 // These includes are split up in two parts, separated by one empty line
33 // First block: files included from the FIFE root src directory
34 // Second block: files included from the same folder
35 
36 #include "imaploader.h"
37 #include "ianimationloader.h"
38 #include "percentdonelistener.h"
39 
40 namespace FIFE {
41  class Model;
42  class Map;
43  class VFS;
44  class Layer;
45  class ImageManager;
46  class RenderBackend;
47  class PercentDoneListener;
48 
49  class MapLoader : public IMapLoader {
50  public:
51  MapLoader(Model* model, VFS* vfs, ImageManager* imageManager, RenderBackend* renderBackend);
52 
53  ~MapLoader();
54 
58  void setObjectLoader(const FIFE::ObjectLoaderPtr& objectLoader);
59 
63  void setAnimationLoader(const FIFE::AnimationLoaderPtr& animationLoader);
64 
68  void setAtlasLoader(const FIFE::AtlasLoaderPtr& atlasLoader);
69 
73  bool isLoadable(const std::string& filename) const;
74 
78  Map* load(const std::string& filename);
79 
85  void loadImportFile(const std::string& file, const std::string& directory="");
86 
91  void loadImportDirectory(const std::string& directory);
92 
98 
103  const std::string& getLoaderName() const;
104 
105  private:
113 
114  std::string m_loaderName;
115  std::string m_mapDirectory;
116  std::vector<std::string> m_importDirectories;
117 
118  };
119 
124  MapLoader* createDefaultMapLoader(Model* model, VFS* vfs, ImageManager* imageManager, RenderBackend* renderBackend);
125 }
126 
127 #endif
Abstract interface for all the renderbackends.
Definition: renderbackend.h:92
void addPercentDoneListener(PercentDoneListener *listener)
allows adding a listener to the map loader for percent completed events
Definition: maploader.cpp:806
ImageManager.
Definition: imagemanager.h:54
Map * load(const std::string &filename)
Definition: maploader.cpp:80
void setAnimationLoader(const FIFE::AnimationLoaderPtr &animationLoader)
Definition: maploader.cpp:704
MapLoader(Model *model, VFS *vfs, ImageManager *imageManager, RenderBackend *renderBackend)
Definition: maploader.cpp:68
std::string m_loaderName
Definition: maploader.h:114
void setAtlasLoader(const FIFE::AtlasLoaderPtr &atlasLoader)
Definition: maploader.cpp:710
void loadImportFile(const std::string &file, const std::string &directory="")
used to load an object file if directory is provided then file is assumed relative to directory if re...
Definition: maploader.cpp:763
MapLoader * createDefaultMapLoader(Model *model, VFS *vfs, ImageManager *imageManager, RenderBackend *renderBackend)
convenience function for creating the default fife map loader deleting the object returned from this ...
Definition: maploader.cpp:815
std::vector< std::string > m_importDirectories
Definition: maploader.h:116
void setObjectLoader(const FIFE::ObjectLoaderPtr &objectLoader)
Definition: maploader.cpp:697
PercentDoneCallback m_percentDoneListener
Definition: maploader.h:112
ObjectLoaderPtr m_objectLoader
Definition: maploader.h:109
const std::string & getLoaderName() const
returns the loader name associated with this map file loader, this will only be populated after the l...
Definition: maploader.cpp:810
ImageManager * m_imageManager
Definition: maploader.h:108
A model is a facade for everything in the model.
Definition: model.h:53
RenderBackend * m_renderBackend
Definition: maploader.h:111
Interface class that all map loaders should derive from.
Definition: imaploader.h:43
std::string m_mapDirectory
Definition: maploader.h:115
the main VFS (virtual file system) class
Definition: vfs.h:58
Model * m_model
Definition: maploader.h:106
AtlasLoaderPtr m_atlasLoader
Definition: maploader.h:110
void loadImportDirectory(const std::string &directory)
used to load a directory of object files recursively if relativeToMap is true then the directory is a...
Definition: maploader.cpp:778
A container of Layer(s).
Definition: map.h:87
bool isLoadable(const std::string &filename) const
Definition: maploader.cpp:716