From ab6eaa9b401b6ce2ff7031d971277a6d935f4eb1 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 28 Feb 2009 12:08:22 +0000 Subject: added window title bar icon --- src/client/video.cc | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src/client/video.cc') 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) -- cgit v1.2.3