Add GetMonitorVideoModes() to query all supported video modes for a monitor
This commit is contained in:
parent
a6d5a7ffbc
commit
40b81dd52a
|
|
@ -1001,6 +1001,40 @@ int GetMonitorRefreshRate(int monitor)
|
||||||
return refresh;
|
return refresh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get available video modes for the specified monitor
|
||||||
|
VideoMode *GetMonitorVideoModes(int monitor, int *count)
|
||||||
|
{
|
||||||
|
VideoMode *modes = NULL;
|
||||||
|
*count = 0;
|
||||||
|
|
||||||
|
int monitorCount = 0;
|
||||||
|
GLFWmonitor **monitors = glfwGetMonitors(&monitorCount);
|
||||||
|
|
||||||
|
if ((monitor >= 0) && (monitor < monitorCount))
|
||||||
|
{
|
||||||
|
int modeCount = 0;
|
||||||
|
const GLFWvidmode *glfwModes = glfwGetVideoModes(monitors[monitor], &modeCount);
|
||||||
|
|
||||||
|
if (glfwModes)
|
||||||
|
{
|
||||||
|
modes = (VideoMode *)RL_MALLOC(modeCount*sizeof(VideoMode));
|
||||||
|
|
||||||
|
for (int i = 0; i < modeCount; i++)
|
||||||
|
{
|
||||||
|
modes[i].width = glfwModes[i].width;
|
||||||
|
modes[i].height = glfwModes[i].height;
|
||||||
|
modes[i].refreshRate = glfwModes[i].refreshRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
*count = modeCount;
|
||||||
|
}
|
||||||
|
else TRACELOG(LOG_WARNING, "GLFW: Failed to get video modes for selected monitor");
|
||||||
|
}
|
||||||
|
else TRACELOG(LOG_WARNING, "GLFW: Failed to find selected monitor");
|
||||||
|
|
||||||
|
return modes;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the human-readable, UTF-8 encoded name of the selected monitor
|
// Get the human-readable, UTF-8 encoded name of the selected monitor
|
||||||
const char *GetMonitorName(int monitor)
|
const char *GetMonitorName(int monitor)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
10
src/raylib.h
10
src/raylib.h
|
|
@ -257,6 +257,13 @@ typedef struct Rectangle {
|
||||||
float height; // Rectangle height
|
float height; // Rectangle height
|
||||||
} Rectangle;
|
} Rectangle;
|
||||||
|
|
||||||
|
// VideoMode, monitor video mode properties
|
||||||
|
typedef struct VideoMode {
|
||||||
|
int width; // Video mode screen width
|
||||||
|
int height; // Video mode screen height
|
||||||
|
int refreshRate; // Video mode screen refresh rate
|
||||||
|
} VideoMode;
|
||||||
|
|
||||||
// Image, pixel data stored in CPU memory (RAM)
|
// Image, pixel data stored in CPU memory (RAM)
|
||||||
typedef struct Image {
|
typedef struct Image {
|
||||||
void *data; // Image raw data
|
void *data; // Image raw data
|
||||||
|
|
@ -347,6 +354,8 @@ typedef struct Mesh {
|
||||||
// Vertex attributes data
|
// Vertex attributes data
|
||||||
float *vertices; // Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
|
float *vertices; // Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
|
||||||
float *texcoords; // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
|
float *texcoords; // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
|
||||||
|
// ClearMouseCursorImage();
|
||||||
|
//
|
||||||
float *texcoords2; // Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5)
|
float *texcoords2; // Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5)
|
||||||
float *normals; // Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
|
float *normals; // Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
|
||||||
float *tangents; // Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
|
float *tangents; // Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
|
||||||
|
|
@ -1023,6 +1032,7 @@ RLAPI int GetMonitorHeight(int monitor); // Get specifi
|
||||||
RLAPI int GetMonitorPhysicalWidth(int monitor); // Get specified monitor physical width in millimetres
|
RLAPI int GetMonitorPhysicalWidth(int monitor); // Get specified monitor physical width in millimetres
|
||||||
RLAPI int GetMonitorPhysicalHeight(int monitor); // Get specified monitor physical height in millimetres
|
RLAPI int GetMonitorPhysicalHeight(int monitor); // Get specified monitor physical height in millimetres
|
||||||
RLAPI int GetMonitorRefreshRate(int monitor); // Get specified monitor refresh rate
|
RLAPI int GetMonitorRefreshRate(int monitor); // Get specified monitor refresh rate
|
||||||
|
RLAPI VideoMode *GetMonitorVideoModes(int monitor, int *count); // Get available video modes for a monitor
|
||||||
RLAPI Vector2 GetWindowPosition(void); // Get window position XY on monitor
|
RLAPI Vector2 GetWindowPosition(void); // Get window position XY on monitor
|
||||||
RLAPI Vector2 GetWindowScaleDPI(void); // Get window scale DPI factor
|
RLAPI Vector2 GetWindowScaleDPI(void); // Get window scale DPI factor
|
||||||
RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the specified monitor
|
RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the specified monitor
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user