Fixed compiler warnings due to new loglevel aware log macro
[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/font.hpp"
29 #include "video/glutil.hpp"
30
31 class Surface;
32
33 // some constants for predefined layer values
34 enum {
35   // Image/gradient backgrounds (should cover entire screen)
36   LAYER_BACKGROUND0 = -300,
37   // Particle backgrounds
38   LAYER_BACKGROUND1 = -200,
39   // Tilemap backgrounds
40   LAYER_BACKGROUNDTILES = -100,
41   // Solid tilemaps
42   LAYER_TILES = 0,
43   // Ordinary objects
44   LAYER_OBJECTS = 50,
45   // Objects that pass through walls
46   LAYER_FLOATINGOBJECTS = 150,
47   // 
48   LAYER_FOREGROUNDTILES = 200,
49   // 
50   LAYER_FOREGROUND0 = 300,
51   // 
52   LAYER_FOREGROUND1 = 400,
53   // Hitpoints, time, coins, etc.
54   LAYER_HUD = 500,
55   // Menus, mouse, console etc.
56   LAYER_GUI         = 600
57 };
58
59 class Blend
60 {
61 public:
62   GLenum sfactor;
63   GLenum dfactor;
64
65   Blend()
66     : sfactor(GL_SRC_ALPHA), dfactor(GL_ONE_MINUS_SRC_ALPHA)
67   {}
68
69   Blend(GLenum s, GLenum d)
70     : sfactor(s), dfactor(d)
71   {}
72 };
73
74 enum Target {
75   NORMAL, LIGHTMAP
76 };
77
78 enum RequestType
79 {
80   SURFACE, SURFACE_PART, TEXT, GRADIENT, FILLRECT, INVERSEELLIPSE, DRAW_LIGHTMAP, GETLIGHT
81 };
82
83 struct SurfacePartRequest
84 {
85   SurfacePartRequest() :
86     surface(),
87     source(),
88     size()
89   {}
90
91   const Surface* surface;
92   Vector source;
93   Vector size;
94 };
95
96 struct TextRequest
97 {
98   TextRequest() :
99     font(),
100     text(),
101     alignment()
102   {}
103
104   const Font* font;
105   std::string text;
106   FontAlignment alignment;
107
108 private:
109   TextRequest(const TextRequest&);
110   TextRequest& operator=(const TextRequest&);
111 };
112
113 struct GradientRequest
114 {
115   GradientRequest()  :
116     top(),
117     bottom(),
118     size()
119   {}
120
121   Color top;
122   Color bottom;
123   Vector size;
124 };
125
126 struct FillRectRequest
127 {
128   FillRectRequest() :
129     color(),
130     size(),
131     radius()
132   {}
133
134   Color  color;
135   Vector size;
136   float  radius;
137 };
138
139 struct InverseEllipseRequest
140 {
141   InverseEllipseRequest() :
142     color(),
143     size()
144   {}
145
146   Color  color;
147   Vector size;
148 };
149
150 struct DrawingRequest
151 {
152   Target target;
153   RequestType type;
154   Vector pos;
155
156   int layer;
157   DrawingEffect drawing_effect;
158   float alpha;
159   Blend blend;
160   float angle;
161   Color color;
162
163   void* request_data;
164
165   DrawingRequest() :
166     target(),
167     type(),
168     pos(),
169     layer(),
170     drawing_effect(),
171     alpha(),
172     blend(),
173     angle(0.0f),
174     color(1.0f, 1.0f, 1.0f, 1.0f),
175     request_data()
176   {}
177
178   bool operator<(const DrawingRequest& other) const
179   {
180     return layer < other.layer;
181   }
182 };
183
184 struct GetLightRequest
185 {
186   Color* color_ptr;
187 };
188
189 #endif
190
191 /* EOF */