Add a work-around for SDL_WM_SetCaption in SDL2.
The code compiles, but doesn't do anything useful at the moment.
This commit is contained in:
parent
a65a86f714
commit
c28579e1f1
3 changed files with 24 additions and 0 deletions
|
@ -331,7 +331,11 @@ bool game_controller::init_language()
|
|||
if(!cmdline_opts_.nogui) {
|
||||
std::string wm_title_string = _("The Battle for Wesnoth");
|
||||
wm_title_string += " - " + game_config::revision;
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
CVideo::set_window_title(wm_title_string);
|
||||
#else
|
||||
SDL_WM_SetCaption(wm_title_string.c_str(), NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -920,7 +924,11 @@ bool game_controller::change_language()
|
|||
if (!cmdline_opts_.nogui) {
|
||||
std::string wm_title_string = _("The Battle for Wesnoth");
|
||||
wm_title_string += " - " + game_config::revision;
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
CVideo::set_window_title(wm_title_string);
|
||||
#else
|
||||
SDL_WM_SetCaption(wm_title_string.c_str(), NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -474,6 +474,13 @@ CVideo::window_state(void)
|
|||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
void CVideo::set_window_title(const std::string& title)
|
||||
{
|
||||
if(window) {
|
||||
SDL_SetWindowTitle(window, title.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<std::pair<int, int> > CVideo::get_available_resolutions()
|
||||
|
|
|
@ -131,6 +131,15 @@ class CVideo : private boost::noncopyable {
|
|||
* @warning The function always return 0 for now.
|
||||
*/
|
||||
static Uint8 window_state();
|
||||
|
||||
/**
|
||||
* Sets the title of the main window.
|
||||
*
|
||||
* @warning The function is a NOP at the moment.
|
||||
*
|
||||
* @param title The new title for the window.
|
||||
*/
|
||||
static void set_window_title(const std::string& title);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue