diff options
-rw-r--r-- | src/client/video.cc | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/client/video.cc b/src/client/video.cc index aa5077f..4ad1c97 100644 --- a/src/client/video.cc +++ b/src/client/video.cc @@ -84,6 +84,23 @@ bool init() return false; } + + // set the window icon + filesystem::File *iconfile = filesystem::open("bitmaps/icon.bmp"); + if (iconfile) { + std::string iconfilename = iconfile->path(); + iconfilename.append(iconfile->name()); + filesystem::close(iconfile); + con_debug << " setting window icon " << iconfilename << std::endl; + + SDL_Surface *image = SDL_LoadBMP(iconfilename.c_str()); + if (image) { + Uint32 colorkey = SDL_MapRGB(image->format, 255, 0, 255); + SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey); + SDL_WM_SetIcon(image,NULL); + } + } + const SDL_VideoInfo* sdl_videoinfo = SDL_GetVideoInfo(); if( !sdl_videoinfo) { con_error << "SDL_GetVideoInfo() failed: " << SDL_GetError() << std::endl; @@ -191,13 +208,11 @@ bool init() void set_caption() { // set window caption - std::string version; - if (core::server() && core::server()->module()) { - version.assign(core::server()->module()->name()); - } else { - version.assign(core::name() + ' ' + core::version()); - } - SDL_WM_SetCaption(version.c_str(), 0); + std::string window_title(core::name()); + window_title += ' '; + window_title.append(core::version()); + + SDL_WM_SetCaption(window_title.c_str(), core::name().c_str()); } void resize(int w, int h) |