X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=lib%2Fvideo%2Fdrawing_context.h;h=6c7e7749d48d66a61094667621ef1a967a9f8d81;hb=c6c8b57b862c835acfcfa0ae6856fe7c2e5204fb;hp=be8cdfdbacde1ec13e6ebb0102a64137659f2efa;hpb=07a60074d2369ec9f49754f15277f5242482df84;p=supertux.git diff --git a/lib/video/drawing_context.h b/lib/video/drawing_context.h index be8cdfdba..6c7e7749d 100644 --- a/lib/video/drawing_context.h +++ b/lib/video/drawing_context.h @@ -68,7 +68,14 @@ namespace SuperTux /// Draws a text. void draw_text(Font* font, const std::string& text, const Vector& position, int allignment, int layer, - Uint32 drawing_effect = NONE_EFFECT, int alpha = 255); + 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. @@ -79,19 +86,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 @@ -104,7 +114,9 @@ namespace SuperTux return v - translation; } - int draw_effect; + Uint32 draw_effect; + float zoom; + int alpha; }; /// the transform stack @@ -128,7 +140,6 @@ namespace SuperTux Font* font; std::string text; int allignment; - int alpha; }; struct GradientRequest @@ -147,6 +158,8 @@ namespace SuperTux { int layer; Uint32 drawing_effect; + float zoom; + int alpha; RequestType type; Vector pos;