1 // $Id: video_systems.cpp 5063 2007-05-27 11:32:00Z matzeb $
4 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #include "video_systems.hpp"
22 #include "gameconfig.hpp"
23 #include "renderer.hpp"
24 #include "gl_renderer.hpp"
25 #include "sdl_renderer.hpp"
26 #include "lightmap.hpp"
27 #include "gl_lightmap.hpp"
28 #include "sdl_lightmap.hpp"
29 #include "texture.hpp"
30 #include "gl_texture.hpp"
31 #include "sdl_texture.hpp"
32 #include "gl_surface_data.hpp"
33 #include "sdl_surface_data.hpp"
35 Renderer *new_renderer()
41 log_info << "new GL renderer\n";
42 return new GL::Renderer();
44 log_warning << "new SDL renderer\n";
45 return new SDL::Renderer();
49 log_info << "new GL renderer\n";
50 return new GL::Renderer();
53 log_warning << "new SDL renderer\n";
54 return new SDL::Renderer();
56 assert(0 && "invalid video system in config");
58 log_info << "new GL renderer\n";
59 return new GL::Renderer();
61 log_warning << "new SDL renderer\n";
62 return new SDL::Renderer();
67 Lightmap *new_lightmap()
73 return new GL::Lightmap();
75 return new SDL::Lightmap();
79 return new GL::Lightmap();
82 return new SDL::Lightmap();
84 assert(0 && "invalid video system in config");
86 return new GL::Lightmap();
88 return new SDL::Lightmap();
93 Texture *new_texture(SDL_Surface *image)
99 return new GL::Texture(image);
101 return new SDL::Texture(image);
105 return new GL::Texture(image);
108 return new SDL::Texture(image);
110 assert(0 && "invalid video system in config");
112 return new GL::Texture(image);
114 return new SDL::Texture(image);
119 void *new_surface_data(const Surface &surface)
121 switch(config->video)
125 return new GL::SurfaceData(surface);
127 return new SDL::SurfaceData(surface);
131 return new GL::SurfaceData(surface);
134 return new SDL::SurfaceData(surface);
136 assert(0 && "invalid video system in config");
138 return new GL::SurfaceData(surface);
140 return new SDL::SurfaceData(surface);
145 void free_surface_data(void *surface_data)
147 delete reinterpret_cast<char *>(surface_data);
150 VideoSystem get_video_system(const std::string &video)
157 else if(video == "opengl")
162 else if(video == "sdl")
172 std::string get_video_string(VideoSystem video)
183 assert(0 && "invalid video system in config");