Show the window caption with SDL 2.
This commit is contained in:
parent
632710bdad
commit
7a0873f0aa
3 changed files with 17 additions and 4 deletions
|
@ -73,6 +73,11 @@ void twindow::render()
|
|||
SDL_RenderPresent(*this);
|
||||
}
|
||||
|
||||
void twindow::set_title(const std::string& title)
|
||||
{
|
||||
SDL_SetWindowTitle(window_, title.c_str());
|
||||
}
|
||||
|
||||
twindow::operator SDL_Window*()
|
||||
{
|
||||
return window_;
|
||||
|
|
|
@ -96,6 +96,16 @@ public:
|
|||
/** Renders the contents of the window. */
|
||||
void render();
|
||||
|
||||
/**
|
||||
* Sets the title of the window.
|
||||
*
|
||||
* This is a wrapper for @ref SDL_SetWindowTitle.
|
||||
*
|
||||
* @param title The new title for the window.
|
||||
*/
|
||||
void set_title(const std::string& title);
|
||||
|
||||
|
||||
/***** ***** ***** Conversion operators. ***** ***** *****/
|
||||
|
||||
/**
|
||||
|
@ -105,7 +115,6 @@ public:
|
|||
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Conversion operator to a SDL_Renderer*.
|
||||
*
|
||||
|
|
|
@ -544,9 +544,8 @@ CVideo::window_state(void)
|
|||
|
||||
void CVideo::set_window_title(const std::string& title)
|
||||
{
|
||||
if(window) {
|
||||
SDL_SetWindowTitle(window, title.c_str());
|
||||
}
|
||||
assert(main_window);
|
||||
main_window->set_title(title);
|
||||
}
|
||||
|
||||
void CVideo::set_window_icon(surface& icon)
|
||||
|
|
Loading…
Add table
Reference in a new issue