Added glfwIsInit()

This commit is contained in:
liavt 2017-07-24 10:42:42 -05:00
parent 00d2efb9ab
commit 332d96ac61
2 changed files with 27 additions and 0 deletions

View File

@ -1553,6 +1553,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 initializd, 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,24 @@ 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
*
* @ingroup init
*/
GLFWAPI GLFWbool glfwIsInit(void);
/*! @brief Terminates the GLFW library.
*
* This function destroys all remaining windows and cursors, restores any
@ -1600,6 +1621,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 GLFWbool glfwIsInit(void)
{
return _glfw.initialized;
}
GLFWAPI void glfwTerminate(void)
{
if (!_glfw.initialized)