Class MobileInput

java.lang.Object
mindustry.input.InputHandler
mindustry.input.MobileInput
All Implemented Interfaces:
GestureDetector.GestureListener, InputProcessor

public class MobileInput extends InputHandler implements GestureDetector.GestureListener
  • Field Details

    • edgePan

      public final float edgePan
      Distance to edge of screen to start panning.
    • vector

      public Vec2 vector
    • movement

      public Vec2 movement
    • targetPos

      public Vec2 targetPos
    • lastZoom

      public float lastZoom
    • lineStartX

      public int lineStartX
      Position where the player started dragging a line.
    • lineStartY

      public int lineStartY
      Position where the player started dragging a line.
    • lastLineX

      public int lastLineX
      Position where the player started dragging a line.
    • lastLineY

      public int lastLineY
      Position where the player started dragging a line.
    • lineScale

      public float lineScale
      Animation scale for line.
    • crosshairScale

      public float crosshairScale
      Animation data for crosshair.
    • lastTarget

      public mindustry.gen.Teamc lastTarget
    • shiftDeltaX

      public float shiftDeltaX
      Used for shifting build plans.
    • shiftDeltaY

      public float shiftDeltaY
      Used for shifting build plans.
    • removals

      public Seq<BuildPlan> removals
      Place plans to be removed.
    • selecting

      public boolean selecting
      Whether the player is currently shifting all placed tiles.
    • lineMode

      public boolean lineMode
      Whether the player is currently in line-place mode.
    • schematicMode

      public boolean schematicMode
      Whether the player is currently in line-place mode.
    • rebuildMode

      public boolean rebuildMode
      Whether the player is currently in line-place mode.
    • mode

      public PlaceMode mode
      Current place mode.
    • lastBlock

      @Nullable public Block lastBlock
      Whether no recipe was available when switching to break mode.
    • lastPlaced

      @Nullable public BuildPlan lastPlaced
      Last placed plan. Used for drawing block overlay.
    • down

      public boolean down
      Down tracking for panning.
    • manualShooting

      public boolean manualShooting
      Whether manual shooting (point with finger) is enabled.
    • target

      @Nullable public mindustry.gen.Teamc target
      Current thing being shot at.
    • payloadTarget

      @Nullable public Position payloadTarget
      Payload target being moved to. Can be a position (for dropping), or a unit/block.
    • unitTapped

      @Nullable public mindustry.gen.Unit unitTapped
      Unit last tapped, or null if last tap was not on a unit.
    • buildingTapped

      @Nullable public mindustry.gen.Building buildingTapped
      Control building last tapped.
  • Constructor Details

    • MobileInput

      public MobileInput()
  • Method Details

    • buildPlacementUI

      public void buildPlacementUI(Table table)
      Overrides:
      buildPlacementUI in class InputHandler
    • buildUI

      public void buildUI(Group group)
      Overrides:
      buildUI in class InputHandler
    • drawBottom

      public void drawBottom()
      Overrides:
      drawBottom in class InputHandler
    • drawTop

      public void drawTop()
      Overrides:
      drawTop in class InputHandler
    • drawOverSelect

      public void drawOverSelect()
      Overrides:
      drawOverSelect in class InputHandler
    • drawPlan

      protected void drawPlan(BuildPlan plan)
      Overrides:
      drawPlan in class InputHandler
    • isRebuildSelecting

      public boolean isRebuildSelecting()
      Overrides:
      isRebuildSelecting in class InputHandler
    • schemOriginX

      protected int schemOriginX()
      Overrides:
      schemOriginX in class InputHandler
    • schemOriginY

      protected int schemOriginY()
      Overrides:
      schemOriginY in class InputHandler
    • isPlacing

      public boolean isPlacing()
      Overrides:
      isPlacing in class InputHandler
    • isBreaking

      public boolean isBreaking()
      Overrides:
      isBreaking in class InputHandler
    • useSchematic

      public void useSchematic(Schematic schem)
      Overrides:
      useSchematic in class InputHandler
    • touchDown

      public boolean touchDown(int screenX, int screenY, int pointer, KeyCode button)
      Specified by:
      touchDown in interface InputProcessor
      Parameters:
      screenX - The x coordinate, origin is in the upper left corner
      screenY - The y coordinate, origin is in the upper left corner
      pointer - the pointer for the event.
      button - the button
      Returns:
      whether the input was processed
    • touchUp

      public boolean touchUp(int screenX, int screenY, int pointer, KeyCode button)
      Specified by:
      touchUp in interface InputProcessor
      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 interface GestureDetector.GestureListener
    • tap

      public boolean tap(float x, float y, int count, KeyCode button)
      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 the GestureDetector.
      Specified by:
      tap in interface GestureDetector.GestureListener
      count - the number of taps.
    • updateState

      public void updateState()
      Overrides:
      updateState in class InputHandler
    • update

      public void update()
      Overrides:
      update in class InputHandler
    • 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 interface GestureDetector.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

      public boolean panStop(float x, float y, int pointer, KeyCode button)
      Description copied from interface: GestureDetector.GestureListener
      Called when no longer panning.
      Specified by:
      panStop in interface GestureDetector.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 interface GestureDetector.GestureListener
      Parameters:
      initialDistance - distance between fingers when the gesture started.
      distance - current distance between fingers.
    • updateMovement

      protected void updateMovement(mindustry.gen.Unit unit)