Add a work-around for SDL_WM_SetIcon in SDL2.

The code compiles, but doesn't do anything useful at the moment.
This commit is contained in:
Mark de Wever 2014-03-02 15:31:17 +01:00
parent c28579e1f1
commit 08e717e4cd
3 changed files with 20 additions and 0 deletions

View file

@ -357,7 +357,11 @@ bool game_controller::init_video()
surface icon(image::get_image("game-icon.png", image::UNSCALED));
if(icon != NULL) {
///must be called after SDL_Init() and before setting video mode
#if SDL_VERSION_ATLEAST(2, 0, 0)
CVideo::set_window_icon(icon);
#else
SDL_WM_SetIcon(icon,NULL);
#endif
}
#endif

View file

@ -481,6 +481,13 @@ void CVideo::set_window_title(const std::string& title)
SDL_SetWindowTitle(window, title.c_str());
}
}
void CVideo::set_window_icon(surface& icon)
{
if(window) {
SDL_SetWindowIcon(window, icon);
}
}
#endif
std::vector<std::pair<int, int> > CVideo::get_available_resolutions()

View file

@ -140,6 +140,15 @@ class CVideo : private boost::noncopyable {
* @param title The new title for the window.
*/
static void set_window_title(const std::string& title);
/**
* Sets the icon of the main window.
*
* @warning The function is a NOP at the moment.
*
* @param icon The new icon for the window.
*/
static void set_window_icon(surface& icon);
#endif
/**