InputMgr::SetConsoleCallback
Defined in:
Sets the callback function that is invoked when the console key is pressed.
C4Input.h
Prototype
void SetConsoleCallback(KeyCallback *callback, void *cookie = nullptr);
Parameters
callback |
A pointer to the callback function that is invoked when the console key is pressed. |
cookie |
A user-defined value that is passed to the console callback function. |
Description
The SetConsoleCallback
function sets the callback function that is invoked whenever the console 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 console callback function.By default, the engine installs a console callback function that opens the built-in console window.
Before changing the current console callback function with the
SetConsoleCallback
function, the previous console callback function and its cookie can be retrieved by calling the InputMgr::GetConsoleCallback
and InputMgr::GetConsoleCookie
functions. The values returned by these two functions can be saved and later restored by passing them back to the SetConsoleCallback
function.If the
callback
parameter is nullptr
, then any current console callback function is removed, and no new console callback function is installed. In this case, pressing the console key when the keyboard is in game input mode has no effect.The
SetConsoleCallback
function has no effect on whether the console can be opened when the keyboard is in interface event mode. To enable and disable the console in interface event mode, call the InterfaceMgr::EnableConsole
and InterfaceMgr::DisableConsole
functions.
See Also