tmxparser  2.1.0
 All Classes Functions Variables Pages
TmxGroupLayer.h
1 //-----------------------------------------------------------------------------
2 // Copyright (c) 2018, Adaleigh Martin
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 ADALEIGH MARTIN 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 <string>
27 #include <vector>
28 
29 #include "TmxLayer.h"
30 #include "TmxPropertySet.h"
31 
32 namespace Tmx
33 {
34  class Map;
35 
36  //-------------------------------------------------------------------------
39  //-------------------------------------------------------------------------
40  class GroupLayer : public Tmx::Layer
41  {
42  public:
44  GroupLayer(const Tmx::Map *_map);
45  ~GroupLayer();
46 
48  void Parse(const tinyxml2::XMLNode *groupLayerNode);
49 
51  void AddChild(Tmx::Layer* childLayer);
52 
53  Tmx::Layer* GetChild(const int index) const;
54 
57  const std::vector<Tmx::Layer*> GetChildren() const noexcept;
58 
59  int GetNumChildren() const noexcept;
60 
62  void SetOffset(const int offsetX, const int offsetY);
63 
65  int GetOffsetX() const noexcept;
66 
68  int GetOffsetY() const noexcept;
69 
70  private:
71  std::vector<Tmx::Layer*> children;
72 
73  int offsetX;
74  int offsetY;
75  };
76 }
Base class for other layer types.
Definition: TmxLayer.h:54
void Parse(const tinyxml2::XMLNode *groupLayerNode)
Parse a GroupLayer element.
Definition: TmxGroupLayer.cpp:48
A class used for holding groups of layers to create a layer heirarchy.
Definition: TmxGroupLayer.h:40
const std::vector< Tmx::Layer * > GetChildren() const noexcept
Returns a variable containing information about the image of the ImageLayer.
Definition: TmxGroupLayer.cpp:110
int GetOffsetY() const noexcept
Returns the y offset.
Definition: TmxGroupLayer.cpp:130
void AddChild(Tmx::Layer *childLayer)
Adds a child Layer to the group.
Definition: TmxGroupLayer.cpp:101
GroupLayer(const Tmx::Map *_map)
Construct an GroupLayer on the given map.
Definition: TmxGroupLayer.cpp:37
This class is the root class of the parser.
Definition: TmxMap.h:115
int GetOffsetX() const noexcept
Returns the x offset.
Definition: TmxGroupLayer.cpp:125
void SetOffset(const int offsetX, const int offsetY)
Sets the offset for this GroupLayer.
Definition: TmxGroupLayer.cpp:119