[Super-tux-commit] supertux/src/screen drawing_context.cpp,1.12,1.13 drawing_context.h,1.10,1.11 fon
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-06-29 13:01:23
|
Update of /cvsroot/super-tux/supertux/src/screen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11052/src/screen Modified Files: drawing_context.cpp drawing_context.h font.cpp font.h Log Message: Changes: - Font now supports drawing effect; - Level saving now works. Still has flaws: o Spawn points are not saved; o Tilemaps do not know differ foreground/background. Matze, Can you have a look at this? - Other minor stuff. Index: font.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/font.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- font.cpp 9 Jun 2004 04:43:15 -0000 1.4 +++ font.cpp 29 Jun 2004 13:00:40 -0000 1.5 @@ -81,16 +81,18 @@ } void -Font::draw(const std::string& text, const Vector& pos) +Font::draw(const std::string& text, const Vector& pos, Uint32 drawing_effect) { if(shadowsize > 0) - draw_chars(shadow_chars, text, pos + Vector(shadowsize, shadowsize)); + draw_chars(shadow_chars, text, pos + Vector(shadowsize, shadowsize), + drawing_effect); - draw_chars(chars, text, pos); + draw_chars(chars, text, pos, drawing_effect); } void -Font::draw_chars(Surface* pchars, const std::string& text, const Vector& pos) +Font::draw_chars(Surface* pchars, const std::string& text, const Vector& pos, + Uint32 drawing_effect) { SurfaceImpl* impl = pchars->impl; @@ -115,7 +117,7 @@ int source_x = (index % 16) * w; int source_y = (index / 16) * h; - impl->draw_part(source_x, source_y, p.x, p.y, w, h, 255); + impl->draw_part(source_x, source_y, p.x, p.y, w, h, 255, drawing_effect); p.x += w; } } Index: drawing_context.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/drawing_context.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- drawing_context.cpp 28 Jun 2004 11:30:25 -0000 1.12 +++ drawing_context.cpp 29 Jun 2004 13:00:39 -0000 1.13 @@ -76,13 +76,14 @@ void DrawingContext::draw_text(Font* font, const std::string& text, - const Vector& position, int layer) + const Vector& position, int layer, Uint32 drawing_effect) { DrawingRequest request; request.type = TEXT; request.layer = layer; request.pos = transform.apply(position); + request.drawing_effect = drawing_effect; TextRequest* textrequest = new TextRequest; textrequest->font = font; @@ -94,7 +95,7 @@ void DrawingContext::draw_text_center(Font* font, const std::string& text, - const Vector& position, int layer) + const Vector& position, int layer, Uint32 drawing_effect) { DrawingRequest request; @@ -102,6 +103,7 @@ request.layer = layer; request.pos = transform.apply(position) + Vector(screen->w/2 - font->get_text_width(text)/2, 0); + request.drawing_effect = drawing_effect; TextRequest* textrequest = new TextRequest; textrequest->font = font; @@ -212,7 +214,7 @@ { TextRequest* textrequest = (TextRequest*) request.request_data; - textrequest->font->draw(textrequest->text, request.pos); + textrequest->font->draw(textrequest->text, request.pos, request.drawing_effect); delete textrequest; } @@ -226,6 +228,7 @@ float y = request.pos.y; float w = fillrectrequest->size.x; float h = fillrectrequest->size.y; + #ifndef NOOPENGL if(use_gl) { Index: drawing_context.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/drawing_context.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- drawing_context.h 28 Jun 2004 11:30:26 -0000 1.10 +++ drawing_context.h 29 Jun 2004 13:00:40 -0000 1.11 @@ -62,10 +62,10 @@ Uint32 drawing_effect = NONE_EFFECT); /** draws a text */ void draw_text(Font* font, const std::string& text, const Vector& position, - int layer); + int layer, Uint32 drawing_effect = NONE_EFFECT); /** draws aligned text */ void draw_text_center(Font* font, const std::string& text, - const Vector& position, int layer); + const Vector& position, int layer, Uint32 drawing_effect = NONE_EFFECT); /** draws a color gradient onto the whole screen */ void draw_gradient(Color from, Color to, int layer); /** fills a rectangle */ Index: font.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/font.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- font.h 14 Jun 2004 22:45:24 -0000 1.4 +++ font.h 29 Jun 2004 13:00:40 -0000 1.5 @@ -53,9 +53,10 @@ private: friend class DrawingContext; - void draw(const std::string& text, const Vector& pos); + void draw(const std::string& text, const Vector& pos, + Uint32 drawing_effect = NONE_EFFECT); void draw_chars(Surface* pchars, const std::string& text, - const Vector& position); + const Vector& position, Uint32 drawing_effect); Surface* chars; Surface* shadow_chars; |