mirror of
https://github.com/glfw/glfw.git
synced 2024-11-29 13:32:01 +00:00
Made glfwGetVideoMode consistent with getters.
This commit is contained in:
parent
5d308db654
commit
ce1e84def6
@ -1060,14 +1060,13 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
|
|||||||
* on whether it is focused.
|
* on whether it is focused.
|
||||||
*
|
*
|
||||||
* @param[in] monitor The monitor to query.
|
* @param[in] monitor The monitor to query.
|
||||||
* @return The current mode of the monitor, or a struct cleared to all zeroes
|
* @return The current mode of the monitor, or `NULL` if an error occurred.
|
||||||
* if an error occurred.
|
|
||||||
*
|
*
|
||||||
* @sa glfwGetVideoModes
|
* @sa glfwGetVideoModes
|
||||||
*
|
*
|
||||||
* @ingroup monitor
|
* @ingroup monitor
|
||||||
*/
|
*/
|
||||||
GLFWAPI GLFWvidmode glfwGetVideoMode(GLFWmonitor* monitor);
|
GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
|
||||||
|
|
||||||
/*! @brief Generates a gamma ramp and sets it for the specified monitor.
|
/*! @brief Generates a gamma ramp and sets it for the specified monitor.
|
||||||
*
|
*
|
||||||
|
@ -248,6 +248,7 @@ struct _GLFWmonitor
|
|||||||
|
|
||||||
GLFWvidmode* modes;
|
GLFWvidmode* modes;
|
||||||
int modeCount;
|
int modeCount;
|
||||||
|
GLFWvidmode currentMode;
|
||||||
|
|
||||||
GLFWgammaramp originalRamp;
|
GLFWgammaramp originalRamp;
|
||||||
GLFWgammaramp currentRamp;
|
GLFWgammaramp currentRamp;
|
||||||
|
@ -322,14 +322,13 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
|
|||||||
return monitor->modes;
|
return monitor->modes;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI GLFWvidmode glfwGetVideoMode(GLFWmonitor* handle)
|
GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* handle)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
GLFWvidmode mode = { 0, 0, 0, 0, 0 };
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(mode);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
_glfwPlatformGetVideoMode(monitor, &mode);
|
_glfwPlatformGetVideoMode(monitor, &monitor->currentMode);
|
||||||
return mode;
|
return &monitor->currentMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ void monitor_callback(GLFWmonitor* monitor, int event)
|
|||||||
if (event == GLFW_CONNECTED)
|
if (event == GLFW_CONNECTED)
|
||||||
{
|
{
|
||||||
int x, y, widthMM, heightMM;
|
int x, y, widthMM, heightMM;
|
||||||
GLFWvidmode mode = glfwGetVideoMode(monitor);
|
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
||||||
|
|
||||||
glfwGetMonitorPos(monitor, &x, &y);
|
glfwGetMonitorPos(monitor, &x, &y);
|
||||||
glfwGetMonitorPhysicalSize(monitor, &widthMM, &heightMM);
|
glfwGetMonitorPhysicalSize(monitor, &widthMM, &heightMM);
|
||||||
@ -380,7 +380,7 @@ void monitor_callback(GLFWmonitor* monitor, int event)
|
|||||||
counter++,
|
counter++,
|
||||||
glfwGetTime(),
|
glfwGetTime(),
|
||||||
glfwGetMonitorName(monitor),
|
glfwGetMonitorName(monitor),
|
||||||
mode.width, mode.height,
|
mode->width, mode->height,
|
||||||
x, y,
|
x, y,
|
||||||
widthMM, heightMM);
|
widthMM, heightMM);
|
||||||
}
|
}
|
||||||
|
@ -127,9 +127,9 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
if (monitor)
|
if (monitor)
|
||||||
{
|
{
|
||||||
GLFWvidmode mode = glfwGetVideoMode(monitor);
|
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
||||||
width = mode.width;
|
width = mode->width;
|
||||||
height = mode.height;
|
height = mode->height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -117,9 +117,9 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
if (monitor)
|
if (monitor)
|
||||||
{
|
{
|
||||||
GLFWvidmode mode = glfwGetVideoMode(monitor);
|
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
||||||
width = mode.width;
|
width = mode->width;
|
||||||
height = mode.height;
|
height = mode->height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -82,7 +82,7 @@ static void key_callback(GLFWwindow* window, int key, int action, int mods)
|
|||||||
static void list_modes(GLFWmonitor* monitor)
|
static void list_modes(GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
int count, x, y, widthMM, heightMM, dpi, i;
|
int count, x, y, widthMM, heightMM, dpi, i;
|
||||||
GLFWvidmode mode = glfwGetVideoMode(monitor);
|
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
||||||
const GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);
|
const GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);
|
||||||
|
|
||||||
glfwGetMonitorPos(monitor, &x, &y);
|
glfwGetMonitorPos(monitor, &x, &y);
|
||||||
@ -91,10 +91,10 @@ static void list_modes(GLFWmonitor* monitor)
|
|||||||
printf("Name: %s (%s)\n",
|
printf("Name: %s (%s)\n",
|
||||||
glfwGetMonitorName(monitor),
|
glfwGetMonitorName(monitor),
|
||||||
glfwGetPrimaryMonitor() == monitor ? "primary" : "secondary");
|
glfwGetPrimaryMonitor() == monitor ? "primary" : "secondary");
|
||||||
printf("Current mode: %s\n", format_mode(&mode));
|
printf("Current mode: %s\n", format_mode(mode));
|
||||||
printf("Virtual position: %i %i\n", x, y);
|
printf("Virtual position: %i %i\n", x, y);
|
||||||
|
|
||||||
dpi = (int) ((float) mode.width * 25.4f / (float) widthMM);
|
dpi = (int) ((float) mode->width * 25.4f / (float) widthMM);
|
||||||
printf("Physical size: %i x %i mm (%i dpi)\n", widthMM, heightMM, dpi);
|
printf("Physical size: %i x %i mm (%i dpi)\n", widthMM, heightMM, dpi);
|
||||||
|
|
||||||
printf("Modes:\n");
|
printf("Modes:\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user