|
|
@ -45,7 +45,6 @@ static void usage(void) |
|
|
|
printf(" -a create windows for all monitors\n"); |
|
|
|
printf(" -a create windows for all monitors\n"); |
|
|
|
printf(" -f create full screen window(s)\n"); |
|
|
|
printf(" -f create full screen window(s)\n"); |
|
|
|
printf(" -h show this help\n"); |
|
|
|
printf(" -h show this help\n"); |
|
|
|
printf(" -n no automatic iconification of full screen windows\n"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void error_callback(int error, const char* description) |
|
|
|
static void error_callback(int error, const char* description) |
|
|
@ -76,6 +75,18 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action, |
|
|
|
case GLFW_KEY_ESCAPE: |
|
|
|
case GLFW_KEY_ESCAPE: |
|
|
|
glfwSetWindowShouldClose(window, GLFW_TRUE); |
|
|
|
glfwSetWindowShouldClose(window, GLFW_TRUE); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case GLFW_KEY_A: |
|
|
|
|
|
|
|
glfwSetWindowAttrib(window, GLFW_AUTO_ICONIFY, !glfwGetWindowAttrib(window, GLFW_AUTO_ICONIFY)); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case GLFW_KEY_B: |
|
|
|
|
|
|
|
glfwSetWindowAttrib(window, GLFW_RESIZABLE, !glfwGetWindowAttrib(window, GLFW_RESIZABLE)); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case GLFW_KEY_D: |
|
|
|
|
|
|
|
glfwSetWindowAttrib(window, GLFW_DECORATED, !glfwGetWindowAttrib(window, GLFW_DECORATED)); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case GLFW_KEY_F: |
|
|
|
|
|
|
|
glfwSetWindowAttrib(window, GLFW_FLOATING, !glfwGetWindowAttrib(window, GLFW_FLOATING)); |
|
|
|
|
|
|
|
break; |
|
|
|
case GLFW_KEY_F11: |
|
|
|
case GLFW_KEY_F11: |
|
|
|
case GLFW_KEY_ENTER: |
|
|
|
case GLFW_KEY_ENTER: |
|
|
|
{ |
|
|
|
{ |
|
|
@ -143,24 +154,11 @@ static void window_maximize_callback(GLFWwindow* window, int maximized) |
|
|
|
|
|
|
|
|
|
|
|
static void window_refresh_callback(GLFWwindow* window) |
|
|
|
static void window_refresh_callback(GLFWwindow* window) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int width, height; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("%0.2f Window refresh\n", glfwGetTime()); |
|
|
|
printf("%0.2f Window refresh\n", glfwGetTime()); |
|
|
|
|
|
|
|
|
|
|
|
glfwGetFramebufferSize(window, &width, &height); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
glfwMakeContextCurrent(window); |
|
|
|
glfwMakeContextCurrent(window); |
|
|
|
|
|
|
|
|
|
|
|
glEnable(GL_SCISSOR_TEST); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
glScissor(0, 0, width, height); |
|
|
|
|
|
|
|
glClearColor(0, 0, 0, 0); |
|
|
|
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
glScissor(0, 0, 640, 480); |
|
|
|
|
|
|
|
glClearColor(1, 1, 1, 0); |
|
|
|
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT); |
|
|
|
glClear(GL_COLOR_BUFFER_BIT); |
|
|
|
|
|
|
|
|
|
|
|
glfwSwapBuffers(window); |
|
|
|
glfwSwapBuffers(window); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -203,7 +201,7 @@ static GLFWwindow* create_window(GLFWmonitor* monitor) |
|
|
|
int main(int argc, char** argv) |
|
|
|
int main(int argc, char** argv) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int ch, i, window_count; |
|
|
|
int ch, i, window_count; |
|
|
|
int auto_iconify = GLFW_TRUE, fullscreen = GLFW_FALSE, all_monitors = GLFW_FALSE; |
|
|
|
int fullscreen = GLFW_FALSE, all_monitors = GLFW_FALSE; |
|
|
|
GLFWwindow** windows; |
|
|
|
GLFWwindow** windows; |
|
|
|
|
|
|
|
|
|
|
|
while ((ch = getopt(argc, argv, "afhn")) != -1) |
|
|
|
while ((ch = getopt(argc, argv, "afhn")) != -1) |
|
|
@ -222,10 +220,6 @@ int main(int argc, char** argv) |
|
|
|
fullscreen = GLFW_TRUE; |
|
|
|
fullscreen = GLFW_TRUE; |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case 'n': |
|
|
|
|
|
|
|
auto_iconify = GLFW_FALSE; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
default: |
|
|
|
usage(); |
|
|
|
usage(); |
|
|
|
exit(EXIT_FAILURE); |
|
|
|
exit(EXIT_FAILURE); |
|
|
@ -237,8 +231,6 @@ int main(int argc, char** argv) |
|
|
|
if (!glfwInit()) |
|
|
|
if (!glfwInit()) |
|
|
|
exit(EXIT_FAILURE); |
|
|
|
exit(EXIT_FAILURE); |
|
|
|
|
|
|
|
|
|
|
|
glfwWindowHint(GLFW_AUTO_ICONIFY, auto_iconify); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (fullscreen && all_monitors) |
|
|
|
if (fullscreen && all_monitors) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int monitor_count; |
|
|
|
int monitor_count; |
|
|
|