Modules | Typedefs | Functions
Input handling
Collaboration diagram for Input handling:

Modules

 Keyboard keys
 
 Modifier key flags
 
 Mouse buttons
 
 Joysticks
 
 Standard cursor shapes
 

Typedefs

typedef void(* GLFWcharfun) (GLFWwindow *, unsigned int)
 The function signature for Unicode character callbacks. More...
 
typedef void(* GLFWcharmodsfun) (GLFWwindow *, unsigned int, int)
 The function signature for Unicode character with modifiers callbacks. More...
 
typedef void(* GLFWcursorenterfun) (GLFWwindow *, int)
 The function signature for cursor enter/leave callbacks. More...
 
typedef void(* GLFWcursorposfun) (GLFWwindow *, double, double)
 The function signature for cursor position callbacks. More...
 
typedef void(* GLFWdropfun) (GLFWwindow *, int, const char **)
 The function signature for file drop callbacks. More...
 
typedef void(* GLFWkeyfun) (GLFWwindow *, int, int, int, int)
 The function signature for keyboard key callbacks. More...
 
typedef void(* GLFWmousebuttonfun) (GLFWwindow *, int, int, int)
 The function signature for mouse button callbacks. More...
 
typedef void(* GLFWscrollfun) (GLFWwindow *, double, double)
 The function signature for scroll callbacks. More...
 

Functions

GLFWAPI GLFWcursorglfwCreateCursor (const GLFWimage *image, int xhot, int yhot)
 Creates a custom cursor. More...
 
GLFWAPI GLFWcursorglfwCreateStandardCursor (int shape)
 Creates a cursor with a standard shape. More...
 
GLFWAPI void glfwDestroyCursor (GLFWcursor *cursor)
 Destroys a cursor. More...
 
GLFWAPI const char * glfwGetClipboardString (GLFWwindow *window)
 Returns the contents of the clipboard as a string. More...
 
GLFWAPI void glfwGetCursorPos (GLFWwindow *window, double *xpos, double *ypos)
 Retrieves the position of the cursor relative to the client area of the window. More...
 
GLFWAPI int glfwGetInputMode (GLFWwindow *window, int mode)
 Returns the value of an input option for the specified window. More...
 
GLFWAPI const float * glfwGetJoystickAxes (int joy, int *count)
 Returns the values of all axes of the specified joystick. More...
 
GLFWAPI const unsigned char * glfwGetJoystickButtons (int joy, int *count)
 Returns the state of all buttons of the specified joystick. More...
 
GLFWAPI const char * glfwGetJoystickName (int joy)
 Returns the name of the specified joystick. More...
 
GLFWAPI int glfwGetKey (GLFWwindow *window, int key)
 Returns the last reported state of a keyboard key for the specified window. More...
 
GLFWAPI int glfwGetMouseButton (GLFWwindow *window, int button)
 Returns the last reported state of a mouse button for the specified window. More...
 
GLFWAPI double glfwGetTime (void)
 Returns the value of the GLFW timer. More...
 
GLFWAPI int glfwJoystickPresent (int joy)
 Returns whether the specified joystick is present. More...
 
GLFWAPI GLFWcharfun glfwSetCharCallback (GLFWwindow *window, GLFWcharfun cbfun)
 Sets the Unicode character callback. More...
 
GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback (GLFWwindow *window, GLFWcharmodsfun cbfun)
 Sets the Unicode character with modifiers callback. More...
 
GLFWAPI void glfwSetClipboardString (GLFWwindow *window, const char *string)
 Sets the clipboard to the specified string. More...
 
GLFWAPI void glfwSetCursor (GLFWwindow *window, GLFWcursor *cursor)
 Sets the cursor for the window. More...
 
GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback (GLFWwindow *window, GLFWcursorenterfun cbfun)
 Sets the cursor enter/exit callback. More...
 
GLFWAPI void glfwSetCursorPos (GLFWwindow *window, double xpos, double ypos)
 Sets the position of the cursor, relative to the client area of the window. More...
 
GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback (GLFWwindow *window, GLFWcursorposfun cbfun)
 Sets the cursor position callback. More...
 
GLFWAPI GLFWdropfun glfwSetDropCallback (GLFWwindow *window, GLFWdropfun cbfun)
 Sets the file drop callback. More...
 
GLFWAPI void glfwSetInputMode (GLFWwindow *window, int mode, int value)
 Sets an input option for the specified window. More...
 
