TDME2  1.9.200
GUICharacter.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <tdme/tdme.h>
4 
5 /**
6  * GUI character
7  * @author Andreas Drewke
8  */
10 {
11  friend class GUIFont;
12 
13 public:
14  /**
15  * Public constructor
16  * @param id id
17  * @param x x location on the sprite sheet
18  * @param y y location on the sprite sheet
19  * @param width width of the character image
20  * @param height height of the character image
21  * @param xOffset the amount the x position should be offset when drawing the image
22  * @param yOffset the amount the y position should be offset when drawing the image
23  * @param xAdvance the amount to move the current position after drawing the character
24  */
25  inline GUICharacter(
26  uint32_t id,
27  float x,
28  float y,
29  float width,
30  float height,
31  float xOffset,
32  float yOffset,
33  float xAdvance
34  ):
35  id(id),
36  x(x),
37  y(y),
38  width(width),
39  height(height),
43  {
44  //
45  }
46 
47  /**
48  * @return id
49  */
50  uint32_t getId() {
51  return id;
52  }
53 
54  /**
55  * @return x location on the sprite sheet
56  */
57  float getX() {
58  return x;
59  }
60 
61  /**
62  * @return y location on the sprite sheet
63  */
64  float getY() {
65  return y;
66  }
67 
68  /**
69  * @return width of the character image
70  */
71  float getWidth() {
72  return width;
73  }
74 
75  /**
76  * @return height of the character image
77  */
78  float getHeight() {
79  return height;
80  }
81 
82  /**
83  * @return the amount the x position should be offset when drawing the image
84  */
85  float getXOffset() {
86  return xOffset;
87  }
88 
89  /**
90  * @return the amount the y position should be offset when drawing the image
91  */
92  float getYOffset() {
93  return yOffset;
94  }
95 
96  /**
97  * @return the amount to move the current position after drawing the character
98  */
99  float getXAdvance() {
100  return xAdvance;
101  }
102 
103  /**
104  * @return if the character is rotated in texture atlas
105  */
106  bool isRotated() {
107  return rotated;
108  }
109 
110 private:
111  uint32_t id;
112  float x;
113  float y;
114  float width;
115  float height;
116  float xOffset;
117  float yOffset;
118  float xAdvance;
119  bool rotated { false };
120 };
GUICharacter(uint32_t id, float x, float y, float width, float height, float xOffset, float yOffset, float xAdvance)
Public constructor.
Definition: GUICharacter.h:25
GUI font class.
Definition: GUIFont.h:41