Added an alpha argument for drawing fonts.
[supertux.git] / lib / video / drawing_context.h
index b200e7b..c52e40f 100644 (file)
@@ -24,9 +24,9 @@
 
 #include "SDL.h"
 
-#include "math/vector.h"
-#include "video/screen.h"
-#include "video/surface.h"
+#include "../math/vector.h"
+#include "../video/screen.h"
+#include "../video/surface.h"
 
 namespace SuperTux
   {
@@ -47,6 +47,7 @@ namespace SuperTux
     LAYER_GUI         = 500
   };
 
+  /// Handles drawing of things.
   /**
    * This class provides functions for drawing things on screen. It also
    * maintains a stack of transforms that are applied to graphics.
@@ -57,26 +58,26 @@ namespace SuperTux
       DrawingContext();
       ~DrawingContext();
 
-      /** Adds a drawing request for a surface into the request list */
+      /// Adds a drawing request for a surface into the request list.
       void draw_surface(const Surface* surface, const Vector& position, int layer,
                         Uint32 drawing_effect = NONE_EFFECT);
-      /** Adds a drawing request for part of a surface */
+      /// Adds a drawing request for part of a surface.
       void draw_surface_part(const Surface* surface, const Vector& source,
                              const Vector& size, const Vector& dest, int layer,
                              Uint32 drawing_effect = NONE_EFFECT);
-      /** draws a text */
+      /// Draws a text.
       void draw_text(Font* font, const std::string& text, const Vector& position,
-                     int layer, Uint32 drawing_effect = NONE_EFFECT);
-      /** draws aligned text */
+                     int layer, Uint32 drawing_effect = NONE_EFFECT, int alpha = 255);
+      /// Draws aligned text.
       void draw_text_center(Font* font, const std::string& text,
-                            const Vector& position, int layer, Uint32 drawing_effect = NONE_EFFECT);
-      /** draws a color gradient onto the whole screen */
+                            const Vector& position, int layer, Uint32 drawing_effect = NONE_EFFECT, int alpha = 255);
+      /// Draws a color gradient onto the whole screen */
       void draw_gradient(Color from, Color to, int layer);
-      /** fills a rectangle */
+      /// Fills a rectangle.
       void draw_filled_rect(const Vector& topleft, const Vector& size,
                             Color color, int layer);
 
-      /** Processes all pending drawing requests and flushes the list */
+      /// Processes all pending drawing requests and flushes the list.
       void do_drawing();
 
       const Vector& get_translation() const
@@ -91,7 +92,7 @@ namespace SuperTux
       void push_transform();
       void pop_transform();
 
-      /** apply that effect in the next draws (effects are listed on surface.h) */
+      /// Apply that effect in the next draws (effects are listed on surface.h).
       void set_drawing_effect(int effect);
 
     private:
@@ -128,6 +129,8 @@ namespace SuperTux
         {
           Font* font;
           std::string text;
+          bool center;
+          int alpha;
         };
 
       struct GradientRequest
@@ -160,6 +163,7 @@ namespace SuperTux
 
       void draw_surface_part(DrawingRequest& request);
       void draw_text(DrawingRequest& request);
+      void draw_text_center(DrawingRequest& request);
       void draw_gradient(DrawingRequest& request);
       void draw_filled_rect(DrawingRequest& request);