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:
-
index
Numberthe index of the gamepad
Returns:
gamepad snapshot with all the info
getGamepadAxis
-
index
-
name
-
raw
Returns a gamepad snapshot if it is connected
Parameters:
-
index
Numberthe index of the gamepad
-
name
Stringthe name of the axis (also you could specify the number)
-
raw
Boolean[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:
-
index
Numberthe index of the gamepad
-
name
Stringthe 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:
-
name
Stringthe 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:
-
x
Numberx coordinate of the mouse in canvas coordinates
-
y
Numbery coordinate of the mouse in canvas coordinates (0 is bottom)
-
width
Numberrectangle width in pixels
-
height
Numberrectangle height in pixels
-
flip
Boolean[optional] if you want to flip the y coordinate