diff engine/core/video/opengl/renderbackendopengl.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 129d3dafd3a5
children 66db8ce5dfa2
line wrap: on
line diff
--- a/engine/core/video/opengl/renderbackendopengl.cpp	Tue Jul 15 20:12:30 2008 +0000
+++ b/engine/core/video/opengl/renderbackendopengl.cpp	Wed Jul 16 12:37:41 2008 +0000
@@ -32,6 +32,7 @@
 #include "fife_opengl.h"
 #include "glimage.h"
 #include "renderbackendopengl.h"
+#include "SDL_image.h"
 
 namespace FIFE {
 
@@ -62,7 +63,7 @@
 		SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); // temporary hack
 	}
 
-	Image* RenderBackendOpenGL::createMainScreen(unsigned int width, unsigned int height, unsigned char bitsPerPixel, bool fs) {
+	Image* RenderBackendOpenGL::createMainScreen(unsigned int width, unsigned int height, unsigned char bitsPerPixel, bool fs, const std::string& title, const std::string& icon) {
 		delete m_screen;
 		m_screen = 0;
 
@@ -71,6 +72,13 @@
 			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 ) {
@@ -98,7 +106,7 @@
 			screen = SDL_SetVideoMode(width, height, bitsPerPixel, flags);
 		}
 
-		SDL_WM_SetCaption("FIFE", 0);
+		SDL_WM_SetCaption(title.c_str(), 0);
 
 		if (!screen) {
 			throw SDLException(SDL_GetError());