Class TouchPlayerInputComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.input.InputComponent
com.csse3200.game.components.player.TouchPlayerInputComponent
- All Implemented Interfaces:
com.badlogic.gdx.input.GestureDetector.GestureListener
,com.badlogic.gdx.InputProcessor
Input handler for the player for keyboard and touch (mouse) input.
This input handler uses keyboard and touch input.
-
Field Summary
Fields inherited from class com.csse3200.game.input.InputComponent
priority
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
keyPressed
(int keycode) Triggers player events on specific keycodes.boolean
keyReleased
(int keycode) Triggers player events on specific keycodes.boolean
touchDown
(int screenX, int screenY, int pointer, int button) Triggers the player attack.Methods inherited from class com.csse3200.game.input.InputComponent
create, dispose, fling, getPriority, isPauseable, keyDown, keyTyped, keyUp, longPress, mouseMoved, pan, panStop, pinch, pinchStop, pinchStopHandled, scrolled, setPriority, tap, touchDown, touchDragged, touchUp, zoom
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, getPrio, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
TouchPlayerInputComponent
public TouchPlayerInputComponent()
-
-
Method Details
-
keyPressed
public boolean keyPressed(int keycode) Triggers player events on specific keycodes.- Specified by:
keyPressed
in classInputComponent
- Parameters:
keycode
- The key code of the key that was pressed.- Returns:
- whether the input was processed
- See Also:
-
keyReleased
public boolean keyReleased(int keycode) Triggers player events on specific keycodes.- Specified by:
keyReleased
in classInputComponent
- Parameters:
keycode
- The key code of the key that was pressed.- Returns:
- whether the input was processed
- See Also:
-
touchDown
public boolean touchDown(int screenX, int screenY, int pointer, int button) Triggers the player attack.- Specified by:
touchDown
in interfacecom.badlogic.gdx.InputProcessor
- Overrides:
touchDown
in classInputComponent
- Returns:
- whether the input was processed
- See Also:
-