mirror of
https://github.com/glfw/glfw.git
synced 2026-09-21 16:44:11 +00:00
Replaced automatic closing with window parameter.
This commit is contained in:
+4
-15
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user