InputMgr::SetEscapeCallback
Defined in:
Sets the callback function that is invoked when the escape key is pressed.
C4Input.h
Prototype
void SetEscapeCallback(KeyCallback *callback, void *cookie = nullptr);
Parameters
callback |
A pointer to the callback function that is invoked when the escape key is pressed. |
cookie |
A user-defined value that is passed to the escape callback function. |
Description
The SetEscapeCallback
function sets the callback function that is invoked whenever the escape key is pressed and the keyboard is in game input mode to that given by the callback
parameter. The cookie
parameter specifies a user-defined value that is passed through to the escape callback function.By default, there is no escape callback function installed, and no action is taken when the user presses the escape key.
Before changing the current escape callback function with the
SetEscapeCallback
function, the previous escape callback function and its cookie can be retrieved by calling the InputMgr::GetEscapeCallback
and InputMgr::GetEscapeCookie
functions. The values returned by these two functions can be saved and later restored by passing them back to the SetEscapeCallback
function.If the
callback
parameter is nullptr
, then any current escape callback function is removed, and no new escape callback function is installed. In this case, pressing the escape key when the keyboard is in game input mode has no effect.The escape callback function is not called when the keyboard is in interface event mode. In this case, a keyboard event with the key code
kKeyCodeEscape
is generated.
See Also