Package bagel
Class Input
java.lang.Object
bagel.Input
This class provides access to input devices (keyboard and mouse).
-
Method Summary
Modifier and TypeMethodDescriptiondirectionToMouse(Point from) Returns a unit vector pointing towards the mouse from the provided point.Returns the mouse position as aPoint.doubleReturns the x coordinate of the mouse cursor.doubleReturns the y coordinate of the mouse cursor.booleanChecks whether the given key is being held down.booleanisDown(MouseButtons button) Checks whether the given mouse button is being held down.booleanChecks whether the given key is not being held down down.booleanisUp(MouseButtons button) Checks whether the given mouse button is not being held down down.booleanwasPressed(Keys key) Checks whether the given key was pressed in the most recent update.booleanwasPressed(MouseButtons button) Checks whether the given mouse button was pressed in the most recent update.booleanwasReleased(Keys key) Checks whether the given key was released in the most recent update.booleanwasReleased(MouseButtons button) Checks whether the given button was released in the most recent update.
-
Method Details
-
directionToMouse
Returns a unit vector pointing towards the mouse from the provided point. -
getMousePosition
Returns the mouse position as aPoint. -
getMouseX
public double getMouseX()Returns the x coordinate of the mouse cursor. -
getMouseY
public double getMouseY()Returns the y coordinate of the mouse cursor. -
wasPressed
Checks whether the given key was pressed in the most recent update.- Parameters:
key- the key to check- Returns:
- whether the key was just pressed by the user
-
isDown
Checks whether the given key is being held down.- Parameters:
key- the key to check- Returns:
- whether the user is holding the key down
-
wasReleased
Checks whether the given key was released in the most recent update.- Parameters:
key- the key to check- Returns:
- whether the key was just released by the user
-
isUp
Checks whether the given key is not being held down down.- Parameters:
key- the key to check- Returns:
- whether the user is not holding the key down
-
wasPressed
Checks whether the given mouse button was pressed in the most recent update.- Parameters:
button- the mouse button to check- Returns:
- whether the mouse button was just pressed by the user
-
isDown
Checks whether the given mouse button is being held down.- Parameters:
button- the mouse button to check- Returns:
- whether the user is holding the mouse button down
-
wasReleased
Checks whether the given button was released in the most recent update.- Parameters:
button- the button to check- Returns:
- whether the button was just released by the user
-
isUp
Checks whether the given mouse button is not being held down down.- Parameters:
button- the mouse button to check- Returns:
- whether the user is not holding the mouse button down
-