| 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 |
%module fife |
| 23 |
%{ |
| 24 |
#include "model/structures/map.h" |
| 25 |
%} |
| 26 |
|
| 27 |
%include "util/base/utilbase.i" |
| 28 |
|
| 29 |
namespace FIFE { |
| 30 |
class Layer; |
| 31 |
class Camera; |
| 32 |
} |
| 33 |
|
| 34 |
namespace std { |
| 35 |
%template(LayerList) list<FIFE::Layer*>; |
| 36 |
%template(LayerVector) vector<FIFE::Layer*>; |
| 37 |
%template(CameraVector) vector<FIFE::Camera*>; |
| 38 |
} |
| 39 |
|
| 40 |
namespace FIFE { |
| 41 |
|
| 42 |
class Map; |
| 43 |
class Rect; |
| 44 |
class TriggerController; |
| 45 |
|
| 46 |
%feature("director") MapChangeListener; |
| 47 |
class MapChangeListener { |
| 48 |
public: |
| 49 |
virtual ~MapChangeListener() {}; |
| 50 |
virtual void onMapChanged(Map* map, std::vector<Layer*>& changedLayers) = 0; |
| 51 |
virtual void onLayerCreate(Map* map, Layer* layer) = 0; |
| 52 |
virtual void onLayerDelete(Map* map, Layer* layer) = 0; |
| 53 |
}; |
| 54 |
|
| 55 |
class Map : public FifeClass { |
| 56 |
public: |
| 57 |
|
| 58 |
Map(const std::string& identifier, RenderBackend* renderbackend, const std::vector<RendererBase*>& renderers, TimeProvider* tp_master=NULL); |
| 59 |
~Map(); |
| 60 |
|
| 61 |
const std::string& getId() const; |
| 62 |
void setId(const std::string& id); |
| 63 |
|
| 64 |
Layer* createLayer(const std::string& identifier, CellGrid* grid); |
| 65 |
void deleteLayer(Layer* index); |
| 66 |
|
| 67 |
std::list<Layer*> getLayers() const; |
| 68 |
Layer* getLayer(const std::string& id); |
| 69 |
|
| 70 |
uint32_t getLayerCount() const; |
| 71 |
void deleteLayers(); |
| 72 |
|
| 73 |
void getMinMaxCoordinates(ExactModelCoordinate& min, ExactModelCoordinate& max); |
| 74 |
|
| 75 |
void setTimeMultiplier(float multip); |
| 76 |
double getTimeMultiplier() const; |
| 77 |
|
| 78 |
void addChangeListener(MapChangeListener* listener); |
| 79 |
void removeChangeListener(MapChangeListener* listener); |
| 80 |
bool isChanged(); |
| 81 |
std::vector<Layer*>& getChangedLayers(); |
| 82 |
Camera* addCamera(const std::string& id, const Rect& viewport); |
| 83 |
void removeCamera(const std::string& id); |
| 84 |
Camera* getCamera(const std::string& id); |
| 85 |
std::vector<Camera*>& getCameras(); |
| 86 |
|
| 87 |
void setFilename(const std::string& file); |
| 88 |
const std::string& getFilename() const; |
| 89 |
|
| 90 |
void initializeCellCaches(); |
| 91 |
void finalizeCellCaches(); |
| 92 |
|
| 93 |
TriggerController* getTriggerController() const; |
| 94 |
}; |
| 95 |
} |