Package mindustry.input
Class MobileInput
java.lang.Object
mindustry.input.InputHandler
mindustry.input.MobileInput
- All Implemented Interfaces:
GestureDetector.GestureListener
,InputProcessor
-
Field Summary
Modifier and TypeFieldDescriptionmindustry.gen.Building
Control building last tapped.float
Animation data for crosshair.boolean
Down tracking for panning.final float
Distance to edge of screen to start panning.Whether no recipe was available when switching to break mode.int
Position where the player started dragging a line.int
Position where the player started dragging a line.Last placed plan.mindustry.gen.Teamc
float
boolean
Whether the player is currently in line-place mode.float
Animation scale for line.int
Position where the player started dragging a line.int
Position where the player started dragging a line.boolean
Whether manual shooting (point with finger) is enabled.Current place mode.Payload target being moved to.boolean
Whether the player is currently in line-place mode.Place plans to be removed.boolean
Whether the player is currently in line-place mode.boolean
Whether the player is currently shifting all placed tiles.float
Used for shifting build plans.float
Used for shifting build plans.mindustry.gen.Teamc
Current thing being shot at.mindustry.gen.Unit
Unit last tapped, or null if last tap was not on a unit.Fields inherited from class mindustry.input.InputHandler
block, bplan, buildWasAutoPaused, commandBuildings, commandMode, commandRect, commandRectX, commandRectY, config, controlInterval, controlledType, detector, droppingItem, inputLocks, inv, isBuilding, lastSchematic, line, linePlans, logicCamPan, logicCamSpeed, logicCutscene, logicCutsceneZoom, overrideLineRotation, recentRespawnTimer, resultplan, rotation, selectedUnits, selectPlans, tappedOne, uiGroup, wasShooting
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
autoPan()
void
buildPlacementUI
(Table table) void
void
void
protected void
void
drawTop()
boolean
boolean
boolean
boolean
longPress
(float x, float y) boolean
pan
(float x, float y, float deltaX, float deltaY) Called when the user drags a finger over the screen.boolean
Called when no longer panning.protected int
protected int
boolean
Called when a tap occured.boolean
boolean
void
update()
protected void
updateMovement
(mindustry.gen.Unit unit) void
void
useSchematic
(Schematic schem) boolean
zoom
(float initialDistance, float distance) Called when the user performs a pinch zoom gesture.Methods inherited from class mindustry.input.InputHandler
add, addLock, allPlans, breakBlock, buildingControlSelect, canDropItem, canShoot, checkUnit, clearItems, commandBuilding, commandTap, commandUnits, createItemTransfer, deletePlans, drawArrow, drawArrow, drawBreaking, drawBreaking, drawBreakSelection, drawBreakSelection, drawCommand, drawCommanded, drawOverlapCheck, drawOverPlan, drawOverPlan, drawPlan, drawPlan, drawRebuildSelection, drawSelected, drawSelection, drawSelection, dropItem, flipPlans, flushPlans, flushPlansReverse, flushSelectPlans, getMouseX, getMouseY, getPlan, getPlan, isDroppingItem, isUsingSchematic, locked, mouseAngle, multiUnitSelect, onConfigurable, panCamera, payloadDropped, pickedBuildPayload, pickedUnitPayload, planMatches, rebuildArea, remove, removeQueueBlock, removeSelection, removeSelection, removeSelection, removeSelection, requestBuildPayload, requestDropPayload, requestItem, requestUnitPayload, rotateBlock, rotatePlans, selectedBlock, selectedCommandUnit, selectedCommandUnits, selectedCommandUnits, selectedControlBuild, selectedEnemyUnit, selectedUnit, selectTypedUnits, selectUnitsRect, setItem, setUnitCommand, showSchematicSave, takeItems, tapCommandUnit, tileConfig, tileTap, transferInventory, transferItemEffect, transferItemTo, transferItemToUnit, tryBreakBlock, tryDropItems, tryDropPayload, tryPickupPayload, unitBuildingControlSelect, unitClear, unitControl, updateLine, updateLine, validBreak, validPlace, validPlace
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, pinch, pinchStop, touchDown
Methods inherited from interface arc.input.InputProcessor
connected, disconnected, keyDown, keyTyped, keyUp, mouseMoved, scrolled, touchDragged
-
Field Details
-
edgePan
public final float edgePanDistance to edge of screen to start panning. -
vector
-
movement
-
targetPos
-
lastZoom
public float lastZoom -
lineStartX
public int lineStartXPosition where the player started dragging a line. -
lineStartY
public int lineStartYPosition where the player started dragging a line. -
lastLineX
public int lastLineXPosition where the player started dragging a line. -
lastLineY
public int lastLineYPosition where the player started dragging a line. -
lineScale
public float lineScaleAnimation scale for line. -
crosshairScale
public float crosshairScaleAnimation data for crosshair. -
lastTarget
public mindustry.gen.Teamc lastTarget -
shiftDeltaX
public float shiftDeltaXUsed for shifting build plans. -
shiftDeltaY
public float shiftDeltaYUsed for shifting build plans. -
removals
Place plans to be removed. -
selecting
public boolean selectingWhether the player is currently shifting all placed tiles. -
lineMode
public boolean lineModeWhether the player is currently in line-place mode. -
schematicMode
public boolean schematicModeWhether the player is currently in line-place mode. -
rebuildMode
public boolean rebuildModeWhether the player is currently in line-place mode. -
mode
Current place mode. -
lastBlock
Whether no recipe was available when switching to break mode. -
lastPlaced
Last placed plan. Used for drawing block overlay. -
down
public boolean downDown tracking for panning. -
manualShooting
public boolean manualShootingWhether manual shooting (point with finger) is enabled. -
target
Current thing being shot at. -
payloadTarget
Payload target being moved to. Can be a position (for dropping), or a unit/block. -
unitTapped
Unit last tapped, or null if last tap was not on a unit. -
buildingTapped
Control building last tapped.
-
-
Constructor Details
-
MobileInput
public MobileInput()
-
-
Method Details
-
buildPlacementUI
- Overrides:
buildPlacementUI
in classInputHandler
-
buildUI
- Overrides:
buildUI
in classInputHandler
-
drawBottom
public void drawBottom()- Overrides:
drawBottom
in classInputHandler
-
drawTop
public void drawTop()- Overrides:
drawTop
in classInputHandler
-
drawOverSelect
public void drawOverSelect()- Overrides:
drawOverSelect
in classInputHandler
-
drawPlan
- Overrides:
drawPlan
in classInputHandler
-
isRebuildSelecting
public boolean isRebuildSelecting()- Overrides:
isRebuildSelecting
in classInputHandler
-
schemOriginX
protected int schemOriginX()- Overrides:
schemOriginX
in classInputHandler
-
schemOriginY
protected int schemOriginY()- Overrides:
schemOriginY
in classInputHandler
-
isPlacing
public boolean isPlacing()- Overrides:
isPlacing
in classInputHandler
-
isBreaking
public boolean isBreaking()- Overrides:
isBreaking
in classInputHandler
-
useSchematic
- Overrides:
useSchematic
in classInputHandler
-
touchDown
- Specified by:
touchDown
in interfaceInputProcessor
- Parameters:
screenX
- The x coordinate, origin is in the upper left cornerscreenY
- The y coordinate, origin is in the upper left cornerpointer
- the pointer for the event.button
- the button- Returns:
- whether the input was processed
-
touchUp
- Specified by:
touchUp
in interfaceInputProcessor
pointer
- the pointer for the event.button
- the button- Returns:
- whether the input was processed
-
longPress
public boolean longPress(float x, float y) - Specified by:
longPress
in interfaceGestureDetector.GestureListener
-
tap
Description copied from interface:GestureDetector.GestureListener
Called when a tap occured. A tap happens if a touch went down on the screen and was lifted again without moving outside of the tap square. The tap square is a rectangular area around the initial touch position as specified on construction time of theGestureDetector
.- Specified by:
tap
in interfaceGestureDetector.GestureListener
count
- the number of taps.
-
updateState
public void updateState()- Overrides:
updateState
in classInputHandler
-
update
public void update()- Overrides:
update
in classInputHandler
-
autoPan
protected void autoPan() -
pan
public boolean pan(float x, float y, float deltaX, float deltaY) Description copied from interface:GestureDetector.GestureListener
Called when the user drags a finger over the screen.- Specified by:
pan
in interfaceGestureDetector.GestureListener
deltaX
- the difference in pixels to the last drag event on x.deltaY
- the difference in pixels to the last drag event on y.
-
panStop
Description copied from interface:GestureDetector.GestureListener
Called when no longer panning.- Specified by:
panStop
in interfaceGestureDetector.GestureListener
-
zoom
public boolean zoom(float initialDistance, float distance) Description copied from interface:GestureDetector.GestureListener
Called when the user performs a pinch zoom gesture. The original distance is the distance in pixels when the gesture started.- Specified by:
zoom
in interfaceGestureDetector.GestureListener
- Parameters:
initialDistance
- distance between fingers when the gesture started.distance
- current distance between fingers.
-
updateMovement
protected void updateMovement(mindustry.gen.Unit unit)
-