From ecf9731750c6d03c7970b3394713dfd6909ff35d Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Mon, 19 Jan 2015 23:29:51 +0300 Subject: [PATCH] Implement more Window methods --- SDL2pp/Window.cc | 16 ++++++++++++++++ SDL2pp/Window.hh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/SDL2pp/Window.cc b/SDL2pp/Window.cc index 687e58d..98e5c1a 100644 --- a/SDL2pp/Window.cc +++ b/SDL2pp/Window.cc @@ -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_); +} + } diff --git a/SDL2pp/Window.hh b/SDL2pp/Window.hh index 48ec252..8ddb5d8 100644 --- a/SDL2pp/Window.hh +++ b/SDL2pp/Window.hh @@ -25,6 +25,7 @@ #include #include +#include #include @@ -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; }; }