selene.input
Provides input handling functionality for keyboard and mouse events.
| Property | Type | Description |
|---|---|---|
KEYBOARD | InputType | |
MOUSE | InputType |
| Function |
|---|
BindContinuousAction(type: InputType, input: string, callback: function()) |
Binds a function to be called continuously while an input is held down.
The function is called every frame while the input is active. |
BindAction(KEYBOARD: InputType, input: string, callback: function())BindAction(MOUSE: InputType, input: string, callback: function(screenX: number, screenY: number)) |
Binds a function to be called when an input event occurs.
For type KEYBOARD: called on key press.
For type MOUSE: called on click with coordinates. |
BindPressAction(KEYBOARD: InputType, input: string, callback: function())BindPressAction(MOUSE: InputType, input: string, callback: function(screenX: number, screenY: number)) |
Binds a function to be called when an input is first pressed down.
Triggers only once per press, not continuously. |
BindReleaseAction(KEYBOARD: InputType, input: string, callback: function())BindReleaseAction(MOUSE: InputType, input: string, callback: function(screenX: number, screenY: number)) |
Binds a function to be called when an input is released.
Triggers when the key/button is let go. |
IsKeyPressed(key: string): boolean |
Checks if a keyboard key is currently pressed. |
IsMousePressed(button: string): boolean |
Checks if a mouse button is currently pressed. |
GetMousePosition(): number, number |
Returns the current mouse position in screen coordinates. |