Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-02-28 12:08:22 +0000
committerStijn Buys <ingar@osirion.org>2009-02-28 12:08:22 +0000
commitab6eaa9b401b6ce2ff7031d971277a6d935f4eb1 (patch)
treec62214bd4395b0eb1241e933c31b200231e255e3 /src/client/video.cc
parent3cf0d66d369c0445a58a6da8abfca61a5dcd9178 (diff)
added window title bar icon
Diffstat (limited to 'src/client/video.cc')
-rw-r--r--src/client/video.cc29
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)