mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Added love.window.getDisplayName, to get the name of a connected display.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -51,6 +51,8 @@ public:
|
||||
|
||||
int getDisplayCount() const;
|
||||
|
||||
const char *getDisplayName(int displayindex) const;
|
||||
|
||||
std::vector<WindowSize> getFullscreenSizes(int displayindex) const;
|
||||
|
||||
int getWidth() const;
|
||||
|
||||
Reference in New Issue
Block a user