1 | // SuperTux |
---|---|
2 | // Copyright (C) 2006 Matthias Braun <matze@braunis.de> |
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_SDL_SDL_SCREEN_RENDERER_HPP |
18 | #define HEADER_SUPERTUX_VIDEO_SDL_SDL_SCREEN_RENDERER_HPP |
19 | |
20 | #include <SDL.h> |
21 | #include <boost/optional.hpp> |
22 | |
23 | #include "math/size.hpp" |
24 | #include "video/renderer.hpp" |
25 | #include "video/sdl/sdl_painter.hpp" |
26 | |
27 | class SDLVideoSystem; |
28 | |
29 | class SDLScreenRenderer final : public Renderer |
30 | { |
31 | public: |
32 | SDLScreenRenderer(SDLVideoSystem& video_system, SDL_Renderer* renderer); |
33 | ~SDLScreenRenderer(); |
34 | |
35 | virtual void start_draw() override; |
36 | virtual void end_draw() override; |
37 | |
38 | virtual SDLPainter& get_painter() override { return m_painter; } |
39 | |
40 | virtual Rect get_rect() const override; |
41 | virtual Size get_logical_size() const override; |
42 | |
43 | virtual TexturePtr get_texture() const override { return {}; } |
44 | |
45 | void flip(); |
46 | SDL_Renderer* get_sdl_renderer() const { return m_renderer; } |
47 | |
48 | private: |
49 | SDLVideoSystem& m_video_system; |
50 | SDL_Renderer* m_renderer; |
51 | SDLPainter m_painter; |
52 | |
53 | private: |
54 | SDLScreenRenderer(const SDLScreenRenderer&) = delete; |
55 | SDLScreenRenderer& operator=(const SDLScreenRenderer&) = delete; |
56 | }; |
57 | |
58 | #endif |
59 | |
60 | /* EOF */ |
61 |