supertux
compositor.hpp
1 // SuperTux
2 // Copyright (C) 2018 Ingo Ruhnke <grumbel@gmail.com>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef HEADER_SUPERTUX_VIDEO_COMPOSITOR_HPP
18 #define HEADER_SUPERTUX_VIDEO_COMPOSITOR_HPP
19 
20 #include <vector>
21 #include <memory>
22 
23 #include "util/obstackpp.hpp"
24 
25 class DrawingContext;
26 class Rect;
27 class VideoSystem;
28 
29 class Compositor final
30 {
31 public:
33  static bool s_render_lighting;
34 
35 public:
36  Compositor(VideoSystem& video_system, float time_offset);
37  ~Compositor();
38 
39  void render();
40 
45  DrawingContext& make_context(bool overlay = false);
46 
47 private:
48  VideoSystem& m_video_system;
49 
50  /* obstack holding the memory of the drawing requests */
51  obstack m_obst;
52 
53  std::vector<std::unique_ptr<DrawingContext> > m_drawing_contexts;
54 
55  float m_time_offset;
56 
57 private:
58  Compositor(const Compositor&) = delete;
59  Compositor& operator=(const Compositor&) = delete;
60 };
61 
62 #endif
63 
64 /* EOF */
Definition: obstack.h:151
DrawingContext & make_context(bool overlay=false)
Create a DrawingContext, if overlay is true the context will not feature light rendering.
Definition: compositor.cpp:45
Definition: rect.hpp:30
static bool s_render_lighting
Debug flag to disable lighting, used in the editor.
Definition: compositor.hpp:33
Definition: compositor.hpp:29
Definition: video_system.hpp:37
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42