#include <video_systems.hpp>
Public Types | |
enum | Enum { AUTO_VIDEO, OPENGL, PURE_SDL, NUM_SYSTEMS } |
Static Public Member Functions | |
static Renderer * | new_renderer () |
static Lightmap * | new_lightmap () |
static TexturePtr | new_texture (SDL_Surface *image) |
static SurfaceData * | new_surface_data (const Surface &surface) |
static void | free_surface_data (SurfaceData *surface_data) |
static Enum | get_video_system (const std::string &video) |
static std::string | get_video_string (Enum video) |
Private Member Functions | |
VideoSystem () | |
VideoSystem (const VideoSystem &) | |
VideoSystem & | operator= (const VideoSystem &) |
Definition at line 32 of file video_systems.hpp.
enum VideoSystem::Enum |
Definition at line 35 of file video_systems.hpp.
00035 { 00036 AUTO_VIDEO, 00037 OPENGL, 00038 PURE_SDL, 00039 NUM_SYSTEMS 00040 };
VideoSystem::VideoSystem | ( | ) | [private] |
VideoSystem::VideoSystem | ( | const VideoSystem & | ) | [private] |
Renderer * VideoSystem::new_renderer | ( | ) | [static] |
Definition at line 37 of file video_systems.cpp.
References AUTO_VIDEO, g_config, log_info, log_warning, OPENGL, PURE_SDL, and Config::video.
Referenced by DrawingContext::init_renderer().
00038 { 00039 switch(g_config->video) 00040 { 00041 case AUTO_VIDEO: 00042 #ifdef HAVE_OPENGL 00043 try { 00044 log_info << "new GL renderer\n"; 00045 return new GLRenderer(); 00046 } catch(std::runtime_error& e) { 00047 log_warning << "Error creating GL renderer: " << e.what() << std::endl; 00048 #endif 00049 log_warning << "new SDL renderer\n"; 00050 return new SDLRenderer(); 00051 #ifdef HAVE_OPENGL 00052 } 00053 case OPENGL: 00054 log_info << "new GL renderer\n"; 00055 return new GLRenderer(); 00056 #endif 00057 case PURE_SDL: 00058 log_info << "new SDL renderer\n"; 00059 return new SDLRenderer(); 00060 default: 00061 assert(0 && "invalid video system in config"); 00062 #ifdef HAVE_OPENGL 00063 log_info << "new GL renderer\n"; 00064 return new GLRenderer(); 00065 #else 00066 log_warning << "new SDL renderer\n"; 00067 return new SDLRenderer(); 00068 #endif 00069 } 00070 }
Lightmap * VideoSystem::new_lightmap | ( | ) | [static] |
Definition at line 73 of file video_systems.cpp.
References AUTO_VIDEO, g_config, OPENGL, PURE_SDL, and Config::video.
Referenced by DrawingContext::init_renderer().
00074 { 00075 switch(g_config->video) 00076 { 00077 case AUTO_VIDEO: 00078 #ifdef HAVE_OPENGL 00079 return new GLLightmap(); 00080 #else 00081 return new SDLLightmap(); 00082 #endif 00083 #ifdef HAVE_OPENGL 00084 case OPENGL: 00085 return new GLLightmap(); 00086 #endif 00087 case PURE_SDL: 00088 return new SDLLightmap(); 00089 default: 00090 assert(0 && "invalid video system in config"); 00091 #ifdef HAVE_OPENGL 00092 return new GLLightmap(); 00093 #else 00094 return new SDLLightmap(); 00095 #endif 00096 } 00097 }
TexturePtr VideoSystem::new_texture | ( | SDL_Surface * | image | ) | [static] |
Definition at line 100 of file video_systems.cpp.
References AUTO_VIDEO, g_config, OPENGL, PURE_SDL, and Config::video.
Referenced by TextureManager::create_dummy_texture(), and TextureManager::create_image_texture_raw().
00101 { 00102 switch(g_config->video) 00103 { 00104 case AUTO_VIDEO: 00105 #ifdef HAVE_OPENGL 00106 return TexturePtr(new GLTexture(image)); 00107 #else 00108 return TexturePtr(new SDLTexture(image)); 00109 #endif 00110 #ifdef HAVE_OPENGL 00111 case OPENGL: 00112 return TexturePtr(new GLTexture(image)); 00113 #endif 00114 case PURE_SDL: 00115 return TexturePtr(new SDLTexture(image)); 00116 default: 00117 assert(0 && "invalid video system in config"); 00118 #ifdef HAVE_OPENGL 00119 return TexturePtr(new GLTexture(image)); 00120 #else 00121 return TexturePtr(new SDLTexture(image)); 00122 #endif 00123 } 00124 }
SurfaceData * VideoSystem::new_surface_data | ( | const Surface & | surface | ) | [static] |
Definition at line 127 of file video_systems.cpp.
References AUTO_VIDEO, g_config, OPENGL, PURE_SDL, and Config::video.
Referenced by Surface::Surface().
00128 { 00129 switch(g_config->video) 00130 { 00131 case AUTO_VIDEO: 00132 #ifdef HAVE_OPENGL 00133 return new GLSurfaceData(surface); 00134 #else 00135 return new SDLSurfaceData(surface); 00136 #endif 00137 #ifdef HAVE_OPENGL 00138 case OPENGL: 00139 return new GLSurfaceData(surface); 00140 #endif 00141 case PURE_SDL: 00142 return new SDLSurfaceData(surface); 00143 default: 00144 assert(0 && "invalid video system in config"); 00145 #ifdef HAVE_OPENGL 00146 return new GLSurfaceData(surface); 00147 #else 00148 return new SDLSurfaceData(surface); 00149 #endif 00150 } 00151 }
void VideoSystem::free_surface_data | ( | SurfaceData * | surface_data | ) | [static] |
VideoSystem::Enum VideoSystem::get_video_system | ( | const std::string & | video | ) | [static] |
Definition at line 160 of file video_systems.cpp.
References AUTO_VIDEO, OPENGL, and PURE_SDL.
Referenced by Config::load(), and Main::parse_commandline().
00161 { 00162 if(video == "auto") 00163 { 00164 return AUTO_VIDEO; 00165 } 00166 #ifdef HAVE_OPENGL 00167 else if(video == "opengl") 00168 { 00169 return OPENGL; 00170 } 00171 #endif 00172 else if(video == "sdl") 00173 { 00174 return PURE_SDL; 00175 } 00176 else 00177 { 00178 return AUTO_VIDEO; 00179 } 00180 }
std::string VideoSystem::get_video_string | ( | Enum | video | ) | [static] |
Definition at line 183 of file video_systems.cpp.
References AUTO_VIDEO, OPENGL, and PURE_SDL.
Referenced by Config::save().
00184 { 00185 switch(video) 00186 { 00187 case AUTO_VIDEO: 00188 return "auto"; 00189 case OPENGL: 00190 return "opengl"; 00191 case PURE_SDL: 00192 return "sdl"; 00193 default: 00194 assert(0 && "invalid video system in config"); 00195 return "auto"; 00196 } 00197 }
VideoSystem& VideoSystem::operator= | ( | const VideoSystem & | ) | [private] |