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_NULL_NULL_VIDEO_SYSTEM_HPP |
18 | #define HEADER_SUPERTUX_VIDEO_NULL_NULL_VIDEO_SYSTEM_HPP |
19 | |
20 | #include "video/viewport.hpp" |
21 | #include "video/video_system.hpp" |
22 | |
23 | class TextureManager; |
24 | class NullRenderer; |
25 | |
26 | /** A video system that doesn't produce any output and doesn't open a |
27 | window. Useful for debugging, testing and automation. */ |
28 | class NullVideoSystem : public VideoSystem |
29 | { |
30 | public: |
31 | NullVideoSystem(); |
32 | virtual ~NullVideoSystem(); |
33 | |
34 | virtual std::string get_name() const override { return "Null"; } |
35 | |
36 | virtual Renderer* get_back_renderer() const override; |
37 | virtual Renderer& get_renderer() const override; |
38 | virtual Renderer& get_lightmap() const override; |
39 | |
40 | virtual TexturePtr new_texture(const SDL_Surface& image, const Sampler& sampler) override; |
41 | |
42 | virtual const Viewport& get_viewport() const override; |
43 | virtual void apply_config() override; |
44 | virtual void flip() override; |
45 | virtual void on_resize(int w, int h) override; |
46 | virtual Size get_window_size() const override; |
47 | |
48 | virtual void set_vsync(int mode) override; |
49 | virtual int get_vsync() const override; |
50 | virtual void set_gamma(float gamma) override; |
51 | virtual void set_title(const std::string& title) override; |
52 | virtual void set_icon(const SDL_Surface& icon) override; |
53 | virtual SDLSurfacePtr make_screenshot() override; |
54 | |
55 | private: |
56 | Size m_window_size; |
57 | int m_vsync_mode; |
58 | Viewport m_viewport; |
59 | std::unique_ptr<NullRenderer> m_screen_renderer; |
60 | std::unique_ptr<NullRenderer> m_lightmap_renderer; |
61 | std::unique_ptr<TextureManager> m_texture_manager; |
62 | |
63 | private: |
64 | NullVideoSystem(const NullVideoSystem&) = delete; |
65 | NullVideoSystem& operator=(const NullVideoSystem&) = delete; |
66 | }; |
67 | |
68 | #endif |
69 | |
70 | /* EOF */ |
71 |