Added an alpha parameter for transformation and got rid of ugly alpha draw_font(...
[supertux.git] / lib / video / drawing_context.h
index 4674234..2d7b1ad 100644 (file)
@@ -67,10 +67,8 @@ namespace SuperTux
                              Uint32 drawing_effect = NONE_EFFECT);
       /// 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.
-      void draw_text_center(Font* font, const std::string& text,
-                            const Vector& position, int layer, Uint32 drawing_effect = NONE_EFFECT);
+                     int allignment, 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.
@@ -81,19 +79,22 @@ namespace SuperTux
       void do_drawing();
 
       const Vector& get_translation() const
-        {
-          return transform.translation;
-        }
+        {  return transform.translation;  }
+      Uint32 get_drawing_effect() const
+        {  return transform.draw_effect;  }
+
       void set_translation(const Vector& newtranslation)
-      {
-        transform.translation = newtranslation;
-      }
+        {  transform.translation = newtranslation;  }
 
       void push_transform();
       void pop_transform();
 
       /// Apply that effect in the next draws (effects are listed on surface.h).
       void set_drawing_effect(int effect);
+      /// apply that zoom in the next draws */
+      void set_zooming(float zoom);
+      /// apply that alpha in the next draws */
+      void set_alpha(int alpha);
 
     private:
       class Transform
@@ -106,7 +107,9 @@ namespace SuperTux
               return v - translation;
             }
 
-          int draw_effect;
+          Uint32 draw_effect;
+          float zoom;
+          int alpha;
         };
 
       /// the transform stack
@@ -129,6 +132,7 @@ namespace SuperTux
         {
           Font* font;
           std::string text;
+          int allignment;
         };
 
       struct GradientRequest
@@ -147,6 +151,8 @@ namespace SuperTux
         {
           int layer;
           Uint32 drawing_effect;
+          float zoom;
+          int alpha;
 
           RequestType type;
           Vector pos;
@@ -161,6 +167,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);