tmxparser  2.1.0
 All Classes Functions Variables Pages
TmxImage.h
1 //-----------------------------------------------------------------------------
2 // TmxImage.h
3 //
4 // Copyright (c) 2010-2014, Tamir Atias
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are met:
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above copyright
12 // notice, this list of conditions and the following disclaimer in the
13 // documentation and/or other materials provided with the distribution.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 // DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
19 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 //
26 // Author: Tamir Atias
27 //-----------------------------------------------------------------------------
28 #pragma once
29 
30 #include <string>
31 #include "TmxColor.h"
32 
33 namespace tinyxml2 {
34  class XMLNode;
35 }
36 
37 namespace Tmx
38 {
39  //-------------------------------------------------------------------------
41  //-------------------------------------------------------------------------
42  class Image
43  {
44  public:
45  Image();
46  ~Image();
47 
49  void Parse(const tinyxml2::XMLNode *imageNode);
50 
52  const std::string &GetSource() const { return source; }
53 
55  int GetWidth() const { return width; }
56 
58  int GetHeight() const { return height; }
59 
62  { return transparent_color; }
63 
64  private:
65  std::string source;
66  int width;
67  int height;
68  Tmx::Color transparent_color;
69  };
70 }
Tmx::Color GetTransparentColor() const
Get the transparent color used in the image. If none is set return a fully transparent color...
Definition: TmxImage.h:61
int GetHeight() const
Get the height of the image.
Definition: TmxImage.h:58
const std::string & GetSource() const
Get the path to the file of the image (relative to the map)
Definition: TmxImage.h:52
A class used for storing information about a color.
Definition: TmxColor.h:38
int GetWidth() const
Get the width of the image.
Definition: TmxImage.h:55
A class used for storing information about an image within a tileset.
Definition: TmxImage.h:42
void Parse(const tinyxml2::XMLNode *imageNode)
Parses an image element.
Definition: TmxImage.cpp:44