comparison engine/core/video/sdl/renderbackendsdl.cpp @ 641:52708806f35c

* Small fix for gcc on Linux. It didn't like passing a const char* to a function that requires a char*.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 07 Oct 2010 19:39:58 +0000
parents 855ad500f991
children 6e2151325017
comparison
equal deleted inserted replaced
640:855ad500f991 641:52708806f35c
33 #include "util/log/logger.h" 33 #include "util/log/logger.h"
34 34
35 #include "renderbackendsdl.h" 35 #include "renderbackendsdl.h"
36 #include "sdlimage.h" 36 #include "sdlimage.h"
37 #include "SDL_image.h" 37 #include "SDL_image.h"
38 #include "SDL_getenv.h"
38 39
39 namespace FIFE { 40 namespace FIFE {
40 static Logger _log(LM_VIDEO); 41 static Logger _log(LM_VIDEO);
41 42
42 RenderBackendSDL::RenderBackendSDL(const SDL_Color& colorkey) : RenderBackend(colorkey) { 43 RenderBackendSDL::RenderBackendSDL(const SDL_Color& colorkey) : RenderBackend(colorkey) {
52 static std::string backend_name = "SDL"; 53 static std::string backend_name = "SDL";
53 return backend_name; 54 return backend_name;
54 } 55 }
55 56
56 void RenderBackendSDL::init(const std::string& driver) { 57 void RenderBackendSDL::init(const std::string& driver) {
58 char* buf;
57 if (driver != "") { 59 if (driver != "") {
58 std::string envVar = std::string("SDL_VIDEODRIVER=") + driver; 60 std::string envVar = std::string("SDL_VIDEODRIVER=") + driver;
59 SDL_putenv(envVar.c_str()); 61 buf = const_cast<char*>(envVar.c_str());
62 putenv(buf);
60 } 63 }
61 64
62 if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) 65 if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
63 throw SDLException(SDL_GetError()); 66 throw SDLException(SDL_GetError());
64 67