Package com.csse3200.game.input
Class InputDecorator
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.input.InputComponent
com.csse3200.game.input.InputDecorator
- All Implemented Interfaces:
com.badlogic.gdx.input.GestureDetector.GestureListener
,com.badlogic.gdx.InputProcessor
Generic class to wrap an InputProcessor so that it acts like an InputComponent. This was
initially created to wrap the stage in, but can be used for any class that implements
InputProcessor.
-
Field Summary
Fields inherited from class com.csse3200.game.input.InputComponent
priority
-
Constructor Summary
ConstructorsConstructorDescriptionInputDecorator
(com.badlogic.gdx.InputProcessor inputProcessor, int priority) -
Method Summary
Modifier and TypeMethodDescriptionboolean
keyPressed
(int keycode) An abstract method to be implemented by subclasses for specific key down events.boolean
keyReleased
(int keycode) An abstract method to be implemented by subclasses for specific key down events.boolean
keyTyped
(char character) boolean
mouseMoved
(int screenX, int screenY) boolean
scrolled
(float amountX, float amountY) boolean
touchDown
(int screenX, int screenY, int pointer, int button) boolean
touchDragged
(int screenX, int screenY, int pointer) boolean
touchUp
(int screenX, int screenY, int pointer, int button) Methods inherited from class com.csse3200.game.input.InputComponent
create, dispose, fling, getPriority, isPauseable, keyDown, keyUp, longPress, pan, panStop, pinch, pinchStop, pinchStopHandled, setPriority, tap, touchDown, zoom
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, getPrio, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
InputDecorator
public InputDecorator(com.badlogic.gdx.InputProcessor inputProcessor, int priority)
-
-
Method Details
-
keyPressed
public boolean keyPressed(int keycode) Description copied from class:InputComponent
An abstract method to be implemented by subclasses for specific key down events. This method is called by theInputComponent.keyDown(int)
method.- Specified by:
keyPressed
in classInputComponent
- Parameters:
keycode
- The key code of the key that was pressed.- Returns:
- true if the even was handled, false otherwise
-
keyTyped
public boolean keyTyped(char character) - Specified by:
keyTyped
in interfacecom.badlogic.gdx.InputProcessor
- Overrides:
keyTyped
in classInputComponent
- See Also:
-
keyReleased
public boolean keyReleased(int keycode) Description copied from class:InputComponent
An abstract method to be implemented by subclasses for specific key down events. This method is called by theInputComponent.keyUp(int)
method.- Specified by:
keyReleased
in classInputComponent
- Parameters:
keycode
- The key code of the key that was pressed.- Returns:
- True if the even was handled, false otherwise
-
mouseMoved
public boolean mouseMoved(int screenX, int screenY) - Specified by:
mouseMoved
in interfacecom.badlogic.gdx.InputProcessor
- Overrides:
mouseMoved
in classInputComponent
- See Also:
-
scrolled
public boolean scrolled(float amountX, float amountY) - Specified by:
scrolled
in interfacecom.badlogic.gdx.InputProcessor
- Overrides:
scrolled
in classInputComponent
- See Also:
-
touchDown
public boolean touchDown(int screenX, int screenY, int pointer, int button) - Specified by:
touchDown
in interfacecom.badlogic.gdx.InputProcessor
- Overrides:
touchDown
in classInputComponent
- See Also:
-
touchDragged
public boolean touchDragged(int screenX, int screenY, int pointer) - Specified by:
touchDragged
in interfacecom.badlogic.gdx.InputProcessor
- Overrides:
touchDragged
in classInputComponent
- See Also:
-
touchUp
public boolean touchUp(int screenX, int screenY, int pointer, int button) - Specified by:
touchUp
in interfacecom.badlogic.gdx.InputProcessor
- Overrides:
touchUp
in classInputComponent
- See Also:
-