1#include <Foundation/FoundationInternal.h>
2PL_FOUNDATION_INTERNAL_HEADER
4#include <Foundation/System/Screen.h>
9 plResult plGlfwError(
const char* file,
size_t line)
12 int errorCode = glfwGetError(&desc);
13 if (errorCode != GLFW_NO_ERROR)
15 plLog::Error(
"GLFW error {} ({}): {} - {}", file, line, errorCode, desc);
22#define PL_GLFW_RETURN_FAILURE_ON_ERROR() \
25 if (plGlfwError(__FILE__, __LINE__).Failed()) \
33 int iMonitorCount = 0;
34 GLFWmonitor** pMonitors = glfwGetMonitors(&iMonitorCount);
35 PL_GLFW_RETURN_FAILURE_ON_ERROR();
36 if (iMonitorCount == 0)
41 GLFWmonitor* pPrimaryMonitor = glfwGetPrimaryMonitor();
42 PL_GLFW_RETURN_FAILURE_ON_ERROR();
43 if (pPrimaryMonitor ==
nullptr)
48 for (
int i = 0; i < iMonitorCount; ++i)
52 PL_GLFW_RETURN_FAILURE_ON_ERROR();
54 const GLFWvidmode* mode = glfwGetVideoMode(pMonitors[i]);
55 PL_GLFW_RETURN_FAILURE_ON_ERROR();
64 PL_GLFW_RETURN_FAILURE_ON_ERROR();
T & ExpandAndGetRef()
Grows the array by one element and returns a reference to the newly created element.
Definition ArrayBase_inl.h:310
void Clear()
Clears the array.
Definition ArrayBase_inl.h:184
Definition DynamicArray.h:81
static void Error(plLogInterface *pInterface, const plFormatString &string)
An error that needs to be fixed as soon as possible.
Definition Log.cpp:375
static plResult EnumerateScreens(plDynamicArray< plScreenInfo > &out_screens)
Enumerates all available screens. When it returns PL_SUCCESS, at least one screen has been found.
Definition Screen_GLFW.h:29
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
Describes the properties of a screen.
Definition Screen.h:10
plString m_sDisplayName
Some OS provided name for the screen, typically the manufacturer and model name.
Definition Screen.h:11
bool m_bIsPrimary
Whether this is the primary/main screen.
Definition Screen.h:17
plInt32 m_iOffsetY
The virtual position of the screen. Ie. a window created at this location will appear on this screen.
Definition Screen.h:14
plInt32 m_iResolutionX
The virtual resolution. Ie. a window with this dimension will span the entire screen.
Definition Screen.h:15
plInt32 m_iOffsetX
The virtual position of the screen. Ie. a window created at this location will appear on this screen.
Definition Screen.h:13
plInt32 m_iResolutionY
The virtual resolution. Ie. a window with this dimension will span the entire screen.
Definition Screen.h:16