LS.Input Class
Input is a static class used to read the input state (keyboard, mouse, gamepad, etc)
Constructor
LS.Input
()
Item Index
Methods
getGamepad
-
index
Returns a gamepad snapshot if it is connected
Parameters:
-
indexNumberthe index of the gamepad
Returns:
gamepad snapshot with all the info
getGamepadAxis
-
index -
name -
raw
Returns a gamepad snapshot if it is connected
Parameters:
-
indexNumberthe index of the gamepad
-
nameStringthe name of the axis (also you could specify the number)
-
rawBoolean[optional] if you want the data unfiltered
Returns:
axis value from -1 to 1
isGamepadButtonPressed
-
index -
name
Returns if the given button of the specified gamepad is pressed
Parameters:
-
indexNumberthe index of the gamepad
-
nameStringthe name of the button "A","B","X","Y","LB","RB","BACK","START","LS","RS" (also you could specify the number)
Returns:
if the button is pressed
isMouseButtonPressed
-
name
Returns if the given mouse button is pressed
Parameters:
-
nameStringthe name of the button "LEFT","MIDDLE,"RIGHT" (also you could specify the number)
Returns:
if the button is pressed
isMouseInRect
-
x -
y -
width -
height -
flip
returns if the mouse is inside the rect defined by x,y, width,height
Parameters:
-
xNumberx coordinate of the mouse in canvas coordinates
-
yNumbery coordinate of the mouse in canvas coordinates (0 is bottom)
-
widthNumberrectangle width in pixels
-
heightNumberrectangle height in pixels
-
flipBoolean[optional] if you want to flip the y coordinate
