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/>.
17 #include "video/video_system.hpp"
21 #include "util/log.hpp"
22 #include "video/sdl/sdl_video_system.hpp"
25 #include "video/gl/gl_video_system.hpp"
28 std::unique_ptr<VideoSystem>
29 VideoSystem::create(VideoSystem::Enum video_system)
37 return std::unique_ptr<VideoSystem>(new GLVideoSystem);
39 catch(std::exception& err)
41 log_warning << "Error creating GLVideoSystem, using SDL fallback: " << err.what() << std::endl;
42 return std::unique_ptr<VideoSystem>(new SDLVideoSystem);
45 log_info << "new SDL renderer\n";
46 return std::unique_ptr<VideoSystem>(new SDLVideoSystem);
51 return std::unique_ptr<VideoSystem>(new GLVideoSystem);
53 log_warning << "OpenGL requested, but missing using SDL fallback" << std::endl;
54 return std::unique_ptr<VideoSystem>(new SDLVideoSystem);
58 log_info << "new SDL renderer\n";
59 return std::unique_ptr<VideoSystem>(new SDLVideoSystem);
62 assert(!"invalid video system in config");
68 VideoSystem::get_video_system(const std::string &video)
75 else if(video == "opengl")
80 else if(video == "sdl")
91 VideoSystem::get_video_string(VideoSystem::Enum video)
102 assert(!"invalid video system in config");