TouchPinchTrigger ClassDelta Engine Documentation
Allows a touch pinch to be detected. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Entities Entity
    DeltaEngine.Commands Trigger
      DeltaEngine.Commands InputTrigger
        DeltaEngine.Input TouchPinchTrigger

Namespace: DeltaEngine.Input
Assembly: DeltaEngine.Input (in DeltaEngine.Input.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class TouchPinchTrigger : InputTrigger, 
	ZoomTrigger, TouchTrigger

The TouchPinchTrigger type exposes the following members.

Constructors

  NameDescription
Public methodTouchPinchTrigger 
Initializes a new instance of the TouchPinchTrigger class
Public methodTouchPinchTrigger(Dictionary String, String )
Initializes a new instance of the TouchPinchTrigger class
Top
Methods

  NameDescription
Public methodAdd T  (Inherited from Entity.)
Public methodAddTag (Inherited from Entity.)
Public methodClearTags (Inherited from Entity.)
Public methodContains T  (Inherited from Entity.)
Public methodContainsBehavior T  (Inherited from Entity.)
Public methodContainsTag (Inherited from Entity.)
Protected methodDeactivate (Inherited from Entity.)
Public methodDispose (Inherited from Entity.)
Public methodGet T 
Gets a specific component, derived classes can return faster cached values (e.g. Entity2D) View code on GitHub
(Inherited from Entity.)
Protected methodGetActiveBehaviors (Inherited from Entity.)
Protected methodGetComponentsForSaving (Inherited from Entity.)
Public methodGetOrDefault T  (Inherited from Entity.)
Public methodGetTags (Inherited from Entity.)
Public methodHandleWithTouch
Public methodInvoke (Inherited from Trigger.)
Public methodRemove T  (Inherited from Entity.)
Public methodRemoveTag (Inherited from Entity.)
Public methodSet (Inherited from Entity.)
Public methodSetComponents (Inherited from Entity.)
Public methodStart T  (Inherited from Entity.)
Protected methodStartInputDevice (Overrides InputTrigger StartInputDevice .)
Public methodStop T  (Inherited from Entity.)
Public methodToString (Inherited from Entity.)
Public methodUpdate (Inherited from Trigger.)
Top
Fields

  NameDescription
Protected fieldcomponents (Inherited from Entity.)
Public fieldInvoked (Inherited from Trigger.)
Top
Properties

  NameDescription
Public propertyIsActive (Inherited from Entity.)
Public propertyIsPauseable (Inherited from Trigger.)
Public propertyNumberOfComponents (Inherited from Entity.)
Public propertyUpdatePriority (Inherited from Entity.)
Public propertyWasInvokedThisTick (Inherited from Trigger.)
Public propertyZoomAmount
Top
Remarks

Tests: DeltaEngine.Input.Tests.TouchPinchTriggerTests
Examples

3 unit tests call DeltaEngine.Input.TouchPinchTrigger
[Test]
public void ShowRedCircleOnPinch()
{
    new FontText(Font.Default, "Pinch screen to show red circle", Rectangle.One);
    var ellipse = new Ellipse(new Rectangle(0.1f, 0.1f, 0.1f, 0.1f), Color.Red);
    var trigger = new TouchPinchTrigger();
    var touch = Resolve<Touch>();
    new Command(() =>
    //ncrunch: no coverage start
    {
        ellipse.Center = touch.GetPosition(0);
        ellipse.Size = new Size(trigger.ZoomAmount * 0.5f);
    }).Add(trigger);
    //ncrunch: no coverage end
}
[Test, CloseAfterFirstFrame]
public void PinchDistance()
{
    var trigger = new TouchPinchTrigger();
    var touch = Resolve<Touch>() as MockTouch;
    if (touch == null)
        return; //ncrunch: no coverage
    touch.SetTouchState(0, State.Pressing, new Vector2D(0.4f, 0.5f));
    touch.SetTouchState(1, State.Pressed, new Vector2D(0.5f, 0.5f));
    touch.Update(new[] { trigger });
[Test, CloseAfterFirstFrame]
public void Creation()
{
    Assert.DoesNotThrow(() => new TouchPinchTrigger());
    Assert.Throws<TouchPinchTrigger.TouchPinchTriggerHasNoParameters>(
        () => new TouchPinchTrigger(new Dictionary<string, string> { { "Button", "Left" } }));
}
See Also