Update of /cvsroot/super-tux/supertux/lib/video
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2023/lib/video
Modified Files:
drawing_context.cpp drawing_context.h
Log Message:
Added a function to draw text on center of screen for comodity.
Index: drawing_context.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/lib/video/drawing_context.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- drawing_context.cpp 24 Sep 2004 18:00:39 -0000 1.8
+++ drawing_context.cpp 24 Sep 2004 18:13:27 -0000 1.9
@@ -104,6 +104,14 @@
}
void
+DrawingContext::draw_center_text(Font* font, const std::string& text,
+ const Vector& position, int layer, Uint32 drawing_effect)
+{
+draw_text(font, text, Vector(position.x + screen->w/2, position.y),
+ CENTER_ALLIGN, layer, drawing_effect);
+}
+
+void
DrawingContext::draw_gradient(Color top, Color bottom, int layer)
{
DrawingRequest request;
Index: drawing_context.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/lib/video/drawing_context.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- drawing_context.h 24 Sep 2004 18:00:46 -0000 1.9
+++ drawing_context.h 24 Sep 2004 18:13:27 -0000 1.10
@@ -69,6 +69,13 @@
void draw_text(Font* font, const std::string& text, const Vector& position,
int allignment, int layer,
Uint32 drawing_effect = NONE_EFFECT);
+
+ /// Draws text on screen center (feed Vector.x with a 0).
+ /// This is the same as draw_text() with a screen->w/2 position and
+ /// allignment set to LEFT_ALLIGN
+ void draw_center_text(Font* font, const std::string& text,
+ 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.
|