GLFWAPI GLFWkeyfun glfwSetKeyCallback (GLFWwindow *window, GLFWkeyfun cbfun)
 Sets the key callback. More...
 
GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback (GLFWwindow *window, GLFWmousebuttonfun cbfun)
 Sets the mouse button callback. More...
 
GLFWAPI GLFWscrollfun glfwSetScrollCallback (GLFWwindow *window, GLFWscrollfun cbfun)
 Sets the scroll callback. More...
 
GLFWAPI void glfwSetTime (double time)
 Sets the GLFW timer. More...
 

Key and button actions

#define GLFW_RELEASE   0
 The key or mouse button was released. More...
 
#define GLFW_PRESS   1
 The key or mouse button was pressed. More...
 
#define GLFW_REPEAT   2
 The key was held down until it repeated. More...
 

Detailed Description

This is the reference documentation for input related functions and types. For more information, see the Input handling.

Macro Definition Documentation

#define GLFW_PRESS   1

The key or mouse button was pressed.

The key or mouse button was pressed.

Definition at line 232 of file glfw3.h.

#define GLFW_RELEASE   0

The key or mouse button was released.

The key or mouse button was released.

Definition at line 225 of file glfw3.h.

#define GLFW_REPEAT   2

The key was held down until it repeated.

The key was held down until it repeated.

Definition at line 239 of file glfw3.h.

Typedef Documentation

typedef void(* GLFWcharfun) (GLFWwindow *, unsigned int)

The function signature for Unicode character callbacks.

This is the function signature for Unicode character callback functions.

Parameters
[in]windowThe window that received the event.
[in]codepointThe Unicode code point of the character.
See also
glfwSetCharCallback

Definition at line 930 of file glfw3.h.

typedef void(* GLFWcharmodsfun) (GLFWwindow *, unsigned int, int)

The function signature for Unicode character with modifiers callbacks.

This is the function signature for Unicode character with modifiers callback functions. It is called for each input character, regardless of what modifier keys are held down.

Parameters
[in]windowThe window that received the event.
[in]codepointThe Unicode code point of the character.
[in]modsBit field describing which modifier keys were held down.
See also
glfwSetCharModsCallback

Definition at line 948 of file glfw3.h.

typedef void(* GLFWcursorenterfun) (GLFWwindow *, int)

The function signature for cursor enter/leave callbacks.

This is the function signature for cursor enter/leave callback functions.

Parameters
[in]windowThe window that received the event.
[in]enteredGL_TRUE if the cursor entered the window's client area, or GL_FALSE if it left it.
See also
glfwSetCursorEnterCallback

Definition at line 886 of file glfw3.h.

typedef void(* GLFWcursorposfun) (GLFWwindow *, double, double)

The function signature for cursor position callbacks.

This is the function signature for cursor position callback functions.

Parameters
[in]windowThe window that received the event.
[in]xposThe new x-coordinate, in screen coordinates, of the cursor.
[in]yposThe new y-coordinate, in screen coordinates, of the cursor.
See also
glfwSetCursorPosCallback

Definition at line 872 of file glfw3.h.

typedef void(* GLFWdropfun) (GLFWwindow *, int, const char **)

The function signature for file drop callbacks.

This is the function signature for file drop callbacks.

Parameters
[in]windowThe window that received the event.
[in]countThe number of dropped files.
[in]pathsThe UTF-8 encoded file and/or directory path names.
See also
glfwSetDropCallback

Definition at line 962 of file glfw3.h.

typedef void(* GLFWkeyfun) (GLFWwindow *, int, int, int, int)

The function signature for keyboard key callbacks.

This is the function signature for keyboard key callback functions.

Parameters
[in]windowThe window that received the event.
[in]keyThe keyboard key that was pressed or released.
[in]scancodeThe system-specific scancode of the key.
[in]actionGLFW_PRESS, GLFW_RELEASE or GLFW_REPEAT.
[in]modsBit field describing which modifier keys were held down.
See also
glfwSetKeyCallback

Definition at line 917 of file glfw3.h.

typedef void(* GLFWmousebuttonfun) (GLFWwindow *, int, int, int)

The function signature for mouse button callbacks.

This is the function signature for mouse button callback functions.

Parameters
[in]windowThe window that received the event.
[in]buttonThe mouse button that was pressed or released.
[in]actionOne of GLFW_PRESS or GLFW_RELEASE.
[in]modsBit field describing which modifier keys were held down.
See also
glfwSetMouseButtonCallback

