Package mindustry.input
Class InputHandler
java.lang.Object
mindustry.input.InputHandler
- All Implemented Interfaces:
GestureDetector.GestureListener
,InputProcessor
- Direct Known Subclasses:
DesktopInput
,MobileInput
public abstract class InputHandler
extends Object
implements InputProcessor, GestureDetector.GestureListener
-
Field Summary
Modifier and TypeFieldDescriptionboolean
Seq<mindustry.gen.Building>
boolean
boolean
float
float
final BlockConfigFragment
boolean
If any of these functions return true, input is locked.final BlockInventoryFragment
boolean
mindustry.input.InputHandler.PlaceLine
float
boolean
If true, there is a cutscene currently occurring in logic.float
boolean
float
int
Seq<mindustry.gen.Unit>
boolean
boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add()
void
Adds an input lock; if this function returns true, input is locked.allPlans()
void
breakBlock
(int x, int y) static void
buildingControlSelect
(mindustry.gen.Player player, mindustry.gen.Building build) void
buildPlacementUI
(Table table) void
boolean
boolean
canShoot()
void
static void
clearItems
(mindustry.gen.Building build) static void
commandBuilding
(mindustry.gen.Player player, int[] buildings, Vec2 target) void
commandTap
(float screenX, float screenY) static void
commandUnits
(mindustry.gen.Player player, int[] unitIds, mindustry.gen.Building buildTarget, mindustry.gen.Unit unitTarget, Vec2 posTarget) static void
createItemTransfer
(Item item, int amount, float x, float y, Position to, Runnable done) static void
deletePlans
(mindustry.gen.Player player, int[] positions) void
void
void
void
drawBreaking
(int x, int y) void
drawBreaking
(BuildPlan plan) protected void
drawBreakSelection
(int x1, int y1, int x2, int y2) protected void
drawBreakSelection
(int x1, int y1, int x2, int y2, int maxLength) void
drawCommand
(mindustry.gen.Unit sel) void
void
drawOverlapCheck
(Block block, int cursorX, int cursorY, boolean valid) protected void
drawOverPlan
(BuildPlan plan) protected void
drawOverPlan
(BuildPlan plan, boolean valid) void
protected void
Draws a placement icon for a specific block.protected void
protected void
protected void
drawRebuildSelection
(int x, int y, int x2, int y2) void
drawSelected
(int x, int y, Block block, Color color) protected void
drawSelection
(int x1, int y1, int x2, int y2, int maxLength) protected void
drawSelection
(int x1, int y1, int x2, int y2, int maxLength, Color col1, Color col2) void
drawTop()
static void
dropItem
(mindustry.gen.Player player, float angle) void
protected void
flushPlans
(Seq<BuildPlan> plans) protected void
flushPlansReverse
(Seq<BuildPlan> plans) protected void
flushSelectPlans
(Seq<BuildPlan> plans) float
float
protected BuildPlan
getPlan
(int x, int y) protected BuildPlan
Returns the selection plan that overlaps this position, or null.boolean
boolean
boolean
boolean
boolean
boolean
locked()
float
mouseAngle
(float x, float y) boolean
boolean
void
Forces the camera to a position and enables panning on desktop.static void
payloadDropped
(mindustry.gen.Unit unit, float x, float y) static void
pickedBuildPayload
(mindustry.gen.Unit unit, mindustry.gen.Building build, boolean onGround) static void
pickedUnitPayload
(mindustry.gen.Unit unit, mindustry.gen.Unit target) boolean
planMatches
(BuildPlan plan) void
rebuildArea
(int x, int y, int x2, int y2) void
remove()
static void
removeQueueBlock
(int x, int y, boolean breaking) protected void
removeSelection
(int x1, int y1, int x2, int y2) Remove everything from the queue in a selection.protected void
removeSelection
(int x1, int y1, int x2, int y2, boolean flush) Remove everything from the queue in a selection.protected void
removeSelection
(int x1, int y1, int x2, int y2, boolean flush, int maxLength) Remove everything from the queue in a selection.protected void
removeSelection
(int x1, int y1, int x2, int y2, int maxLength) Remove everything from the queue in a selection.static void
requestBuildPayload
(mindustry.gen.Player player, mindustry.gen.Building build) static void
requestDropPayload
(mindustry.gen.Player player, float x, float y) static void
requestItem
(mindustry.gen.Player player, mindustry.gen.Building build, Item item, int amount) static void
requestUnitPayload
(mindustry.gen.Player player, mindustry.gen.Unit target) static void
rotateBlock
(mindustry.gen.Player player, mindustry.gen.Building build, boolean direction) void
rotatePlans
(Seq<BuildPlan> plans, int direction) protected int
protected int
boolean
mindustry.gen.Unit
selectedCommandUnit
(float x, float y) Seq<mindustry.gen.Unit>
selectedCommandUnits
(float x, float y, float w, float h) Seq<mindustry.gen.Unit>
selectedCommandUnits
(float x, float y, float w, float h, Boolf<mindustry.gen.Unit> predicate) mindustry.gen.Building
mindustry.gen.Unit
selectedEnemyUnit
(float x, float y) mindustry.gen.Unit
void
void
static void
static void
setUnitCommand
(mindustry.gen.Player player, int[] unitIds, UnitCommand command) protected void
static void
void
static void
tileConfig
(mindustry.gen.Player player, mindustry.gen.Building build, Object value) static void
static void
transferInventory
(mindustry.gen.Player player, mindustry.gen.Building build) static void
transferItemEffect
(Item item, float x, float y, mindustry.gen.Itemsc to) static void
transferItemTo
(mindustry.gen.Unit unit, Item item, int amount, float x, float y, mindustry.gen.Building build) static void
transferItemToUnit
(Item item, float x, float y, mindustry.gen.Itemsc to) void
tryBreakBlock
(int x, int y) void
tryDropItems
(mindustry.gen.Building build, float x, float y) void
void
static void
unitBuildingControlSelect
(mindustry.gen.Unit unit, mindustry.gen.Building build) static void
unitClear
(mindustry.gen.Player player) static void
unitControl
(mindustry.gen.Player player, mindustry.gen.Unit unit) void
update()
protected void
updateLine
(int x1, int y1) protected void
updateLine
(int x1, int y1, int x2, int y2) void
void
useSchematic
(Schematic schem) boolean
validBreak
(int x, int y) boolean
validPlace
(int x, int y, Block type, int rotation) boolean
validPlace
(int x, int y, Block type, int rotation, BuildPlan ignore) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface arc.input.GestureDetector.GestureListener
fling, longPress, pan, panStop, pinch, pinchStop, tap, touchDown, zoom
Methods inherited from interface arc.input.InputProcessor
connected, disconnected, keyDown, keyTyped, keyUp, mouseMoved, scrolled, touchDown, touchDragged, touchUp
-
Field Details
-
logicCutscene
public boolean logicCutsceneIf true, there is a cutscene currently occurring in logic. -
logicCamPan
-
logicCamSpeed
public float logicCamSpeed -
logicCutsceneZoom
public float logicCutsceneZoom -
inputLocks
If any of these functions return true, input is locked. -
controlInterval
-
block
-
overrideLineRotation
public boolean overrideLineRotation -
rotation
public int rotation -
droppingItem
public boolean droppingItem -
uiGroup
-
isBuilding
public boolean isBuilding -
buildWasAutoPaused
public boolean buildWasAutoPaused -
wasShooting
public boolean wasShooting -
controlledType
-
recentRespawnTimer
public float recentRespawnTimer -
lastSchematic
-
detector
-
line
public mindustry.input.InputHandler.PlaceLine line -
resultplan
-
bplan
-
linePlans
-
selectPlans
-
selectedUnits
-
commandBuildings
-
commandMode
public boolean commandMode -
commandRect
public boolean commandRect -
tappedOne
public boolean tappedOne -
commandRectX
public float commandRectX -
commandRectY
public float commandRectY -
inv
-
config
-
-
Constructor Details
-
InputHandler
public InputHandler()
-
-
Method Details
-
transferItemEffect
-
takeItems
public static void takeItems(mindustry.gen.Building build, Item item, int amount, mindustry.gen.Unit to) -
transferItemToUnit
-
setItem
-
clearItems
public static void clearItems(mindustry.gen.Building build) -
transferItemTo
-
deletePlans
public static void deletePlans(mindustry.gen.Player player, int[] positions) -
createItemTransfer
-
commandUnits
-
setUnitCommand
-
commandBuilding
-
requestItem
public static void requestItem(mindustry.gen.Player player, mindustry.gen.Building build, Item item, int amount) -
transferInventory
public static void transferInventory(mindustry.gen.Player player, mindustry.gen.Building build) -
removeQueueBlock
public static void removeQueueBlock(int x, int y, boolean breaking) -
requestUnitPayload
public static void requestUnitPayload(mindustry.gen.Player player, mindustry.gen.Unit target) -
requestBuildPayload
public static void requestBuildPayload(mindustry.gen.Player player, mindustry.gen.Building build) -
pickedUnitPayload
public static void pickedUnitPayload(mindustry.gen.Unit unit, mindustry.gen.Unit target) -
pickedBuildPayload
public static void pickedBuildPayload(mindustry.gen.Unit unit, mindustry.gen.Building build, boolean onGround) -
requestDropPayload
public static void requestDropPayload(mindustry.gen.Player player, float x, float y) -
payloadDropped
public static void payloadDropped(mindustry.gen.Unit unit, float x, float y) -
dropItem
public static void dropItem(mindustry.gen.Player player, float angle) -
rotateBlock
public static void rotateBlock(@Nullable mindustry.gen.Player player, mindustry.gen.Building build, boolean direction) -
tileConfig
-
tileTap
-
buildingControlSelect
public static void buildingControlSelect(mindustry.gen.Player player, mindustry.gen.Building build) -
unitBuildingControlSelect
public static void unitBuildingControlSelect(mindustry.gen.Unit unit, mindustry.gen.Building build) -
unitControl
-
unitClear
public static void unitClear(mindustry.gen.Player player) -
addLock
Adds an input lock; if this function returns true, input is locked. Used for mod 'cutscenes' or custom camera panning. -
locked
public boolean locked()- Returns:
- whether most input is locked, for 'cutscenes'
-
allPlans
-
isUsingSchematic
public boolean isUsingSchematic() -
update
public void update() -
checkUnit
public void checkUnit() -
tryPickupPayload
public void tryPickupPayload() -
tryDropPayload
public void tryDropPayload() -
getMouseX
public float getMouseX() -
getMouseY
public float getMouseY() -
buildPlacementUI
-
buildUI
-
updateState
public void updateState() -
multiUnitSelect
public boolean multiUnitSelect() -
selectUnitsRect
public void selectUnitsRect() -
selectTypedUnits
public void selectTypedUnits() -
tapCommandUnit
public void tapCommandUnit() -
commandTap
public void commandTap(float screenX, float screenY) -
drawCommand
public void drawCommand(mindustry.gen.Unit sel) -
drawCommanded
public void drawCommanded() -
drawBottom
public void drawBottom() -
drawTop
public void drawTop() -
drawOverSelect
public void drawOverSelect() -
drawSelected
-
drawBreaking
-
drawOverlapCheck
-
planMatches
-
drawBreaking
public void drawBreaking(int x, int y) -
useSchematic
-
showSchematicSave
protected void showSchematicSave() -
rotatePlans
-
flipPlans
-
schemOriginX
protected int schemOriginX() -
schemOriginY
protected int schemOriginY() -
getPlan
- Returns:
- the selection plan that overlaps this position, or null.
-
getPlan
Returns the selection plan that overlaps this position, or null. -
drawBreakSelection
protected void drawBreakSelection(int x1, int y1, int x2, int y2, int maxLength) -
drawRebuildSelection
protected void drawRebuildSelection(int x, int y, int x2, int y2) -
drawBreakSelection
protected void drawBreakSelection(int x1, int y1, int x2, int y2) -
drawSelection
protected void drawSelection(int x1, int y1, int x2, int y2, int maxLength) -
drawSelection
-
flushSelectPlans
-
flushPlansReverse
-
flushPlans
-
drawOverPlan
-
drawOverPlan
-
drawPlan
-
drawPlan
-
drawPlan
Draws a placement icon for a specific block. -
removeSelection
protected void removeSelection(int x1, int y1, int x2, int y2) Remove everything from the queue in a selection. -
removeSelection
protected void removeSelection(int x1, int y1, int x2, int y2, int maxLength) Remove everything from the queue in a selection. -
removeSelection
protected void removeSelection(int x1, int y1, int x2, int y2, boolean flush) Remove everything from the queue in a selection. -
removeSelection
protected void removeSelection(int x1, int y1, int x2, int y2, boolean flush, int maxLength) Remove everything from the queue in a selection. -
updateLine
protected void updateLine(int x1, int y1, int x2, int y2) -
updateLine
protected void updateLine(int x1, int y1) -
panCamera
Forces the camera to a position and enables panning on desktop. -
selectedBlock
public boolean selectedBlock() -
isPlacing
public boolean isPlacing() -
isBreaking
public boolean isBreaking() -
isRebuildSelecting
public boolean isRebuildSelecting() -
mouseAngle
public float mouseAngle(float x, float y) -
selectedUnit
-
selectedControlBuild
-
selectedCommandUnit
-
selectedEnemyUnit
-
selectedCommandUnits
-
selectedCommandUnits
-
remove
public void remove() -
add
public void add() -
canShoot
public boolean canShoot() -
onConfigurable
public boolean onConfigurable() -
isDroppingItem
public boolean isDroppingItem() -
canDropItem
public boolean canDropItem() -
tryDropItems
-
rebuildArea
public void rebuildArea(int x, int y, int x2, int y2) -
tryBreakBlock
public void tryBreakBlock(int x, int y) -
validPlace
-
validPlace
-
validBreak
public boolean validBreak(int x, int y) -
breakBlock
public void breakBlock(int x, int y) -
drawArrow
-
drawArrow
-