xoreos  0.0.5
guiquad.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef GRAPHICS_AURORA_GUIQUAD_H
26 #define GRAPHICS_AURORA_GUIQUAD_H
27 
28 #include "src/common/maths.h"
29 
31 
33 
34 namespace Common {
35  class UString;
36 }
37 
38 namespace Graphics {
39 
40 namespace Aurora {
41 
42 class GUIQuad : public GUIElement {
43 public:
44  GUIQuad(const Common::UString &texture,
45  float x1 , float y1 , float x2 , float y2,
46  float tX1 = 0.0f, float tY1 = 0.0f, float tX2 = 1.0f, float tY2 = 1.0f);
48  float x1 , float y1 , float x2 , float y2,
49  float tX1 = 0.0f, float tY1 = 0.0f, float tX2 = 1.0f, float tY2 = 1.0f);
50  GUIQuad(TextureHandle texture,
51  float x1 , float y1 , float x2 , float y2,
52  float tX1 = 0.0f, float tY1 = 0.0f, float tX2 = 1.0f, float tY2 = 1.0f);
53  ~GUIQuad();
54 
56  void getPosition(float &x, float &y, float &z) const;
58  void setPosition(float x, float y, float z = -FLT_MAX);
59 
61  void setRotation(float angle);
62 
64  void getColor(float &r, float &g, float &b, float &a) const;
66  void setColor(float r, float g, float b, float a);
68  void setTexture(const Common::UString &texture);
70  void setTexture(TextureHandle texture);
71 
73  void setScissor(int x, int y, int width, int height);
74 
75  float getWidth () const;
76  float getHeight() const;
77 
78  void setWidth (float w);
79  void setHeight(float h);
80 
81  void setXOR(bool enabled);
82 
83  void setScissor(bool enabled);
84 
86  bool isIn(float x, float y) const;
87 
88  // Renderable
89  void calculateDistance();
90  void render(RenderPass pass);
91 
92 private:
94 
95  float _r;
96  float _g;
97  float _b;
98  float _a;
99 
100  float _angle;
101 
102  float _x1;
103  float _y1;
104  float _x2;
105  float _y2;
106 
107  float _tX1;
108  float _tY1;
109  float _tX2;
110  float _tY2;
111 
116 
117  bool _xor;
118  bool _scissor;
120 };
121 
122 } // End of namespace Aurora
123 
124 } // End of namespace Graphics
125 
126 #endif // GRAPHICS_AURORA_GUIQUAD_H
void setScissor(int x, int y, int width, int height)
Set the scissor test parameters.
Definition: guiquad.cpp:181
void setHeight(float h)
Set the quad&#39;s height.
Definition: guiquad.cpp:204
Definition: 2dafile.h:39
A class holding an UTF-8 string.
Definition: ustring.h:48
void setWidth(float w)
Set the quad&#39;s width.
Definition: guiquad.cpp:196
Mathematical helpers.
float getWidth() const
Return the quad&#39;s width.
Definition: guiquad.cpp:188
void setColor(float r, float g, float b, float a)
Set the current color of the quad.
Definition: guiquad.cpp:143
A handle to an Aurora texture.
void setXOR(bool enabled)
Enable/Disable XOR mode.
Definition: guiquad.cpp:212
void getColor(float &r, float &g, float &b, float &a) const
Get the current color of the quad.
Definition: guiquad.cpp:135
TextureHandle _texture
Definition: guiquad.h:93
A GUI element.
RenderPass
Definition: types.h:97
void setRotation(float angle)
Set the current rotation of the quad in degrees.
Definition: guiquad.cpp:131
GUIQuad(const Common::UString &texture, float x1, float y1, float x2, float y2, float tX1=0.0f, float tY1=0.0f, float tX2=1.0f, float tY2=1.0f)
Definition: guiquad.cpp:37
bool isIn(float x, float y) const
Is the point within the quad?
Definition: guiquad.cpp:228
An element of the GUI.
Definition: guielement.h:33
void getPosition(float &x, float &y, float &z) const
Get the current position of the quad.
Definition: guiquad.cpp:110
void setTexture(const Common::UString &texture)
Set the current texture of the quad.
Definition: guiquad.cpp:154
void setPosition(float x, float y, float z=-FLT_MAX)
Set the current position of the quad.
Definition: guiquad.cpp:116
#define pass
Definition: fft.cpp:257
void render(RenderPass pass)
Render the object.
Definition: guiquad.cpp:240
A handle to a texture.
Definition: texturehandle.h:51
float getHeight() const
Return the quad&#39;s height.
Definition: guiquad.cpp:192
#define FLT_MAX
Definition: maths.h:47
void calculateDistance()
Calculate the object&#39;s distance.
Definition: guiquad.cpp:237