FIFE  2008.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
maploader.h
1 /**************************************************************************
2 * Copyright (C) 2005-2011 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 
97  void addPercentDoneListener(PercentDoneListener* listener);
98 
103  const std::string& getLoaderName() const;
104 
105  private:
106  Model* m_model;
107  VFS* m_vfs;
108  ImageManager* m_imageManager;
109  ObjectLoaderPtr m_objectLoader;
110  AtlasLoaderPtr m_atlasLoader;
111  RenderBackend* m_renderBackend;
112  PercentDoneCallback m_percentDoneListener;
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