2 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
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.
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.
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/>.
19 #include "supertux/gameconfig.hpp"
20 #include "video/gl/gl_lightmap.hpp"
21 #include "video/gl/gl_renderer.hpp"
22 #include "video/gl/gl_surface_data.hpp"
23 #include "video/gl/gl_texture.hpp"
24 #include "video/lightmap.hpp"
25 #include "video/renderer.hpp"
26 #include "video/sdl/sdl_lightmap.hpp"
27 #include "video/sdl/sdl_renderer.hpp"
28 #include "video/sdl/sdl_surface_data.hpp"
29 #include "video/sdl/sdl_texture.hpp"
30 #include "video/texture.hpp"
31 #include "video/video_systems.hpp"
33 Renderer *new_renderer()
35 switch(g_config->video)
39 log_info << "new GL renderer\n";
40 return new GLRenderer();
42 log_warning << "new SDL renderer\n";
43 return new SDLRenderer();
47 log_info << "new GL renderer\n";
48 return new GLRenderer();
51 log_warning << "new SDL renderer\n";
52 return new SDLRenderer();
54 assert(0 && "invalid video system in config");
56 log_info << "new GL renderer\n";
57 return new GLRenderer();
59 log_warning << "new SDL renderer\n";
60 return new SDLRenderer();
65 Lightmap *new_lightmap()
67 switch(g_config->video)
71 return new GLLightmap();
73 return new SDLLightmap();
77 return new GLLightmap();
80 return new SDLLightmap();
82 assert(0 && "invalid video system in config");
84 return new GLLightmap();
86 return new SDLLightmap();
91 Texture *new_texture(SDL_Surface *image)
93 switch(g_config->video)
97 return new GLTexture(image);
99 return new SDLTexture(image);
103 return new GLTexture(image);
106 return new SDLTexture(image);
108 assert(0 && "invalid video system in config");
110 return new GLTexture(image);
112 return new SDLTexture(image);
117 void *new_surface_data(const Surface &surface)
119 switch(g_config->video)
123 return new GLSurfaceData(surface);
125 return new SDLSurfaceData(surface);
129 return new GLSurfaceData(surface);
132 return new SDLSurfaceData(surface);
134 assert(0 && "invalid video system in config");
136 return new GLSurfaceData(surface);
138 return new SDLSurfaceData(surface);
143 void free_surface_data(void *surface_data)
145 delete reinterpret_cast<char *>(surface_data);
148 VideoSystem get_video_system(const std::string &video)
155 else if(video == "opengl")
160 else if(video == "sdl")
170 std::string get_video_string(VideoSystem video)
181 assert(0 && "invalid video system in config");