tmxparser  2.1.0
 All Classes Functions Variables Pages
TmxText.h
1 //-----------------------------------------------------------------------------
2 // TmxText.h
3 //
4 // Copyright (c) 2018, Adaleigh Martin
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 ADALEIGH MARTIN 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: Adaleigh Martin
27 //-----------------------------------------------------------------------------
28 #pragma once
29 
30 #include <vector>
31 #include "TmxColor.h"
32 
33 namespace tinyxml2 {
34  class XMLNode;
35 }
36 
37 namespace Tmx
38 {
39  //--------------------------------------------------------------------------
41  //--------------------------------------------------------------------------
42  enum HorizontalAlignment
43  {
44  LEFT,
45  HCENTER,
46  RIGHT
47  };
48 
49  //--------------------------------------------------------------------------
51  //--------------------------------------------------------------------------
52  enum VerticalAlignment
53  {
54  TOP,
55  VCENTER,
56  BOTTOM
57  };
58 
59  //-------------------------------------------------------------------------
61  //-------------------------------------------------------------------------
62  class Text
63  {
64  public:
66  Text();
67  ~Text();
68 
69  std::string GetFontFamily() const noexcept { return font_family; }
70  int GetPixelSize() const noexcept { return pixel_size; }
71  bool Wraps() const noexcept { return wrap; }
72  Color* GetColor() const noexcept { return color; }
73  bool IsBold() const noexcept { return bold; }
74  bool IsItalic() const noexcept { return italic; }
75  bool IsUnderline() const noexcept { return underline; }
76  bool IsStrikeout() const noexcept { return strikeout; }
77  bool UseKerning() const noexcept { return kerning; }
78  HorizontalAlignment GetHorizontalAlignment() const noexcept { return horizontal_alignment; }
79  VerticalAlignment GetVerticalAlignment() const noexcept { return vertical_alignment; }
80 
82  void Parse(const tinyxml2::XMLNode *textNode);
83 
84  private:
85  std::string font_family;
86  int pixel_size;
87  bool wrap;
88  Color* color;
89  bool bold;
90  bool italic;
91  bool underline;
92  bool strikeout;
93  bool kerning;
94  HorizontalAlignment horizontal_alignment;
95  VerticalAlignment vertical_alignment;
96 
97  };
98 }
void Parse(const tinyxml2::XMLNode *textNode)
Parse the text node.
Definition: TmxText.cpp:51
Text()
Construct text with the given options.
Definition: TmxText.cpp:35
A class used for storing information about a color.
Definition: TmxColor.h:38
Class to store an Text of an Object.
Definition: TmxText.h:62