Added love.window.getDisplayName, to get the name of a connected display.

This commit is contained in:
Alex Szpakowski
2014-06-14 16:20:30 -03:00
parent 23d3cbc2e2
commit aa882cbcbc
5 changed files with 29 additions and 0 deletions
+12
View File
@@ -44,6 +44,8 @@ Window::Window()
{
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
throw love::Exception("%s", SDL_GetError());
printf("DISPLAY: %s\n", SDL_GetDisplayName(0));
}
Window::~Window()
@@ -461,6 +463,16 @@ int Window::getDisplayCount() const
return SDL_GetNumVideoDisplays();
}
const char *Window::getDisplayName(int displayindex) const
{
const char *name = SDL_GetDisplayName(displayindex);
if (name == nullptr)
throw love::Exception("Invalid display index: %d", displayindex + 1);
return name;
}
typedef Window::WindowSize WindowSize;
std::vector<WindowSize> Window::getFullscreenSizes(int displayindex) const
+2
View File
@@ -51,6 +51,8 @@ public:
int getDisplayCount() const;
const char *getDisplayName(int displayindex) const;
std::vector<WindowSize> getFullscreenSizes(int displayindex) const;
int getWidth() const;