Click or drag to resize

ITouchManager Interface

Core manager of all pointer input in TouchScript. It is responsible for assigning unique pointer ids and keeping the list of active pointers. Controls pointer frames and dispatches pointer events.

Namespace:  TouchScript
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public interface ITouchManager

The ITouchManager type exposes the following members.

Properties
  NameDescription
Public propertyDisplayDevice
Gets or sets current display device.
Public propertyDotsPerCentimeter
Gets number of pixels in a cm with current DPI.
Public propertyDPI
Gets current DPI.
Public propertyInputs
Gets the list of IInputSource
Public propertyIsInsidePointerFrame
Indicates that execution is currently inside a TouchScript Pointer Frame, i.e. before FrameFinished and after FrameStarted events.
Public propertyPointers
Gets the list of pointers.
Public propertyPointersCount
Gets number of pointers in the system.
Public propertyPressedPointers
Gets the list of pressed pointers.
Public propertyPressedPointersCount
Gets the number of pressed pointer in the system.
Public propertyShouldCreateCameraLayer
Indicates if TouchScript should create a StandardLayer for you if no layers present in a scene.
Public propertyShouldCreateStandardInput
Gets or sets a value indicating whether a StandardInput should be created in scene if no inputs present.
Top
Methods
  NameDescription
Public methodAddInput
Adds an input source.
Public methodCancelPointer(Int32)
Cancels a pointer.
Public methodCancelPointer(Int32, Boolean)
Cancels a pointer and returns it to the system of need.
Public methodRemoveInput
Removes the input.
Public methodUpdateResolution
Tells TouchScript to update internal state after a resolution change.
Top
Events
  NameDescription
Public eventFrameFinished
Occurs when a frame is finished. After all other events.
Public eventFrameStarted
Occurs when a new frame is started before all other events.
Public eventPointersAdded
Occurs when new hovering pointers are added.
Public eventPointersCancelled
Occurs when pointers are cancelled.
Public eventPointersPressed
Occurs when pointers touch the surface.
Public eventPointersReleased
Occurs when pointers are released.
Public eventPointersRemoved
Occurs when pointers are removed from the system.
Public eventPointersUpdated
Occurs when pointers are updated.
Top
Remarks

Every frame pointer events are dispatched in this order:

  1. FrameStarted
  2. PointersAdded
  3. PointersUpdated
  4. PointersPressed
  5. PointersReleased
  6. PointersRemoved
  7. PointersCancelled
  8. FrameFinished

FrameStarted and FrameFinished events mark the start and the end of current pointer frame and allow to implement specific logic at these moments.

Current instance of an active object implementing ITouchManager can be obtained via Instance.

Examples
This sample shows how to get TouchManager instance and subscribe to events.
TouchManager.Instance.PointersPressed += 
    (sender, args) => { foreach (var pointer in args.Pointers) Debug.Log("Pressed: " + pointer.Id); }; 
TouchManager.Instance.PointersReleased += 
    (sender, args) => { foreach (var pointer in args.Pointers) Debug.Log("Released: " + pointer.Id); };
See Also