Definition at line 858 of file glfw3.h.

typedef void(* GLFWscrollfun) (GLFWwindow *, double, double)

The function signature for scroll callbacks.

This is the function signature for scroll callback functions.

Parameters
[in]windowThe window that received the event.
[in]xoffsetThe scroll offset along the x-axis.
[in]yoffsetThe scroll offset along the y-axis.
See also
glfwSetScrollCallback

Definition at line 900 of file glfw3.h.

Function Documentation

GLFWAPI GLFWcursor* glfwCreateCursor ( const GLFWimage image,
int  xhot,
int  yhot 
)

Creates a custom cursor.

Creates a new custom cursor image that can be set for a window with glfwSetCursor. The cursor can be destroyed with glfwDestroyCursor. Any remaining cursors are destroyed by glfwTerminate.

The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel. They are arranged canonically as packed sequential rows, starting from the top-left corner.

The cursor hotspot is specified in pixels, relative to the upper-left corner of the cursor image. Like all other coordinate systems in GLFW, the X-axis points to the right and the Y-axis points down.

Parameters
[in]imageThe desired cursor image.
[in]xhotThe desired x-coordinate, in pixels, of the cursor hotspot.
[in]yhotThe desired y-coordinate, in pixels, of the cursor hotspot.
Returns
The handle of the created cursor, or NULL if an error occurred.
Pointer Lifetime
The specified image data is copied before this function returns.
Reentrancy
This function may not be called from a callback.
Thread Safety
This function may only be called from the main thread.
See also
cursor_object
glfwDestroyCursor
glfwCreateStandardCursor
Since
Added in GLFW 3.1.

Definition at line 362 of file input.c.

GLFWAPI GLFWcursor* glfwCreateStandardCursor ( int  shape)

Creates a cursor with a standard shape.

Returns a cursor with a standard shape, that can be set for a window with glfwSetCursor.

Parameters
[in]shapeOne of the standard shapes.
Returns
A new cursor ready to use or NULL if an error occurred.
Reentrancy
This function may not be called from a callback.
Thread Safety
This function may only be called from the main thread.
See also
cursor_object
glfwCreateCursor
Since
Added in GLFW 3.1.

Definition at line 381 of file input.c.

GLFWAPI void glfwDestroyCursor ( GLFWcursor cursor)

Destroys a cursor.

This function destroys a cursor previously created with glfwCreateCursor. Any remaining cursors will be destroyed by glfwTerminate.

Parameters
[in]cursorThe cursor object to destroy.
Reentrancy
This function may not be called from a callback.
Thread Safety
This function may only be called from the main thread.
See also
cursor_object
glfwCreateCursor
Since
Added in GLFW 3.1.

Definition at line 411 of file input.c.

GLFWAPI const char* glfwGetClipboardString ( GLFWwindow window)

Returns the contents of the clipboard as a string.

This function returns the contents of the system clipboard, if it contains or is convertible to a UTF-8 encoded string. If the clipboard is empty or if its contents cannot be converted, NULL is returned and a GLFW_FORMAT_UNAVAILABLE error is generated.

Parameters
[in]windowThe window that will request the clipboard contents.
Returns
The contents of the clipboard as a UTF-8 encoded string, or NULL if an error occurred.
Pointer Lifetime
The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the next call to glfwGetClipboardString or glfwSetClipboardString, or until the library is terminated.
Thread Safety
This function may only be called from the main thread.
See also
clipboard
glfwSetClipboardString
Since
Added in GLFW 3.0.

Definition at line 589 of file input.c.

GLFWAPI void glfwGetCursorPos ( GLFWwindow window,
double *  xpos,
double *  ypos 
)

Retrieves the position of the cursor relative to the client area of the window.

This function returns the position of the cursor, in screen coordinates, relative to the upper-left corner of the client area of the specified window.

If the cursor is disabled (with GLFW_CURSOR_DISABLED) then the cursor position is unbounded and limited only by the minimum and maximum values of a double.

The coordinate can be converted to their integer equivalents with the floor function. Casting directly to an integer type works for positive coordinates, but fails for negative ones.

Any or all of the position arguments may be NULL. If an error occurs, all non-NULL position arguments will be set to zero.

