argh, clean out copy
[supertux.git] / src / unison / src / video / sdl / Renderer.hpp
1 //          Copyright Timothy Goya 2007.
2 // Distributed under the Boost Software License, Version 1.0.
3 //    (See accompanying file LICENSE_1_0.txt or copy at
4 //          http://www.boost.org/LICENSE_1_0.txt)
5
6 #ifndef UNISON_VIDEO_SDL_RENDERER_HPP
7 #define UNISON_VIDEO_SDL_RENDERER_HPP
8
9 #include <unison/video/backend/Renderer.hpp>
10
11 #include <string> 
12 #include "SDL.h"
13
14 namespace Unison
15 {
16    namespace Video
17    {
18       namespace Backend
19       {
20          class Texture;
21          class Window;
22       }
23       namespace SDL
24       {
25          /// Does rendering tasks like blits and color fills using SDL
26          class Renderer : public Backend::Renderer
27          {
28             public:
29                /// Default constructor
30                Renderer();
31
32                /// Destructor
33                ~Renderer();
34
35                /// Initialize the backend
36                void init();
37
38                /// Cleanup the backend
39                void quit();
40
41                /// Get the name of the renderer
42                /// \return the name of the renderer
43                std::string get_name();
44
45                /// Check if the backend is usable
46                /// \return Whether the backend is usable
47                bool is_usable();
48
49                Surface load_surface(const std::string &filename);
50                Surface load_surface(const std::string &filename, const Color &colorkey);
51                void save_surface(const Surface &surface, const std::string &filename);
52
53                /// Does a surface-to-surface blit
54                /// \param[in] src The source surface
55                /// \param[in] src_rect The part of the source surface to blit from
56                /// \param[in] dst The destination surface
57                /// \param[in] dst_pos The position to blit to
58                /// \param[in] options Extra blit options
59                void blit(const Surface &src, const Rect &src_rect, Surface &dst, const Point &dst_pos, const RenderOptions &options);
60
61                /// Does a texture-to-surface blit
62                /// \param[in] src The source texture
63                /// \param[in] src_rect The part of the source texture to blit from
64                /// \param[in] dst The destination surface
65                /// \param[in] dst_pos The position to blit to
66                /// \param[in] options Extra blit options
67                void blit(Backend::Texture *src, const Rect &src_rect, Surface &dst, const Point &dst_pos, const RenderOptions &options);
68
69                /// Fills a portion of a surface with the given color
70                /// \param[in] dst The destination surface
71                /// \param[in] color The color
72                /// \param[in] rect The portion to fill
73                void fill(Surface &dst, const Color &color, const Rect &rect);
74
75                /// Fills with alpha blend a portion of a surface with the given color
76                /// \param[in] dst The destination surface
77                /// \param[in] color The color
78                /// \param[in] rect The portion to fill
79                void fill_blend(Surface &dst, const Color &color, const Rect &rect);
80
81                /// Create a window
82                /// \param[in] size The size of the window
83                /// \param[in] logical_size The logical size of the window
84                /// \param[in] fullscreen Whether to open in fullscreen mode
85                /// \return The created window
86                Backend::Window *create_window(const Area &size, const Area &logical_size, bool fullscreen);
87
88                /// Create a texture data for the given surface
89                /// \param[in] surface The surface to convert
90                /// \return The texture data for the surface
91                Backend::Texture *create_texture(const Surface &surface);
92          };
93       }
94    }
95 }
96
97 #endif