|
|
|
@ -70,16 +70,29 @@ static void key_callback(GLFWwindow window, int key, int action) |
|
|
|
|
|
|
|
|
|
static void window_size_callback(GLFWwindow window, int width, int height) |
|
|
|
|
{ |
|
|
|
|
printf("%0.2f Size %ix%i\n", glfwGetTime(), width, height); |
|
|
|
|
printf("%0.2f Window resized to %ix%i\n", glfwGetTime(), width, height); |
|
|
|
|
|
|
|
|
|
glViewport(0, 0, width, height); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void window_focus_callback(GLFWwindow window, int activated) |
|
|
|
|
{ |
|
|
|
|
printf("%0.2f Window %s\n", |
|
|
|
|
glfwGetTime(), |
|
|
|
|
activated ? "activated" : "deactivated"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void window_iconify_callback(GLFWwindow window, int iconified) |
|
|
|
|
{ |
|
|
|
|
printf("%0.2f Window %s\n", |
|
|
|
|
glfwGetTime(), |
|
|
|
|
iconified ? "iconified" : "restored"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv) |
|
|
|
|
{ |
|
|
|
|
int width, height, ch; |
|
|
|
|
int mode = GLFW_WINDOWED; |
|
|
|
|
GLboolean active = -1, iconified = -1; |
|
|
|
|
GLFWwindow window; |
|
|
|
|
|
|
|
|
|
while ((ch = getopt(argc, argv, "fh")) != -1) |
|
|
|
@ -134,23 +147,17 @@ int main(int argc, char** argv) |
|
|
|
|
glfwSetKeyCallback(key_callback); |
|
|
|
|
glfwSetWindowSizeCallback(window_size_callback); |
|
|
|
|
glfwSetWindowCloseCallback(window_close_callback); |
|
|
|
|
glfwSetWindowFocusCallback(window_focus_callback); |
|
|
|
|
glfwSetWindowIconifyCallback(window_iconify_callback); |
|
|
|
|
|
|
|
|
|
printf("Window is %s and %s\n", |
|
|
|
|
glfwGetWindowParam(window, GLFW_ICONIFIED) ? "iconified" : "restored", |
|
|
|
|
glfwGetWindowParam(window, GLFW_ACTIVE) ? "active" : "inactive"); |
|
|
|
|
|
|
|
|
|
glEnable(GL_SCISSOR_TEST); |
|
|
|
|
|
|
|
|
|
while (!closed) |
|
|
|
|
{ |
|
|
|
|
if (iconified != glfwGetWindowParam(window, GLFW_ICONIFIED) || |
|
|
|
|
active != glfwGetWindowParam(window, GLFW_ACTIVE)) |
|
|
|
|
{ |
|
|
|
|
iconified = glfwGetWindowParam(window, GLFW_ICONIFIED); |
|
|
|
|
active = glfwGetWindowParam(window, GLFW_ACTIVE); |
|
|
|
|
|
|
|
|
|
printf("%0.2f %s %s\n", |
|
|
|
|
glfwGetTime(), |
|
|
|
|
iconified ? "Iconified" : "Restored", |
|
|
|
|
active ? "Active" : "Inactive"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
glfwGetWindowSize(window, &width, &height); |
|
|
|
|
|
|
|
|
|
glScissor(0, 0, width, height); |
|
|
|
|