Added GetDrawableSize, GetDrawableWidth and GetDrawableHeight for HiDPI support

This commit is contained in:
Carsten Elton Sorensen 2015-10-14 22:09:34 +02:00
parent 21d53add87
commit 198b0bbbc8
2 changed files with 49 additions and 0 deletions

View File

@ -76,6 +76,24 @@ int Window::GetHeight() const {
return h; return h;
} }
Point Window::GetDrawableSize() const {
int w, h;
SDL_GL_GetDrawableSize(window_, &w, &h);
return Point(w, h);
}
int Window::GetDrawableWidth() const {
int w, h;
SDL_GL_GetDrawableSize(window_, &w, &h);
return w;
}
int Window::GetDrawableHeight() const {
int w, h;
SDL_GL_GetDrawableSize(window_, &w, &h);
return h;
}
Window& Window::SetTitle(const std::string& title) { Window& Window::SetTitle(const std::string& title) {
SDL_SetWindowTitle(window_, title.c_str()); SDL_SetWindowTitle(window_, title.c_str());
return *this; return *this;

View File

@ -173,6 +173,37 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
int GetHeight() const; int GetHeight() const;
////////////////////////////////////////////////////////////
/// \brief Get drawable dimensions of the window
///
/// \returns SDL2pp::Point representing dimensions (width and
/// height) of the window in pixels
///
/// \see http://wiki.libsdl.org/SDL_GL_GetDrawableSize
///
////////////////////////////////////////////////////////////
Point GetDrawableSize() const;
////////////////////////////////////////////////////////////
/// \brief Get drawable width of the window
///
/// \returns Width of the window in pixels
///
/// \see http://wiki.libsdl.org/SDL_GL_GetDrawableSize
///
////////////////////////////////////////////////////////////
int GetDrawableWidth() const;
////////////////////////////////////////////////////////////
/// \brief Get drawable height of the window
///
/// \returns Height of the window in pixels
///
/// \see http://wiki.libsdl.org/SDL_GL_GetDrawableSize
///
////////////////////////////////////////////////////////////
int GetDrawableHeight() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Set window title /// \brief Set window title
/// ///