Parameters
[in]windowThe desired window.
[out]xposWhere to store the cursor x-coordinate, relative to the left edge of the client area, or NULL.
[out]yposWhere to store the cursor y-coordinate, relative to the to top edge of the client area, or NULL.
Thread Safety
This function may only be called from the main thread.
See also
cursor_pos
glfwSetCursorPos
Since
Added in GLFW 3.0. Replaces glfwGetMousePos.

Definition at line 318 of file input.c.

GLFWAPI int glfwGetInputMode ( GLFWwindow window,
int  mode 
)

Returns the value of an input option for the specified window.

This function returns the value of an input option for the specified window. The mode must be one of GLFW_CURSOR, GLFW_STICKY_KEYS or GLFW_STICKY_MOUSE_BUTTONS.

Parameters
[in]windowThe window to query.
[in]modeOne of GLFW_CURSOR, GLFW_STICKY_KEYS or GLFW_STICKY_MOUSE_BUTTONS.
Thread Safety
This function may only be called from the main thread.
See also
glfwSetInputMode
Since
Added in GLFW 3.0.

Definition at line 230 of file input.c.

GLFWAPI const float* glfwGetJoystickAxes ( int  joy,
int count 
)

Returns the values of all axes of the specified joystick.

This function returns the values of all axes of the specified joystick. Each element in the array is a value between -1.0 and 1.0.

Parameters
[in]joyThe joystick to query.
[out]countWhere to store the number of axis values in the returned array. This is set to zero if an error occurred.
Returns
An array of axis values, or NULL if the joystick is not present.
Pointer Lifetime
The returned array is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified joystick is disconnected, this function is called again for that joystick or the library is terminated.
Thread Safety
This function may only be called from the main thread.
See also
joystick_axis
Since
Added in GLFW 3.0. Replaces glfwGetJoystickPos.

Definition at line 539 of file input.c.

GLFWAPI const unsigned char* glfwGetJoystickButtons ( int  joy,
int count 
)

Returns the state of all buttons of the specified joystick.

This function returns the state of all buttons of the specified joystick. Each element in the array is either GLFW_PRESS or GLFW_RELEASE.

Parameters
[in]joyThe joystick to query.
[out]countWhere to store the number of button states in the returned array. This is set to zero if an error occurred.
Returns
An array of button states, or NULL if the joystick is not present.
Pointer Lifetime
The returned array is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified joystick is disconnected, this function is called again for that joystick or the library is terminated.
Thread Safety
This function may only be called from the main thread.
See also
joystick_button
Since
Added in GLFW 2.2.
GLFW 3: Changed to return a dynamic array.

Definition at line 554 of file input.c.

GLFWAPI const char* glfwGetJoystickName ( int  joy)

Returns the name of the specified joystick.

This function returns the name, encoded as UTF-8, of the specified joystick. The returned string is allocated and freed by GLFW. You should not free it yourself.

Parameters
[in]joyThe joystick to query.
Returns
The UTF-8 encoded name of the joystick, or NULL if the joystick is not present.
Pointer Lifetime
The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified joystick is disconnected, this function is called again for that joystick or the library is terminated.
Thread Safety
This function may only be called from the main thread.
See also
joystick_name
Since
Added in GLFW 3.0.

Definition at line 569 of file input.c.

GLFWAPI int glfwGetKey ( GLFWwindow window,
int  key 
)

Returns the last reported state of a keyboard key for the specified window.

This function returns the last state reported for the specified key to the specified window. The returned state is one of GLFW_PRESS or GLFW_RELEASE. The higher-level action GLFW_REPEAT is only reported to the key callback.

If the GLFW_STICKY_KEYS input mode is enabled, this function returns GLFW_PRESS the first time you call it for a key that was pressed, even if that key has already been released.

The key functions deal with physical keys, with key tokens named after their use on the standard US keyboard layout. If you want to input text, use the Unicode character callback instead.

The modifier key bit masks are not key tokens and cannot be used with this function.

Parameters
[in]windowThe desired window.
[in]keyThe desired keyboard key. GLFW_KEY_UNKNOWN is not a valid key for this function.
Returns
One of GLFW_PRESS or GLFW_RELEASE.
Thread Safety
This function may only be called from the main thread.
See also
input_key
Since
Added in GLFW 1.0.
GLFW 3: Added window handle parameter.

Definition at line 273 of file input.c.

GLFWAPI int glfwGetMouseButton ( GLFWwindow window,
int  button 
)

