New Norwegian Translation
[supertux.git] / lib / video / drawing_context.h
index 4674234..7ef8de9 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
   {
@@ -67,10 +67,15 @@ 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 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.
@@ -81,33 +86,41 @@ namespace SuperTux
       void do_drawing();
 
       const Vector& get_translation() const
-        {
-          return transform.translation;
-        }
+      {  return transform.translation;  }
+      Uint32 get_drawing_effect() const
+      {  return transform.drawing_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
-        {
-        public:
-          Vector translation; // only translation for now...
+      {
+      public:
+        Vector translation;
+        Uint32 drawing_effect;
+        float zoom;
+        int alpha;
 
-          Vector apply(const Vector& v) const
-            {
-              return v - translation;
-            }
+        Transform()
+          : drawing_effect(NONE_EFFECT), zoom(1), alpha(255)
+        { }
 
-          int draw_effect;
-        };
+        Vector apply(const Vector& v) const
+        {
+          return v - translation;
+        }
+      };
 
       /// the transform stack
       std::vector<Transform> transformstack;
@@ -129,6 +142,7 @@ namespace SuperTux
         {
           Font* font;
           std::string text;
+          int allignment;
         };
 
       struct GradientRequest
@@ -145,11 +159,13 @@ namespace SuperTux
 
       struct DrawingRequest
         {
+          RequestType type;
+          Vector pos;                
+          
           int layer;
           Uint32 drawing_effect;
-
-          RequestType type;
-          Vector pos;
+          float zoom;
+          int alpha;
 
           void* request_data;
 
@@ -161,6 +177,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);