mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 19:05:59 -04:00
Added GetDisplayName
This commit is contained in:
parent
a6208de4f8
commit
5068355832
@ -25,7 +25,18 @@
|
||||
|
||||
#include <SDL_video.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace SDL2pp {
|
||||
string GetDisplayName(int displayIndex) {
|
||||
const char* name = SDL_GetDisplayName(displayIndex);
|
||||
if (name == nullptr) {
|
||||
throw Exception("SDL_GetDisplayName");
|
||||
}
|
||||
|
||||
return string{name};
|
||||
}
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 4)
|
||||
DPI GetDisplayDPI(int displayIndex) {
|
||||
float diagonal = 0, horizontal = 0, vertical = 0;
|
||||
|
@ -27,8 +27,27 @@
|
||||
#include <SDL_version.h>
|
||||
|
||||
#include <SDL2pp/Rect.hh>
|
||||
#include <string>
|
||||
|
||||
namespace SDL2pp {
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Gets the name of a given display
|
||||
///
|
||||
/// \ingroup graphics
|
||||
///
|
||||
/// \headerfile SDL2pp/Display.hh
|
||||
///
|
||||
/// \param[in] displayIndex The display to retrieve its name
|
||||
///
|
||||
/// \returns A string with the name of the given display
|
||||
///
|
||||
/// \throws SDL2pp::Exception
|
||||
///
|
||||
/// \see https://wiki.libsdl.org/SDL_GetDisplayName
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SDL2PP_EXPORT std::string GetDisplayName(int displayIndex);
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 4)
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Read-only struct to store DPI information of a display
|
||||
|
Loading…
x
Reference in New Issue
Block a user