17 #ifndef HEADER_SUPERTUX_VIDEO_DRAWING_CONTEXT_HPP 18 #define HEADER_SUPERTUX_VIDEO_DRAWING_CONTEXT_HPP 25 #include "math/rect.hpp" 26 #include "math/rectf.hpp" 27 #include "math/vector.hpp" 28 #include "video/canvas.hpp" 29 #include "video/color.hpp" 30 #include "video/drawing_context.hpp" 31 #include "video/drawing_transform.hpp" 32 #include "video/font.hpp" 33 #include "video/font_ptr.hpp" 51 Canvas& color() {
return m_colormap_canvas; }
52 Canvas& light() { assert(!m_overlay);
return m_lightmap_canvas; }
53 Canvas& get_canvas(DrawingTarget target) {
56 case DrawingTarget::LIGHTMAP:
64 void set_ambient_color(
Color ambient_color);
65 Color get_ambient_color()
const {
return m_ambient_color; }
67 void push_transform();
72 const Vector& get_translation()
const 73 {
return transform().translation; }
75 void set_translation(
const Vector& newtranslation)
76 { transform().translation = newtranslation; }
78 float get_scale()
const {
return transform().scale; }
79 void scale(
float scale) { transform().scale *= scale; }
86 Flip get_flip()
const;
90 float get_alpha()
const;
94 float get_time_offset()
const {
return m_time_offset; }
98 m_lightmap_canvas.clear();
99 m_colormap_canvas.clear();
102 void set_viewport(
const Rect& viewport)
104 transform().viewport = viewport;
107 const Rect& get_viewport()
const;
109 float get_width()
const;
110 float get_height()
const;
111 Vector get_size()
const;
112 Rectf get_rect()
const {
return Rectf(Vector(0, 0), get_size()); }
114 bool use_lightmap()
const 116 return !m_overlay && m_ambient_color != Color::WHITE;
119 bool is_overlay()
const {
return m_overlay; }
132 Color m_ambient_color;
133 std::vector<DrawingTransform> m_transform_stack;
Definition: obstack.h:151
Definition: drawing_request.hpp:39
bool perspective_scale(float speed_x, float speed_y)
Recalculates the scaling factor for parallax layers.
Definition: drawing_context.cpp:137
void set_time_offset(float time_offset)
For position extrapolation at high frame rates: real time since last game update step.
Definition: drawing_context.hpp:93
void set_alpha(float alpha)
apply that alpha in the next draws (1.0 means fully opaque)
Definition: drawing_context.cpp:74
Definition: video_system.hpp:37
void set_flip(Flip flip)
Apply that flip in the next draws (flips are listed on surface.h).
Definition: drawing_context.cpp:62
Rectf get_cliprect() const
Returns the visible area in world coordinates.
Definition: drawing_context.cpp:53
Definition: canvas.hpp:43
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42