Class KeyboardPlayerInputComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.input.InputComponent
com.csse3200.game.components.player.KeyboardPlayerInputComponent
- All Implemented Interfaces:
com.badlogic.gdx.input.GestureDetector.GestureListener
,com.badlogic.gdx.InputProcessor
,com.badlogic.gdx.utils.Json.Serializable
Input handler for the player for keyboard and touch (mouse) input.
This input handler only uses keyboard input.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class com.csse3200.game.input.InputComponent
priority
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
static boolean
Shows whether the plant info window is currently being displayedcom.badlogic.gdx.math.Vector2
static void
boolean
keyDown
(int keycode) Triggers player events on specific keycodes.boolean
keyUp
(int keycode) Triggers player events on specific keycodes.void
setActions
(PlayerActions actions) static void
setCurrentMenu
(Boolean opened, KeyboardPlayerInputComponent.MenuTypes menu) void
setWalkDirection
(com.badlogic.gdx.math.Vector2 direction) boolean
touchUp
(int screenX, int screenY, int pointer, int button) void
triggerHotKeySelection
(int index) Sets the players current held item to that in the provided index of the inventoryvoid
Methods inherited from class com.csse3200.game.input.InputComponent
create, dispose, fling, getPriority, keyTyped, longPress, mouseMoved, pan, panStop, pinch, pinchStop, pinchStopHandled, scrolled, setPriority, tap, touchDown, touchDown, touchDragged, zoom
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update, write
-
Constructor Details
-
KeyboardPlayerInputComponent
public KeyboardPlayerInputComponent()
-
-
Method Details
-
incrementPauseCounter
public static void incrementPauseCounter() -
setCurrentMenu
-
clearMenuOpening
public static void clearMenuOpening() -
getShowPlantInfoUI
public static boolean getShowPlantInfoUI()Shows whether the plant info window is currently being displayed- Returns:
- boolean that represents whether plant info was being shown
-
keyDown
public boolean keyDown(int keycode) Triggers player events on specific keycodes.- Specified by:
keyDown
in interfacecom.badlogic.gdx.InputProcessor
- Overrides:
keyDown
in classInputComponent
- Returns:
- whether the input was processed
- See Also:
-
InputProcessor.keyDown(int)
-
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:
-
InputProcessor.touchUp(int, int, int, int)
-
keyUp
public boolean keyUp(int keycode) Triggers player events on specific keycodes.- Specified by:
keyUp
in interfacecom.badlogic.gdx.InputProcessor
- Overrides:
keyUp
in classInputComponent
- Returns:
- whether the input was processed
- See Also:
-
InputProcessor.keyUp(int)
-
setActions
-
getWalkDirection
public com.badlogic.gdx.math.Vector2 getWalkDirection() -
setWalkDirection
public void setWalkDirection(com.badlogic.gdx.math.Vector2 direction) -
triggerHotKeySelection
public void triggerHotKeySelection(int index) Sets the players current held item to that in the provided index of the inventory- Parameters:
index
- of the item the user wants to be holding
-
triggerSwitchToolbar
public void triggerSwitchToolbar()
-