Add license text to the top of every source file.
[Tsunagari.git] / src / area-tmx.h
blob5f06b2b2f78adf27e4b8927f3ccd45da768a8f1e
1 /*********************************
2 ** Tsunagari Tile Engine **
3 ** area-tmx.h **
4 ** Copyright 2011-2012 OmegaSDG **
5 *********************************/
7 // **********
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // **********
27 #ifndef AREA_TMX_H
28 #define AREA_TMX_H
30 #include <string>
32 #include "area.h"
33 #include "tile.h"
34 #include "xml.h"
36 class Viewport;
37 class Player;
38 class Music;
40 class AreaTMX : public Area
42 public:
43 AreaTMX(Viewport* view, Player* player, Music* music,
44 const std::string& filename);
45 virtual ~AreaTMX();
47 //! Parse the file specified in the constructor, generating a full Area
48 //! object. Must be called before use.
49 virtual bool init();
51 private:
52 //! Allocate Tile objects for one layer of map.
53 void allocateMapLayer();
55 //! Parse an Area file.
56 bool processDescriptor();
57 bool processMapProperties(XMLNode node);
58 bool processTileSet(XMLNode node);
59 bool processTileType(XMLNode node, TileType& type,
60 TiledImageRef& img, int id);
61 bool processLayer(XMLNode node);
62 bool processLayerProperties(XMLNode node, double* depth);
63 bool processLayerData(XMLNode node, int z);
64 bool processObjectGroup(XMLNode node);
65 bool processObjectGroupProperties(XMLNode node, double* depth);
66 bool processObject(XMLNode node, int z);
67 bool splitTileFlags(const std::string& strOfFlags, unsigned* flags);
68 bool parseExit(const std::string& dest, Exit* exit,
69 bool* wwide, bool* hwide);
70 bool parseRGBA(const std::string& str,
71 Gosu::Color::Channel* r,
72 Gosu::Color::Channel* g,
73 Gosu::Color::Channel* b,
74 Gosu::Color::Channel* a);
76 std::vector<TileType*> gids;
79 #endif