Touch GetPosition Method Delta Engine Documentation

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

public abstract Vector2D GetPosition(
	int touchIndex
)

Return Value

Type: Vector2D
Remarks

Tests: DeltaEngine.Input.Tests.TouchPinchTriggerTests
Examples

2 unit tests call DeltaEngine.Input.Touch.GetPosition(System.Int32)
[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]
public void ShowRedSquare()
{
    new FontText(Font.Default, "Pinch screen to show red circle", Rectangle.One);
    var rect = new FilledRect(new Rectangle(0.1f, 0.1f, 0.1f, 0.1f), Color.Red);
    var trigger = new TouchRotateTrigger();
    var touch = Resolve<Touch>();
    new Command(() =>
    //ncrunch: no coverage start
    {
        rect.Center = touch.GetPosition(0);
        rect.RotationCenter = rect.Center;
        rect.Rotation = trigger.Angle;
    }).Add(trigger);
    //ncrunch: no coverage end
}
See Also