Class TouchAppState

All Implemented Interfaces:
AppState, PickState

public class TouchAppState extends BasePickState
Similar to MouseAppState, this state adapts touch and multitouch events to mouse and cursor events. In the case of multitouch, each separate touch ID gets its own PickEventSession. For more details on how a PickEventSession is handled, see MouseAppState or PickEventSession.
  • Field Details

  • Constructor Details

    • TouchAppState

      public TouchAppState(Application app)
  • Method Details

    • cleanup

      protected void cleanup(Application app)
      Description copied from class: BaseAppState
      Called after the app state is detached or during application shutdown if the state is still attached. onDisable() is called before this cleanup() method if the state is enabled at the time of cleanup.
      Overrides:
      cleanup in class BasePickState
      Parameters:
      app - the application
    • dispatchMotion

      protected void dispatchMotion()
      Dispatches the last touch locations to the active PickEventSessions.
      When touch motion events occur, the touch location is stored and then dispatched at the frequency defined to avoid sending more motions than necessary. An early out is provided if no PickEventSessions are active (ie. no touch pointers are active).
      Specified by:
      dispatchMotion in class BasePickState
    • dispatchButton

      protected boolean dispatchButton(TouchAppState.PointerData pointerData, boolean pressed)
      Dispatches a button action to the appropriate PickEventSession for the touch pointer provided.
      Parameters:
      pointerData - PointerData object for the appropriate touch pointer
      pressed - True when pressed, False when released
      Returns:
      True if the PickEventSession consumed the event, False otherwise.
    • getPointerData

      protected TouchAppState.PointerData getPointerData(int pointerId, int x, int y)
      Returns (or creates) the PointerData object with the appropriate PickEventSession and X/Y coordinates for the provided pointerId.
      The provided X and Y locations are stored in the PointerData object for created PointerData objects and updated if the PointerData object already exists.
      Parameters:
      pointerId - Touch pointer id
      x - X component of the touch location in pixels
      y - Y component of the touch location in pixels
      Returns:
      Associated PointerData object which contains the appropriate PickEventSession and X/Y coordinates of the last touch event