Added GetDisplayBounds

This commit is contained in:
Vraiment 2017-07-25 00:07:52 -07:00
parent 5068355832
commit 9986e488e9
2 changed files with 32 additions and 0 deletions

View File

@ -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) {

View File

@ -30,6 +30,29 @@
#include <string>
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
///