projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Getting rid of nasty tabs
[supertux.git]
/
src
/
video
/
video_systems.cpp
diff --git
a/src/video/video_systems.cpp
b/src/video/video_systems.cpp
index
29404e0
..
2612857
100644
(file)
--- a/
src/video/video_systems.cpp
+++ b/
src/video/video_systems.cpp
@@
-36,15
+36,31
@@
Renderer *new_renderer()
{
switch(config->video)
{
{
switch(config->video)
{
+ case AUTO_VIDEO:
+#ifdef HAVE_OPENGL
+ log_info << "new GL renderer\n";
+ return new GL::Renderer();
+#else
+ log_warning << "new SDL renderer\n";
+ return new SDL::Renderer();
+#endif
#ifdef HAVE_OPENGL
case OPENGL:
#ifdef HAVE_OPENGL
case OPENGL:
+ log_info << "new GL renderer\n";
return new GL::Renderer();
#endif
case PURE_SDL:
return new GL::Renderer();
#endif
case PURE_SDL:
+ log_warning << "new SDL renderer\n";
return new SDL::Renderer();
default:
assert(0 && "invalid video system in config");
return new SDL::Renderer();
default:
assert(0 && "invalid video system in config");
+#ifdef HAVE_OPENGL
+ log_info << "new GL renderer\n";
+ return new GL::Renderer();
+#else
+ log_warning << "new SDL renderer\n";
return new SDL::Renderer();
return new SDL::Renderer();
+#endif
}
}
}
}
@@
-52,6
+68,12
@@
Lightmap *new_lightmap()
{
switch(config->video)
{
{
switch(config->video)
{
+ case AUTO_VIDEO:
+#ifdef HAVE_OPENGL
+ return new GL::Lightmap();
+#else
+ return new SDL::Lightmap();
+#endif
#ifdef HAVE_OPENGL
case OPENGL:
return new GL::Lightmap();
#ifdef HAVE_OPENGL
case OPENGL:
return new GL::Lightmap();
@@
-60,7
+82,11
@@
Lightmap *new_lightmap()
return new SDL::Lightmap();
default:
assert(0 && "invalid video system in config");
return new SDL::Lightmap();
default:
assert(0 && "invalid video system in config");
+#ifdef HAVE_OPENGL
+ return new GL::Lightmap();
+#else
return new SDL::Lightmap();
return new SDL::Lightmap();
+#endif
}
}
}
}
@@
-68,6
+94,12
@@
Texture *new_texture(SDL_Surface *image)
{
switch(config->video)
{
{
switch(config->video)
{
+ case AUTO_VIDEO:
+#ifdef HAVE_OPENGL
+ return new GL::Texture(image);
+#else
+ return new SDL::Texture(image);
+#endif
#ifdef HAVE_OPENGL
case OPENGL:
return new GL::Texture(image);
#ifdef HAVE_OPENGL
case OPENGL:
return new GL::Texture(image);
@@
-76,7
+108,11
@@
Texture *new_texture(SDL_Surface *image)
return new SDL::Texture(image);
default:
assert(0 && "invalid video system in config");
return new SDL::Texture(image);
default:
assert(0 && "invalid video system in config");
+#ifdef HAVE_OPENGL
+ return new GL::Texture(image);
+#else
return new SDL::Texture(image);
return new SDL::Texture(image);
+#endif
}
}
}
}
@@
-84,6
+120,12
@@
void *new_surface_data(const Surface &surface)
{
switch(config->video)
{
{
switch(config->video)
{
+ case AUTO_VIDEO:
+#ifdef HAVE_OPENGL
+ return new GL::SurfaceData(surface);
+#else
+ return new SDL::SurfaceData(surface);
+#endif
#ifdef HAVE_OPENGL
case OPENGL:
return new GL::SurfaceData(surface);
#ifdef HAVE_OPENGL
case OPENGL:
return new GL::SurfaceData(surface);
@@
-92,7
+134,11
@@
void *new_surface_data(const Surface &surface)
return new SDL::SurfaceData(surface);
default:
assert(0 && "invalid video system in config");
return new SDL::SurfaceData(surface);
default:
assert(0 && "invalid video system in config");
+#ifdef HAVE_OPENGL
+ return new GL::SurfaceData(surface);
+#else
return new SDL::SurfaceData(surface);
return new SDL::SurfaceData(surface);
+#endif
}
}
}
}
@@
-103,7
+149,10
@@
void free_surface_data(void *surface_data)
VideoSystem get_video_system(const std::string &video)
{
VideoSystem get_video_system(const std::string &video)
{
- if(0) {}
+ if(video == "auto")
+ {
+ return AUTO_VIDEO;
+ }
#ifdef HAVE_OPENGL
else if(video == "opengl")
{
#ifdef HAVE_OPENGL
else if(video == "opengl")
{
@@
-116,11
+165,7
@@
VideoSystem get_video_system(const std::string &video)
}
else
{
}
else
{
-#ifdef HAVE_OPENGL
- return OPENGL;
-#else
- return PURE_SDL;
-#endif
+ return AUTO_VIDEO;
}
}
}
}
@@
-128,12
+173,14
@@
std::string get_video_string(VideoSystem video)
{
switch(video)
{
{
switch(video)
{
+ case AUTO_VIDEO:
+ return "auto";
case OPENGL:
return "opengl";
case PURE_SDL:
return "sdl";
default:
assert(0 && "invalid video system in config");
case OPENGL:
return "opengl";
case PURE_SDL:
return "sdl";
default:
assert(0 && "invalid video system in config");
- return "
sdl
";
+ return "
auto
";
}
}
}
}