tmxparser  2.1.0
 All Classes Functions Variables Pages
TmxTerrain.h
1 //-----------------------------------------------------------------------------
2 // Copyright (c) 2010-2014, Tamir Atias
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the
11 // documentation and/or other materials provided with the distribution.
12 //
13 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 // DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
17 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 //-----------------------------------------------------------------------------
24 #pragma once
25 
26 #include <vector>
27 
28 #include "TmxPropertySet.h"
29 
30 namespace tinyxml2
31 {
32  class XMLNode;
33 }
34 
35 namespace Tmx
36 {
37  //-------------------------------------------------------------------------
41  //-------------------------------------------------------------------------
42  class Terrain
43  {
44  public:
45  Terrain();
46  ~Terrain();
47 
49  void Parse(const tinyxml2::XMLNode *terrainNode);
50 
52  const std::string &GetName() const { return name; }
53 
55  int GetTileId() const
56  {
57  return tileID;
58  }
59 
62  {
63  return properties;
64  }
65 
66  private:
67  std::string name;
68  int tileID;
69 
70  Tmx::PropertySet properties;
71  };
72 }
const std::string & GetName() const
Get the name of the terrain type.
Definition: TmxTerrain.h:52
This class contains a map of properties.
Definition: TmxPropertySet.h:47
Class to contain information about every terrain in the tileset/terraintypes element.
Definition: TmxTerrain.h:42
void Parse(const tinyxml2::XMLNode *terrainNode)
Parse a terrain type node.
Definition: TmxTerrain.cpp:43
const Tmx::PropertySet & GetProperties() const
Get a set of properties regarding the terrain type.
Definition: TmxTerrain.h:61
int GetTileId() const
Get the local tile-id of the tile that represents the terrain type visually.
Definition: TmxTerrain.h:55