Mercurial > fife-parpg
diff engine/core/video/sdl/renderbackendsdl.cpp @ 61:18c2a21ac0ad
allow clients to set a custom window title and icon
author | spq@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Wed, 16 Jul 2008 12:37:41 +0000 |
parents | 90005975cdbb |
children | ad7969d9460b |
line wrap: on
line diff
--- a/engine/core/video/sdl/renderbackendsdl.cpp Tue Jul 15 20:12:30 2008 +0000 +++ b/engine/core/video/sdl/renderbackendsdl.cpp Wed Jul 16 12:37:41 2008 +0000 @@ -34,6 +34,7 @@ #include "renderbackendsdl.h" #include "sdlimage.h" +#include "SDL_image.h" namespace FIFE { static Logger _log(LM_VIDEO); @@ -58,12 +59,19 @@ SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); // temporary hack } - Image* RenderBackendSDL::createMainScreen(unsigned int width, unsigned int height, unsigned char bitsPerPixel, bool fs) { + Image* RenderBackendSDL::createMainScreen(unsigned int width, unsigned int height, unsigned char bitsPerPixel, bool fs, const std::string& title, const std::string& icon) { Uint32 flags = 0; if (fs) { flags |= SDL_FULLSCREEN; } + if(icon != "") { + SDL_Surface *img = IMG_Load(icon.c_str()); + if(img != NULL) { + SDL_WM_SetIcon(img, 0); + } + } + SDL_Surface* screen = NULL; if( 0 == bitsPerPixel ) { @@ -100,7 +108,7 @@ << "Videomode " << width << "x" << height << " at " << int(screen->format->BitsPerPixel) << " bpp"); - SDL_WM_SetCaption("FIFE", NULL); + SDL_WM_SetCaption(title.c_str(), NULL); if (!screen) { throw SDLException(SDL_GetError());