Implement more Window methods

This commit is contained in:
Dmitry Marakasov 2015-01-19 23:29:51 +03:00
parent dfaf8d0da3
commit ecf9731750
2 changed files with 49 additions and 0 deletions

View File

@ -197,4 +197,20 @@ Window& Window::SetGrab(bool grabbed) {
return *this;
}
int Window::GetDisplayIndex() const {
int index = SDL_GetWindowDisplayIndex(window_);
if (index < 0)
throw SDL2pp::Exception("SDL_GetWindowDisplayIndex");
return index;
}
void Window::GetDisplayMode(SDL_DisplayMode& mode) const {
if (SDL_GetWindowDisplayMode(window_, &mode) != 0)
throw SDL2pp::Exception("SDL_GetWindowDisplayMode");
}
Uint32 Window::GetFlags() const {
return SDL_GetWindowFlags(window_);
}
}

View File

@ -25,6 +25,7 @@
#include <string>
#include <SDL2/SDL_stdinc.h>
#include <SDL2/SDL_video.h>
#include <SDL2pp/Point.hh>
@ -441,6 +442,38 @@ public:
///
////////////////////////////////////////////////////////////
Window& SetGrab(bool grabbed);
////////////////////////////////////////////////////////////
/// \brief Get the index of the display associated with a window
///
/// \returns Index of the display containing the center of the window
///
/// \see http://wiki.libsdl.org/SDL_GetWindowDisplayIndex
///
////////////////////////////////////////////////////////////
int GetDisplayIndex() const;
////////////////////////////////////////////////////////////
/// \brief Get information about the display mode to use when a
/// window is visible at fullscreen
///
/// \param[out] mode SDL_DisplayMode structure filled in with the
/// fullscreen display mode
///
/// \see http://wiki.libsdl.org/SDL_GetWindowDisplayMode
///
////////////////////////////////////////////////////////////
void GetDisplayMode(SDL_DisplayMode& mode) const;
////////////////////////////////////////////////////////////
/// \brief Get the window flags
///
/// \returns Mask of the SDL_WindowFlags associated with window
///
/// \see http://wiki.libsdl.org/SDL_GetWindowFlags
///
////////////////////////////////////////////////////////////
Uint32 GetFlags() const;
};
}