diff --git a/SDL2pp/Display.cc b/SDL2pp/Display.cc index 7905fd3..47f64ab 100644 --- a/SDL2pp/Display.cc +++ b/SDL2pp/Display.cc @@ -28,6 +28,15 @@ using std::string; namespace SDL2pp { +Rect GetDisplayBounds(int displayIndex) { + Rect result; + if (SDL_GetDisplayBounds(displayIndex, &result) < 0) { + throw Exception("SDL_GetDisplayBounds"); + } + + return result; +} + string GetDisplayName(int displayIndex) { const char* name = SDL_GetDisplayName(displayIndex); if (name == nullptr) { diff --git a/SDL2pp/Display.hh b/SDL2pp/Display.hh index 85647ac..a09f876 100644 --- a/SDL2pp/Display.hh +++ b/SDL2pp/Display.hh @@ -30,6 +30,29 @@ #include namespace SDL2pp { + //////////////////////////////////////////////////////////// + /// \brief Gets the area of a given display + /// + /// This function retrieves an rectangle with the area of + /// the given display, with the initial display being located + /// at (0,0). This function does not takes into account space + /// that is not usable, like OS X's menu bar. + /// + /// \ingroup graphics + /// + /// \headerfile SDL2pp/Display.hh + /// + /// \param[in] displayIndex The display to retrieve the area + /// + /// \returns A rectangle with area of the given display + /// + /// \throws SDL2pp::Exception + /// + /// \see https://wiki.libsdl.org/SDL_GetDisplayBounds + /// + //////////////////////////////////////////////////////////// + SDL2PP_EXPORT Rect GetDisplayBounds(int displayIndex); + //////////////////////////////////////////////////////////// /// \brief Gets the name of a given display ///