Function glfw::init
[−]
[src]
pub fn init<UserData: 'static>(callback: Option<ErrorCallback<UserData>>)
-> Result<Glfw, InitError>
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
Glfw
token will be returned along with aReceiver
from which errors can be intercepted. - Subsequent calls to
init
will returnErr(AlreadyInitialized)
. - If an initialization error occurred within the GLFW library
Err(InternalInitError)
will be returned.