| 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 | #include "video/null/null_video_system.hpp" |
| 18 | |
| 19 | #include "supertux/gameconfig.hpp" |
| 20 | #include "supertux/globals.hpp" |
| 21 | #include "util/log.hpp" |
| 22 | #include "video/null/null_renderer.hpp" |
| 23 | #include "video/null/null_texture.hpp" |
| 24 | #include "video/sdl_surface_ptr.hpp" |
| 25 | #include "video/texture_manager.hpp" |
| 26 | |
| 27 | NullVideoSystem::NullVideoSystem() : |
| 28 | m_window_size(g_config->window_size), |
| 29 | m_vsync_mode(0), |
| 30 | m_viewport(Rect(0, 0, 1920, 1080), Vector(1.0f, 1.0f)), |
| 31 | m_screen_renderer(new NullRenderer), |
| 32 | m_lightmap_renderer(new NullRenderer), |
| 33 | m_texture_manager(new TextureManager) |
| 34 | { |
| 35 | } |
| 36 | |
| 37 | NullVideoSystem::~NullVideoSystem() |
| 38 | { |
| 39 | } |
| 40 | |
| 41 | Renderer* |
| 42 | NullVideoSystem::get_back_renderer() const |
| 43 | { |
| 44 | return nullptr; |
| 45 | } |
| 46 | |
| 47 | Renderer& |
| 48 | NullVideoSystem::get_renderer() const |
| 49 | { |
| 50 | return *m_screen_renderer; |
| 51 | } |
| 52 | |
| 53 | Renderer& |
| 54 | NullVideoSystem::get_lightmap() const |
| 55 | { |
| 56 | return *m_lightmap_renderer; |
| 57 | } |
| 58 | |
| 59 | TexturePtr |
| 60 | NullVideoSystem::new_texture(const SDL_Surface& image, const Sampler& sampler) |
| 61 | { |
| 62 | return TexturePtr(new NullTexture(Size(image.w, image.h))); |
| 63 | } |
| 64 | |
| 65 | const Viewport& |
| 66 | NullVideoSystem::get_viewport() const |
| 67 | { |
| 68 | return m_viewport; |
| 69 | } |
| 70 | |
| 71 | void |
| 72 | NullVideoSystem::apply_config() |
| 73 | { |
| 74 | } |
| 75 | |
| 76 | void |
| 77 | NullVideoSystem::flip() |
| 78 | { |
| 79 | log_info << "NullVideoSystem::flip()" << std::endl; |
| 80 | } |
| 81 | |
| 82 | void |
| 83 | NullVideoSystem::on_resize(int w, int h) |
| 84 | { |
| 85 | log_info << "NullVideoSystem::on_resize(" << w << ", " << h << ")" << std::endl; |
| 86 | m_window_size = Size(w, h); |
| 87 | } |
| 88 | |
| 89 | Size |
| 90 | NullVideoSystem::get_window_size() const |
| 91 | { |
| 92 | return m_window_size; |
| 93 | } |
| 94 | |
| 95 | void |
| 96 | NullVideoSystem::set_vsync(int mode) |
| 97 | { |
| 98 | log_info << "VideoSystem::set_vsync(" << mode << ")" << std::endl; |
| 99 | m_vsync_mode = mode; |
| 100 | } |
| 101 | |
| 102 | int |
| 103 | NullVideoSystem::get_vsync() const |
| 104 | { |
| 105 | return m_vsync_mode; |
| 106 | } |
| 107 | |
| 108 | void |
| 109 | NullVideoSystem::set_gamma(float gamma) |
| 110 | { |
| 111 | log_info << "VideoSystem::set_gamma(" << gamma << ")" << std::endl; |
| 112 | } |
| 113 | |
| 114 | void |
| 115 | NullVideoSystem::set_title(const std::string& title) |
| 116 | { |
| 117 | log_info << "VideoSystem::set_icon(\"" << title << "\")" << std::endl; |
| 118 | } |
| 119 | |
| 120 | void |
| 121 | NullVideoSystem::set_icon(const SDL_Surface& icon) |
| 122 | { |
| 123 | log_info << "VideoSystem::set_icon()" << std::endl; |
| 124 | } |
| 125 | |
| 126 | SDLSurfacePtr |
| 127 | NullVideoSystem::make_screenshot() |
| 128 | { |
| 129 | return {}; |
| 130 | } |
| 131 | |
| 132 | /* EOF */ |
| 133 | |