XnaTouch ClassDelta Engine Documentation
Native implementation of the Touch interface using Xna.
Inheritance Hierarchy

System Object
  DeltaEngine.Entities UpdateBehavior
    DeltaEngine.Input InputDevice
      DeltaEngine.Input Touch
        DeltaEngine.Input.Xna XnaTouch

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

public sealed class XnaTouch : Touch

The XnaTouch type exposes the following members.

Constructors

  NameDescription
Public methodXnaTouch
Initializes a new instance of the XnaTouch class
Top
Methods

  NameDescription
Public methodDispose
Releases all resources used by the XnaTouch
(Overrides InputDevice Dispose .)
Public methodGetPosition (Overrides Touch GetPosition(Int32).)
Public methodGetState (Overrides Touch GetState(Int32).)
Public methodUpdate (Overrides Touch Update(IEnumerable Entity ).)
Top
Properties

  NameDescription
Public propertyIsAvailable (Overrides InputDevice IsAvailable.)
Top
Remarks

Tests: DeltaEngine.Input.Xna.Tests.XnaTouchTests
Examples

1 unit tests call DeltaEngine.Input.Xna.XnaTouch
[Test]
public void TestXnaTouchLogic()
{
    using (var resolver = new MockResolver())
    {
        var window = resolver.Window;
        new PixelScreenSpace(window);
        var touch = new XnaMockTouch(window) { TouchCollection = GetFirstTouchCollection() };
        Assert.AreEqual(new Vector2D(0, 0), touch.GetPosition(0));
        Assert.AreEqual(State.Released, touch.GetState(0));
        touch.Run();
        touch.TouchCollection = GetSecondTouchCollection();
        touch.Run();
        touch.TouchCollection = GetThirtTouchCollection();
        touch.Run();
        touch.Update(new Entity[] { });
        if (!touch.IsAvailable)
            return;
        //ncrunch: no coverage start
        Assert.AreEqual(Vector2D.Zero, touch.GetPosition(0)); 
        Assert.AreEqual(State.Released, touch.GetState(0));
    } //ncrunch: no coverage end
See Also