mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 13:46:37 +00:00
Moved glfwGetMonitorWorkarea function usuage example to monitors.c test.
This commit is contained in:
parent
b8df8258ea
commit
a484f0d8dd
@ -79,7 +79,6 @@ int main(void)
|
|||||||
GLFWwindow* window;
|
GLFWwindow* window;
|
||||||
GLuint vertex_buffer, vertex_shader, fragment_shader, program;
|
GLuint vertex_buffer, vertex_shader, fragment_shader, program;
|
||||||
GLint mvp_location, vpos_location, vcol_location;
|
GLint mvp_location, vpos_location, vcol_location;
|
||||||
int workarea_x, workarea_y, workarea_width, workarea_height;
|
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
|
|
||||||
@ -132,8 +131,6 @@ int main(void)
|
|||||||
glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE,
|
glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE,
|
||||||
sizeof(vertices[0]), (void*) (sizeof(float) * 2));
|
sizeof(vertices[0]), (void*) (sizeof(float) * 2));
|
||||||
|
|
||||||
glfwGetMonitorWorkarea(glfwGetPrimaryMonitor(), &workarea_x, &workarea_y, &workarea_width, &workarea_height);
|
|
||||||
printf("Monitor work area: %d, %d, %d, %d\n", workarea_x, workarea_y, workarea_width, workarea_height);
|
|
||||||
while (!glfwWindowShouldClose(window))
|
while (!glfwWindowShouldClose(window))
|
||||||
{
|
{
|
||||||
float ratio;
|
float ratio;
|
||||||
|
@ -93,11 +93,14 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
|||||||
static void list_modes(GLFWmonitor* monitor)
|
static void list_modes(GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
int count, x, y, widthMM, heightMM, i;
|
int count, x, y, widthMM, heightMM, i;
|
||||||
|
int workarea_x, workarea_y, workarea_width, workarea_height;
|
||||||
|
|
||||||
const 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);
|
||||||
glfwGetMonitorPhysicalSize(monitor, &widthMM, &heightMM);
|
glfwGetMonitorPhysicalSize(monitor, &widthMM, &heightMM);
|
||||||
|
glfwGetMonitorWorkarea(monitor, &workarea_x, &workarea_y, &workarea_width, &workarea_height);
|
||||||
|
|
||||||
printf("Name: %s (%s)\n",
|
printf("Name: %s (%s)\n",
|
||||||
glfwGetMonitorName(monitor),
|
glfwGetMonitorName(monitor),
|
||||||
@ -107,6 +110,8 @@ static void list_modes(GLFWmonitor* monitor)
|
|||||||
|
|
||||||
printf("Physical size: %i x %i mm (%0.2f dpi)\n",
|
printf("Physical size: %i x %i mm (%0.2f dpi)\n",
|
||||||
widthMM, heightMM, mode->width * 25.4f / widthMM);
|
widthMM, heightMM, mode->width * 25.4f / widthMM);
|
||||||
|
printf("Monitor work area: pos=(%d,%d) size=(%dx%d)\n",
|
||||||
|
workarea_x, workarea_y, workarea_width, workarea_height);
|
||||||
|
|
||||||
printf("Modes:\n");
|
printf("Modes:\n");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user