This commit is contained in:
Liav Turkia 2017-07-25 00:42:32 +00:00 committed by GitHub
commit ea65976083
2 changed files with 29 additions and 0 deletions

View File

@ -1554,6 +1554,8 @@ typedef struct GLFWgamepadstate
* Additional calls to this function after successful initialization but before
* termination will return `GLFW_TRUE` immediately.
*
* To check whether GLFW has been initialized, call @ref glfwIsInit.
*
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred.
*
@ -1568,6 +1570,7 @@ typedef struct GLFWgamepadstate
*
* @sa @ref intro_init
* @sa @ref glfwTerminate
* @sa @ref glfwIsInit
*
* @since Added in version 1.0.
*
@ -1575,6 +1578,26 @@ typedef struct GLFWgamepadstate
*/
GLFWAPI int glfwInit(void);
/*! @brief Checks if GLFW has been initialized
*
* This function checks the state of GLFW and returns whether it is initalized.
* Before most GLFW functions, GLFW must be initialized via @ref glfwInit. @ref glfwTerminate
* frees any remaining resources by GLFW and should be called at the end of the application.
*
* @return `GLFW_TRUE` if initialized, `GLFW_FALSE` otherwise
*
* @sa @ref intro_init
* @sa @ref glfwInit
* @sa @ref glfwTerminate
* @since Added in version 3.2.1
*
* @thread_safety This function must only be called from the main thread.
*
* @ingroup init
*/
GLFWAPI int glfwIsInit(void);
/*! @brief Terminates the GLFW library.
*
* This function destroys all remaining windows and cursors, restores any
@ -1600,6 +1623,7 @@ GLFWAPI int glfwInit(void);
*
* @sa @ref intro_init
* @sa @ref glfwInit
* @sa @ref glfwIsInit
*
* @since Added in version 1.0.
*

View File

@ -220,6 +220,11 @@ GLFWAPI int glfwInit(void)
return GLFW_TRUE;
}
GLFWAPI int glfwIsInit(void)
{
return _glfw.initialized;
}
GLFWAPI void glfwTerminate(void)
{
if (!_glfw.initialized)