Returns the last reported state of a mouse button for the specified window.

This function returns the last state reported for the specified mouse button to the specified window. The returned state is one of GLFW_PRESS or GLFW_RELEASE.

If the GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function GLFW_PRESS the first time you call it for a mouse button that was pressed, even if that mouse button has already been released.

Parameters
[in]windowThe desired window.
[in]buttonThe desired mouse button.
Returns
One of GLFW_PRESS or GLFW_RELEASE.
Thread Safety
This function may only be called from the main thread.
See also
input_mouse_button
Since
Added in GLFW 1.0.
GLFW 3: Added window handle parameter.

Definition at line 295 of file input.c.

GLFWAPI double glfwGetTime ( void  )

Returns the value of the GLFW timer.

This function returns the value of the GLFW timer. Unless the timer has been set using glfwSetTime, the timer measures time elapsed since GLFW was initialized.

The resolution of the timer is system dependent, but is usually on the order of a few micro- or nanoseconds. It uses the highest-resolution monotonic time source on each supported platform.

Returns
The current value, in seconds, or zero if an error occurred.
Thread Safety
This function may be called from any thread. Access is not synchronized.
See also
time
Since
Added in GLFW 1.0.

Definition at line 596 of file input.c.

GLFWAPI int glfwJoystickPresent ( int  joy)

Returns whether the specified joystick is present.

This function returns whether the specified joystick is present.

Parameters
[in]joyThe joystick to query.
Returns
GL_TRUE if the joystick is present, or GL_FALSE otherwise.
Thread Safety
This function may only be called from the main thread.
See also
joystick
Since
Added in GLFW 3.0. Replaces glfwGetJoystickParam.

Definition at line 526 of file input.c.

GLFWAPI GLFWcharfun glfwSetCharCallback ( GLFWwindow window,
GLFWcharfun  cbfun 
)

Sets the Unicode character callback.

This function sets the character callback of the specified window, which is called when a Unicode character is input.

The character callback is intended for Unicode text input. As it deals with characters, it is keyboard layout dependent, whereas the key callback is not. Characters do not map 1:1 to physical keys, as a key may produce zero, one or more characters. If you want to know whether a specific physical key was pressed or released, see the key callback instead.

The character callback behaves as system text input normally does and will not be called if modifier keys are held down that would prevent normal text input on that platform, for example a Super (Command) key on OS X or Alt key on Windows. There is a character with modifiers callback that receives these events.

Parameters
[in]windowThe window whose callback to set.
[in]cbfunThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Thread Safety
This function may only be called from the main thread.
See also
input_char
Since
Added in GLFW 2.4.
GLFW 3: Added window handle parameter. Updated callback signature.

Definition at line 466 of file input.c.

GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback ( GLFWwindow window,
GLFWcharmodsfun  cbfun 
)

Sets the Unicode character with modifiers callback.

This function sets the character with modifiers callback of the specified window, which is called when a Unicode character is input regardless of what modifier keys are used.

The character with modifiers callback is intended for implementing custom Unicode character input. For regular Unicode text input, see the character callback. Like the character callback, the character with modifiers callback deals with characters and is keyboard layout dependent. Characters do not map 1:1 to physical keys, as a key may produce zero, one or more characters. If you want to know whether a specific physical key was pressed or released, see the key callback instead.

Parameters
[in]windowThe window whose callback to set.
[in]cbfunThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or an error occurred.
Thread Safety
This function may only be called from the main thread.
See also
input_char
Since
Added in GLFW 3.1.

Definition at line 474 of file input.c.

GLFWAPI void glfwSetClipboardString ( GLFWwindow window,
const char *  string 
)

Sets the clipboard to the specified string.

This function sets the system clipboard to the specified, UTF-8 encoded string.

Parameters
[in]windowThe window that will own the clipboard contents.
[in]stringA UTF-8 encoded string.
Pointer Lifetime
The specified string is copied before this function returns.
Thread Safety
This function may only be called from the main thread.
See also
clipboard
glfwGetClipboardString
Since
Added in GLFW 3.0.

Definition at line 582 of file input.c.

GLFWAPI void glfwSetCursor ( GLFWwindow window,
GLFWcursor cursor 
)

Sets the cursor for the window.

This function sets the cursor image to be used when the cursor is over the client area of the specified window. The set cursor will only be visible when the cursor mode of the window is GLFW_CURSOR_NORMAL.

