Skip to content

Commit

Permalink
Moved glfwGetMonitorWorkarea function usuage example to monitors.c test.
Browse files Browse the repository at this point in the history
  • Loading branch information
dougbinks committed Sep 8, 2018
1 parent b8df825 commit a484f0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 0 additions & 3 deletions examples/simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ int main(void)
GLFWwindow* window;
GLuint vertex_buffer, vertex_shader, fragment_shader, program;
GLint mvp_location, vpos_location, vcol_location;
int workarea_x, workarea_y, workarea_width, workarea_height;

glfwSetErrorCallback(error_callback);

Expand Down Expand Up @@ -132,8 +131,6 @@ int main(void)
glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE,
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))
{
float ratio;
Expand Down
5 changes: 5 additions & 0 deletions tests/monitors.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,14 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
static void list_modes(GLFWmonitor* monitor)
{
int count, x, y, widthMM, heightMM, i;
int workarea_x, workarea_y, workarea_width, workarea_height;

const GLFWvidmode* mode = glfwGetVideoMode(monitor);
const GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);

glfwGetMonitorPos(monitor, &x, &y);
glfwGetMonitorPhysicalSize(monitor, &widthMM, &heightMM);
glfwGetMonitorWorkarea(monitor, &workarea_x, &workarea_y, &workarea_width, &workarea_height);

printf("Name: %s (%s)\n",
glfwGetMonitorName(monitor),
Expand All @@ -107,6 +110,8 @@ static void list_modes(GLFWmonitor* monitor)

printf("Physical size: %i x %i mm (%0.2f dpi)\n",
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");

Expand Down

0 comments on commit a484f0d

Please sign in to comment.