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 return new GL::Renderer();
43 return new SDL::Renderer();
47 return new GL::Renderer();
50 return new SDL::Renderer();
52 assert(0 && "invalid video system in config");
54 return new GL::Renderer();
56 return new SDL::Renderer();
61 Lightmap *new_lightmap()
67 return new GL::Lightmap();
69 return new SDL::Lightmap();
73 return new GL::Lightmap();
76 return new SDL::Lightmap();
78 assert(0 && "invalid video system in config");
80 return new GL::Lightmap();
82 return new SDL::Lightmap();
87 Texture *new_texture(SDL_Surface *image)
93 return new GL::Texture(image);
95 return new SDL::Texture(image);
99 return new GL::Texture(image);
102 return new SDL::Texture(image);
104 assert(0 && "invalid video system in config");
106 return new GL::Texture(image);
108 return new SDL::Texture(image);
113 void *new_surface_data(const Surface &surface)
115 switch(config->video)
119 return new GL::SurfaceData(surface);
121 return new SDL::SurfaceData(surface);
125 return new GL::SurfaceData(surface);
128 return new SDL::SurfaceData(surface);
130 assert(0 && "invalid video system in config");
132 return new GL::SurfaceData(surface);
134 return new SDL::SurfaceData(surface);
139 void free_surface_data(void *surface_data)
141 delete reinterpret_cast<char *>(surface_data);
144 VideoSystem get_video_system(const std::string &video)
151 else if(video == "opengl")
156 else if(video == "sdl")
166 std::string get_video_string(VideoSystem video)
177 assert(0 && "invalid video system in config");