On some platforms, the set cursor may not be visible unless the window also has input focus.

Parameters
[in]windowThe window to set the cursor for.
[in]cursorThe cursor to set, or NULL to switch back to the default arrow cursor.
Thread Safety
This function may only be called from the main thread.
See also
cursor_object
Since
Added in GLFW 3.1.

Definition at line 446 of file input.c.

GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback ( GLFWwindow window,
GLFWcursorenterfun  cbfun 
)

Sets the cursor enter/exit callback.

This function sets the cursor boundary crossing callback of the specified window, which is called when the cursor enters or leaves the client area of the window.

Parameters
[in]windowThe window whose callback to set.
[in]cbfunThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Thread Safety
This function may only be called from the main thread.
See also
cursor_enter
Since
Added in GLFW 3.0.

Definition at line 500 of file input.c.

GLFWAPI void glfwSetCursorPos ( GLFWwindow window,
double  xpos,
double  ypos 
)

Sets the position of the cursor, relative to the client area of the window.

This function sets the position, in screen coordinates, of the cursor relative to the upper-left corner of the client area of the specified window. The window must have input focus. If the window does not have input focus when this function is called, it fails silently.

Do not use this function to implement things like camera controls. GLFW already provides the GLFW_CURSOR_DISABLED cursor mode that hides the cursor, transparently re-centers it and provides unconstrained cursor motion. See glfwSetInputMode for more information.

If the cursor mode is GLFW_CURSOR_DISABLED then the cursor position is unconstrained and limited only by the minimum and maximum values of a double.

Parameters
[in]windowThe desired window.
[in]xposThe desired x-coordinate, relative to the left edge of the client area.
[in]yposThe desired y-coordinate, relative to the top edge of the client area.
Remarks
X11: Due to the asynchronous nature of X11, it may take a moment for the window focus event to arrive. This means you may not be able to set the cursor position directly after window creation.
Thread Safety
This function may only be called from the main thread.
See also
cursor_pos
glfwGetCursorPos
Since
Added in GLFW 3.0. Replaces glfwSetMousePos.

Definition at line 340 of file input.c.

GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback ( GLFWwindow window,
GLFWcursorposfun  cbfun 
)

Sets the cursor position callback.

This function sets the cursor position callback of the specified window, which is called when the cursor is moved. The callback is provided with the position, in screen coordinates, relative to the upper-left corner of the client area of the window.

Parameters
[in]windowThe window whose callback to set.
[in]cbfunThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Thread Safety
This function may only be called from the main thread.
See also
cursor_pos
Since
Added in GLFW 3.0. Replaces glfwSetMousePosCallback.

Definition at line 491 of file input.c.

GLFWAPI GLFWdropfun glfwSetDropCallback ( GLFWwindow window,
GLFWdropfun  cbfun 
)

Sets the file drop callback.

This function sets the file drop callback of the specified window, which is called when one or more dragged files are dropped on the window.

Because the path array and its strings may have been generated specifically for that event, they are not guaranteed to be valid after the callback has returned. If you wish to use them after the callback returns, you need to make a deep copy.

Parameters
[in]windowThe window whose callback to set.
[in]cbfunThe new file drop callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Thread Safety
This function may only be called from the main thread.
See also
path_drop
Since
Added in GLFW 3.1.

Definition at line 518 of file input.c.

GLFWAPI void glfwSetInputMode ( GLFWwindow window,
int  mode,
int  value 
)

Sets an input option for the specified window.

This function sets an input mode option for the specified window. The mode must be one of GLFW_CURSOR, GLFW_STICKY_KEYS or GLFW_STICKY_MOUSE_BUTTONS.

If the mode is GLFW_CURSOR, the value must be one of the following cursor modes:

  • GLFW_CURSOR_NORMAL makes the cursor visible and behaving normally.
  • GLFW_CURSOR_HIDDEN makes the cursor invisible when it is over the client area of the window but does not restrict the cursor from leaving.
  • GLFW_CURSOR_DISABLED hides and grabs the cursor, providing virtual and unlimited cursor movement. This is useful for implementing for example 3D camera controls.

If the mode is GLFW_STICKY_KEYS, the value must be either GL_TRUE to enable sticky keys, or GL_FALSE to disable it. If sticky keys are enabled, a key press will ensure that glfwGetKey returns GLFW_PRESS the next time it is called even if the key had been released before the call. This is useful when you are only interested in whether keys have been pressed but not when or in which order.

