1 // $Id: drawing_request.hpp 4986 2007-04-16 17:48:28Z matzeb $
4 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #ifndef SUPERTUX_DRAWINGREQUEST_H
20 #define SUPERTUX_DRAWINGREQUEST_H
30 //#include <SDL_video.h>
33 //#include "math/vector.hpp"
34 //#include "color.hpp"
36 #include <unison/video/RenderOptions.hpp>
40 // some constants for predefined layer values
42 LAYER_BACKGROUND0 = -300,
43 LAYER_BACKGROUND1 = -200,
44 LAYER_BACKGROUNDTILES = -100,
47 LAYER_FLOATINGOBJECTS = 150,
48 LAYER_FOREGROUNDTILES = 200,
49 LAYER_FOREGROUND0 = 300,
50 LAYER_FOREGROUND1 = 400,
62 : sfactor(GL_SRC_ALPHA), dfactor(GL_ONE_MINUS_SRC_ALPHA)
65 Blend(GLenum s, GLenum d)
66 : sfactor(s), dfactor(d)
69 Unison::Video::BlendMode to_unison_blend() const
71 if(sfactor == GL_ONE && dfactor == GL_ZERO)
73 return Unison::Video::BLEND_NONE;
75 else if(sfactor == GL_SRC_ALPHA && dfactor == GL_ONE_MINUS_SRC_ALPHA)
77 return Unison::Video::BLEND_ALPHA;
79 else if(sfactor == GL_SRC_ALPHA && dfactor == GL_ONE)
81 return Unison::Video::BLEND_ADD;
83 else if(sfactor == GL_ZERO && dfactor == GL_SRC_COLOR)
85 return Unison::Video::BLEND_MOD;
89 assert(0 && "Unsupported blend factors");
100 SURFACE, SURFACE_PART, TEXT, GRADIENT, FILLRECT, GETLIGHT
103 struct SurfacePartRequest
105 const Surface* surface;
113 FontAlignment alignment;
116 struct GradientRequest
122 struct FillRectRequest
128 struct DrawingRequest
135 DrawingEffect drawing_effect;
145 color(1.0f, 1.0f, 1.0f, 1.0f)
148 bool operator<(const DrawingRequest& other) const
150 return layer < other.layer;
154 struct GetLightRequest