Removed trailing whitespace from all *.?pp files
[supertux.git] / src / video / drawing_request.hpp
1 //  SuperTux
2 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
3 //
4 //  This program is free software: you can redistribute it and/or modify
5 //  it under the terms of the GNU General Public License as published by
6 //  the Free Software Foundation, either version 3 of the License, or
7 //  (at your option) any later version.
8 //
9 //  This program is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //  GNU General Public License for more details.
13 //
14 //  You should have received a copy of the GNU General Public License
15 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 #ifndef HEADER_SUPERTUX_VIDEO_DRAWING_REQUEST_HPP
18 #define HEADER_SUPERTUX_VIDEO_DRAWING_REQUEST_HPP
19
20 #include <memory>
21 #include <string>
22 #include <vector>
23
24 #include <stdint.h>
25
26 #include "math/vector.hpp"
27 #include "video/color.hpp"
28 #include "video/drawing_context.hpp"
29 #include "video/font.hpp"
30 #include "video/glutil.hpp"
31
32 class Surface;
33
34 enum RequestType
35 {
36   SURFACE, SURFACE_PART, TEXT, GRADIENT, FILLRECT, INVERSEELLIPSE, DRAW_LIGHTMAP, GETLIGHT
37 };
38
39 struct DrawingRequestData
40 {
41   virtual ~DrawingRequestData()
42   {}
43 };
44
45 struct SurfaceRequest : public DrawingRequestData
46 {
47   SurfaceRequest() :
48     surface()
49   {}
50
51   const Surface* surface;
52
53 private:
54   SurfaceRequest(const SurfaceRequest&) = delete;
55   SurfaceRequest& operator=(const SurfaceRequest&) = delete;
56 };
57
58 struct SurfacePartRequest : public DrawingRequestData
59 {
60   SurfacePartRequest() :
61     surface(),
62     source(),
63     size()
64   {}
65
66   const Surface* surface;
67   Vector source;
68   Vector size;
69
70 private:
71   SurfacePartRequest(const SurfacePartRequest&) = delete;
72   SurfacePartRequest& operator=(const SurfacePartRequest&) = delete;
73 };
74
75 struct TextRequest : public DrawingRequestData
76 {
77   TextRequest() :
78     font(),
79     text(),
80     alignment()
81   {}
82
83   const Font* font;
84   std::string text;
85   FontAlignment alignment;
86
87 private:
88   TextRequest(const TextRequest&);
89   TextRequest& operator=(const TextRequest&);
90 };
91
92 struct GradientRequest : public DrawingRequestData
93 {
94   GradientRequest()  :
95     top(),
96     bottom(),
97     size()
98   {}
99
100   Color top;
101   Color bottom;
102   Vector size;
103 };
104
105 struct FillRectRequest : public DrawingRequestData
106 {
107   FillRectRequest() :
108     color(),
109     size(),
110     radius()
111   {}
112
113   Color  color;
114   Vector size;
115   float  radius;
116 };
117
118 struct InverseEllipseRequest : public DrawingRequestData
119 {
120   InverseEllipseRequest() :
121     color(),
122     size()
123   {}
124
125   Color  color;
126   Vector size;
127 };
128
129 struct DrawingRequest
130 {
131   Target target;
132   RequestType type;
133   Vector pos;
134
135   int layer;
136   DrawingEffect drawing_effect;
137   float alpha;
138   Blend blend;
139   float angle;
140   Color color;
141
142   DrawingRequestData* request_data;
143
144   DrawingRequest() :
145     target(),
146     type(),
147     pos(),
148     layer(),
149     drawing_effect(),
150     alpha(),
151     blend(),
152     angle(0.0f),
153     color(1.0f, 1.0f, 1.0f, 1.0f),
154     request_data()
155   {}
156
157   bool operator<(const DrawingRequest& other) const
158   {
159     return layer < other.layer;
160   }
161 };
162
163 struct GetLightRequest : public DrawingRequestData
164 {
165   GetLightRequest() : color_ptr() {}
166
167   Color* color_ptr;
168
169 private:
170   GetLightRequest(const GetLightRequest&) = delete;
171   GetLightRequest& operator=(const GetLightRequest&) = delete;
172 };
173
174 #endif
175
176 /* EOF */