projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* remove unused libvorbisenc from FindOggVorbis and link path
[supertux.git]
/
src
/
video
/
drawing_context.cpp
diff --git
a/src/video/drawing_context.cpp
b/src/video/drawing_context.cpp
index
309c4c1
..
b75b950
100644
(file)
--- a/
src/video/drawing_context.cpp
+++ b/
src/video/drawing_context.cpp
@@
-17,17
+17,10
@@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
-
-#include <functional>
#include <algorithm>
#include <algorithm>
-#include <cassert>
-#include <iostream>
-#include <SDL_image.h>
-#include <sstream>
-#include <iomanip>
-#include <physfs.h>
#include "drawing_context.hpp"
#include "drawing_context.hpp"
+
#include "drawing_request.hpp"
#include "video_systems.hpp"
#include "renderer.hpp"
#include "drawing_request.hpp"
#include "video_systems.hpp"
#include "renderer.hpp"
@@
-152,7
+145,7
@@
DrawingContext::draw_surface_part(const Surface* surface, const Vector& source,
void
DrawingContext::draw_text(const Font* font, const std::string& text,
void
DrawingContext::draw_text(const Font* font, const std::string& text,
- const Vector& position, FontAlignment alignment, int layer)
+ const Vector& position, FontAlignment alignment, int layer
, Color color
)
{
DrawingRequest* request = new(obst) DrawingRequest();
{
DrawingRequest* request = new(obst) DrawingRequest();
@@
-162,6
+155,7
@@
DrawingContext::draw_text(const Font* font, const std::string& text,
request->layer = layer;
request->drawing_effect = transform.drawing_effect;
request->alpha = transform.alpha;
request->layer = layer;
request->drawing_effect = transform.drawing_effect;
request->alpha = transform.alpha;
+ request->color = color;
TextRequest* textrequest = new(obst) TextRequest();
textrequest->font = font;
TextRequest* textrequest = new(obst) TextRequest();
textrequest->font = font;
@@
-174,10
+168,10
@@
DrawingContext::draw_text(const Font* font, const std::string& text,
void
DrawingContext::draw_center_text(const Font* font, const std::string& text,
void
DrawingContext::draw_center_text(const Font* font, const std::string& text,
- const Vector& position, int layer)
+ const Vector& position, int layer
, Color color
)
{
draw_text(font, text, Vector(position.x + SCREEN_WIDTH/2, position.y),
{
draw_text(font, text, Vector(position.x + SCREEN_WIDTH/2, position.y),
- ALIGN_CENTER, layer);
+ ALIGN_CENTER, layer
, color
);
}
void
}
void
@@
-325,14
+319,17
@@
DrawingContext::do_drawing()
lightmap->start_draw(ambient_color);
handle_drawing_requests(lightmap_requests);
lightmap->end_draw();
lightmap->start_draw(ambient_color);
handle_drawing_requests(lightmap_requests);
lightmap->end_draw();
+
+ DrawingRequest* request = new(obst) DrawingRequest();
+ request->target = NORMAL;
+ request->type = DRAW_LIGHTMAP;
+ request->layer = LAYER_HUD - 1;
+ drawing_requests.push_back(request);
}
lightmap_requests.clear();
handle_drawing_requests(drawing_requests);
drawing_requests.clear();
}
lightmap_requests.clear();
handle_drawing_requests(drawing_requests);
drawing_requests.clear();
- if(use_lightmap) {
- lightmap->do_draw();
- }
obstack_free(&obst, NULL);
obstack_init(&obst);
obstack_free(&obst, NULL);
obstack_init(&obst);
@@
-382,7
+379,7
@@
DrawingContext::handle_drawing_requests(DrawingRequests& requests)
{
const TextRequest* textrequest = (TextRequest*) request.request_data;
textrequest->font->draw(renderer, textrequest->text, request.pos,
{
const TextRequest* textrequest = (TextRequest*) request.request_data;
textrequest->font->draw(renderer, textrequest->text, request.pos,
- textrequest->alignment, request.drawing_effect, request.alpha);
+ textrequest->alignment, request.drawing_effect, request.
color, request.
alpha);
}
break;
case FILLRECT:
}
break;
case FILLRECT:
@@
-391,6
+388,9
@@
DrawingContext::handle_drawing_requests(DrawingRequests& requests)
case INVERSEELLIPSE:
renderer->draw_inverse_ellipse(request);
break;
case INVERSEELLIPSE:
renderer->draw_inverse_ellipse(request);
break;
+ case DRAW_LIGHTMAP:
+ lightmap->do_draw();
+ break;
case GETLIGHT:
lightmap->get_light(request);
break;
case GETLIGHT:
lightmap->get_light(request);
break;
@@
-411,7
+411,7
@@
DrawingContext::handle_drawing_requests(DrawingRequests& requests)
{
const TextRequest* textrequest = (TextRequest*) request.request_data;
textrequest->font->draw(renderer, textrequest->text, request.pos,
{
const TextRequest* textrequest = (TextRequest*) request.request_data;
textrequest->font->draw(renderer, textrequest->text, request.pos,
- textrequest->alignment, request.drawing_effect, request.alpha);
+ textrequest->alignment, request.drawing_effect, request.
color, request.
alpha);
}
break;
case FILLRECT:
}
break;
case FILLRECT:
@@
-420,6
+420,9
@@
DrawingContext::handle_drawing_requests(DrawingRequests& requests)
case INVERSEELLIPSE:
assert(!"InverseEllipse doesn't make sense on the lightmap");
break;
case INVERSEELLIPSE:
assert(!"InverseEllipse doesn't make sense on the lightmap");
break;
+ case DRAW_LIGHTMAP:
+ lightmap->do_draw();
+ break;
case GETLIGHT:
lightmap->get_light(request);
break;
case GETLIGHT:
lightmap->get_light(request);
break;