If the mode is GLFW_STICKY_MOUSE_BUTTONS, the value must be either GL_TRUE to enable sticky mouse buttons, or GL_FALSE to disable it. If sticky mouse buttons are enabled, a mouse button press will ensure that glfwGetMouseButton returns GLFW_PRESS the next time it is called even if the mouse button had been released before the call. This is useful when you are only interested in whether mouse buttons have been pressed but not when or in which order.

Parameters
[in]windowThe window whose input mode to set.
[in]modeOne of GLFW_CURSOR, GLFW_STICKY_KEYS or GLFW_STICKY_MOUSE_BUTTONS.
[in]valueThe new value of the specified input mode.
Thread Safety
This function may only be called from the main thread.
See also
glfwGetInputMode
Since
Added in GLFW 3.0. Replaces glfwEnable and glfwDisable.

Definition at line 250 of file input.c.

GLFWAPI GLFWkeyfun glfwSetKeyCallback ( GLFWwindow window,
GLFWkeyfun  cbfun 
)

Sets the key callback.

This function sets the key callback of the specified window, which is called when a key is pressed, repeated or released.

The key functions deal with physical keys, with layout independent key tokens named after their values in the standard US keyboard layout. If you want to input text, use the character callback instead.

When a window loses input focus, it will generate synthetic key release events for all pressed keys. You can tell these events from user-generated events by the fact that the synthetic ones are generated after the focus loss event has been processed, i.e. after the window focus callback has been called.

The scancode of a key is specific to that platform or sometimes even to that machine. Scancodes are intended to allow users to bind keys that don't have a GLFW key token. Such keys have key set to GLFW_KEY_UNKNOWN, their state is not saved and so it cannot be queried with glfwGetKey.

Sometimes GLFW needs to generate synthetic key events, in which case the scancode may be zero.

Parameters
[in]windowThe window whose callback to set.
[in]cbfunThe new key callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Thread Safety
This function may only be called from the main thread.
See also
input_key
Since
Added in GLFW 1.0.
GLFW 3: Added window handle parameter. Updated callback signature.

Definition at line 458 of file input.c.

GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback ( GLFWwindow window,
GLFWmousebuttonfun  cbfun 
)

Sets the mouse button callback.

This function sets the mouse button callback of the specified window, which is called when a mouse button is pressed or released.

When a window loses input focus, it will generate synthetic mouse button release events for all pressed mouse buttons. You can tell these events from user-generated events by the fact that the synthetic ones are generated after the focus loss event has been processed, i.e. after the window focus callback has been called.

Parameters
[in]windowThe window whose callback to set.
[in]cbfunThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Thread Safety
This function may only be called from the main thread.
See also
input_mouse_button
Since
Added in GLFW 1.0.
GLFW 3: Added window handle parameter. Updated callback signature.

Definition at line 482 of file input.c.

GLFWAPI GLFWscrollfun glfwSetScrollCallback ( GLFWwindow window,
GLFWscrollfun  cbfun 
)

Sets the scroll callback.

This function sets the scroll callback of the specified window, which is called when a scrolling device is used, such as a mouse wheel or scrolling area of a touchpad.

The scroll callback receives all scrolling input, like that from a mouse wheel or a touchpad scrolling area.

Parameters
[in]windowThe window whose callback to set.
[in]cbfunThe new scroll callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Thread Safety
This function may only be called from the main thread.
See also
scrolling
Since
Added in GLFW 3.0. Replaces glfwSetMouseWheelCallback.

Definition at line 509 of file input.c.

GLFWAPI void glfwSetTime ( double  time)

Sets the GLFW timer.

This function sets the value of the GLFW timer. It then continues to count up from that value. The value must be a positive finite number less than or equal to 18446744073.0, which is approximately 584.5 years.

Parameters
[in]timeThe new value, in seconds.
Remarks
The upper limit of the timer is calculated as floor((264 - 1) / 109) and is due to implementations storing nanoseconds in 64 bits. The limit may be increased in the future.
Thread Safety
This function may only be called from the main thread.
See also
time
Since
Added in GLFW 2.2.

Definition at line 602 of file input.c.



librealsense
Author(s): Sergey Dorodnicov , Mark Horn , Reagan Lopez
autogenerated on Fri Mar 13 2020 03:16:19