Replaced automatic closing with window parameter.

This commit is contained in:
Camilla Berglund
2012-08-10 13:31:15 +02:00
parent 2212cd94bf
commit 2410e2aaf4
21 changed files with 53 additions and 112 deletions
+4 -15
View File
@@ -89,7 +89,6 @@ DRAW_BALL_ENUM drawBallHow;
double t;
double t_old = 0.f;
double dt;
static GLboolean running = GL_TRUE;
/* Random number generator */
#ifndef RAND_MAX
@@ -246,16 +245,6 @@ void reshape( GLFWwindow window, int w, int h )
}
/*****************************************************************************
* Window close callback
*****************************************************************************/
static int window_close_callback(GLFWwindow window)
{
running = GL_FALSE;
return GL_TRUE;
}
/*****************************************************************************
* Draw the Boing ball.
*
@@ -588,7 +577,6 @@ int main( void )
exit( EXIT_FAILURE );
}
glfwSetWindowCloseCallback( window_close_callback );
glfwSetWindowSizeCallback( reshape );
glfwWindowHint(GLFW_DEPTH_BITS, 16);
@@ -611,7 +599,7 @@ int main( void )
init();
/* Main loop */
do
for (;;)
{
/* Timing */
t = glfwGetTime();
@@ -627,9 +615,10 @@ int main( void )
/* Check if we are still running */
if (glfwGetKey( window, GLFW_KEY_ESCAPE ))
running = GL_FALSE;
break;
if (glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))
break;
}
while( running );
glfwTerminate();
exit( EXIT_SUCCESS );