Function glfw::init [−][src]
pub fn init<UserData: 'static>(
callback: Option<ErrorCallback<UserData>>
) -> Result<Glfw, InitError>
Expand description
Initializes the GLFW library. This must be called on the main platform thread.
Wrapper for glfwInit.
Error callback
An error callback can be set if desired. This allows for the handling of any
errors that occur during initialization. This can subsequently be changed
using the Glfw::set_error_callback function.
Example
extern crate glfw; fn main() { let glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap(); }
Returns
- If initialization was successful a
Glfwtoken will be returned along with aReceiverfrom which errors can be intercepted. - Subsequent calls to
initwill returnGlfwtoken immediately. - If an initialization error occurred within the GLFW library
Err(InternalInitError)will be returned.