Class TouchInput

java.lang.Object
technology.sola.engine.input.TouchInput

@NullMarked public class TouchInput extends Object
TouchInput contains information about user interaction with the touch screen.
  • Field Details

    • MAX_TOUCHES

      public static final int MAX_TOUCHES
      Max number of simultaneous touches supported.
      See Also:
  • Constructor Details

    • TouchInput

      public TouchInput()
  • Method Details

    • getActiveTouchCount

      public int getActiveTouchCount()
      Gets the number of active touches (fingers on the screen).
      Returns:
      the active touch count
    • activeTouchesIterator

      public Iterator<Touch> activeTouchesIterator()
      Returns:
      iterator for all the active touches
    • getFirstTouch

      public @Nullable Touch getFirstTouch()
      Returns:
      the Touch of the first finger or else null
    • getFirstActiveTouch

      public @Nullable Touch getFirstActiveTouch()
      Returns:
      the Touch of the first finger that is still on the screen or else null
    • getTouch

      public @Nullable Touch getTouch(int id)
      Gets the Touch of the given finger by unique id.
      Parameters:
      id - the id (typically 0-9)
      Returns:
      the Touch of the given finger or else null
    • updatedStatusOfTouches

      public void updatedStatusOfTouches()
      Updates the status of changed Touches from the previous frame.
    • onTouchEvent

      public void onTouchEvent(TouchEvent event)
      Called by the SolaPlatform whenever a touch event occurs.
      Parameters:
      event - the TouchEvent