FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
maploader.h
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright (C) 2005-2019 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 AnimationManager;
47  class RenderBackend;
48  class PercentDoneListener;
49 
50  class MapLoader : public IMapLoader {
51  public:
52  MapLoader(Model* model, VFS* vfs, ImageManager* imageManager, RenderBackend* renderBackend);
53 
54  ~MapLoader();
55 
59  void setObjectLoader(const FIFE::ObjectLoaderPtr& objectLoader);
60 
65 
69  void setAnimationLoader(const FIFE::AnimationLoaderPtr& animationLoader);
70 
75 
79  void setAtlasLoader(const FIFE::AtlasLoaderPtr& atlasLoader);
80 
85 
89  bool isLoadable(const std::string& filename) const;
90 
94  Map* load(const std::string& filename);
95 
101  void loadImportFile(const std::string& file, const std::string& directory="");
102 
107  void loadImportDirectory(const std::string& directory);
108 
114 
119  const std::string& getLoaderName() const;
120 
121  private:
129 
130  std::string m_loaderName;
131  std::string m_mapDirectory;
132  std::vector<std::string> m_importDirectories;
133 
134  };
135 
140  MapLoader* createDefaultMapLoader(Model* model, VFS* vfs, ImageManager* imageManager, RenderBackend* renderBackend);
141 }
142 
143 #endif
Abstract interface for all the renderbackends.
void addPercentDoneListener(PercentDoneListener *listener)
allows adding a listener to the map loader for percent completed events
Definition: maploader.cpp:857
ImageManager.
Definition: imagemanager.h:54
Map * load(const std::string &filename)
Definition: maploader.cpp:83
void setAnimationLoader(const FIFE::AnimationLoaderPtr &animationLoader)
Definition: maploader.cpp:738
MapLoader(Model *model, VFS *vfs, ImageManager *imageManager, RenderBackend *renderBackend)
Definition: maploader.cpp:71
std::string m_loaderName
Definition: maploader.h:130
void setAtlasLoader(const FIFE::AtlasLoaderPtr &atlasLoader)
Definition: maploader.cpp:751
bool isLoadable(const std::string &filename) const
Definition: maploader.cpp:764
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:811
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:866
std::vector< std::string > m_importDirectories
Definition: maploader.h:132
void setObjectLoader(const FIFE::ObjectLoaderPtr &objectLoader)
Definition: maploader.cpp:728
PercentDoneCallback m_percentDoneListener
Definition: maploader.h:128
AnimationManager.
ObjectLoaderPtr m_objectLoader
Definition: maploader.h:126
FIFE::AnimationLoaderPtr getAnimationLoader()
Definition: maploader.cpp:744
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:861
ImageManager * m_imageManager
Definition: maploader.h:124
FIFE::ObjectLoaderPtr getObjectLoader()
Definition: maploader.cpp:734
A model is a facade for everything in the model.
Definition: model.h:54
RenderBackend * m_renderBackend
Definition: maploader.h:127
Interface class that all map loaders should derive from.
Definition: imaploader.h:43
std::string m_mapDirectory
Definition: maploader.h:131
the main VFS (virtual file system) class
Definition: vfs.h:58
Model * m_model
Definition: maploader.h:122
FIFE::AtlasLoaderPtr getAtlasLoader()
Definition: maploader.cpp:757
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:829
A container of Layer(s).
Definition: map.h:88
AnimationManager * m_animationManager
Definition: maploader.h:125