bindKey: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
|parameter1 = int keyCode The key code to bind the event for. | |parameter1 = int keyCode The key code to bind the event for. | ||
|parameter2 = int keyState The key state to bind the event for. | |parameter2 = int keyState The key state to bind the event for. | ||
|parameter3 = function callback The scripting | |parameter3 = function callback The scripting function to call when the event occurs. | ||
|callbackParametersSS = KeyEvent event, Client client | |callbackParametersSS = KeyEvent event, Client client | ||
|callbackParametersCS = KeyEvent event | |callbackParametersCS = KeyEvent event |
Revision as of 20:13, 20 April 2021
Function
Server and Client
Online and Offline
Available since Server 1.0.0, Client 1.0.0
void bindKey(int keyCode, int keyState, function callback)
The bindKey function is used to bind a handler to be called when a specific key is pressed or released.
Parameters
1) | int | keyCode | The key code to bind the event for. |
2) | int | keyState | The key state to bind the event for. |
3) | function | callback | The scripting function to call when the event occurs. |
Return
void | This function doesn't return a value. |
Notes
- See also: KeyEvent Functions.
Examples
Example 1 - JavaScript:
bindKey(SDLK_g, KEYSTATE_DOWN, function(e) {
console.log("g key pressed down.");
})
Compatibility
There isn't any compatibility information for this function.
Related
Server Related
bindKey
unbindAllKeys
unbindKey
Client Related
bindKey
isKeyDown
isScancodePressed
unbindAllKeys
unbindKey