Allows a touch tap to be detected.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Entities Entity
DeltaEngine.Commands Trigger
DeltaEngine.Commands InputTrigger
DeltaEngine.Input TouchTapTrigger
Namespace: DeltaEngine.Input
Assembly: DeltaEngine.Input (in DeltaEngine.Input.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The TouchTapTrigger type exposes the following members.
Constructors
Name | Description | |
---|---|---|
TouchTapTrigger | Initializes a new instance of the TouchTapTrigger class | |
TouchTapTrigger(Dictionary String, String ) | Initializes a new instance of the TouchTapTrigger class |
Methods
Name | Description | |
---|---|---|
Add T | (Inherited from Entity.) | |
AddTag | (Inherited from Entity.) | |
ClearTags | (Inherited from Entity.) | |
Contains T | (Inherited from Entity.) | |
ContainsBehavior T | (Inherited from Entity.) | |
ContainsTag | (Inherited from Entity.) | |
Deactivate | (Inherited from Entity.) | |
Dispose | (Inherited from Entity.) | |
Get T |
Gets a specific component, derived classes can return faster cached values (e.g. Entity2D)
View code on GitHub (Inherited from Entity.) | |
GetActiveBehaviors | (Inherited from Entity.) | |
GetComponentsForSaving | (Inherited from Entity.) | |
GetOrDefault T | (Inherited from Entity.) | |
GetTags | (Inherited from Entity.) | |
HandleWithTouch | ||
Invoke | (Inherited from Trigger.) | |
Remove T | (Inherited from Entity.) | |
RemoveTag | (Inherited from Entity.) | |
Set | (Inherited from Entity.) | |
SetComponents | (Inherited from Entity.) | |
Start T | (Inherited from Entity.) | |
StartInputDevice | (Overrides InputTrigger StartInputDevice .) | |
Stop T | (Inherited from Entity.) | |
ToString | (Inherited from Entity.) | |
Update | (Inherited from Trigger.) |
Fields
Name | Description | |
---|---|---|
components | (Inherited from Entity.) | |
Invoked | (Inherited from Trigger.) |
Properties
Name | Description | |
---|---|---|
IsActive | (Inherited from Entity.) | |
IsPauseable | (Inherited from Trigger.) | |
NumberOfComponents | (Inherited from Entity.) | |
UpdatePriority | (Inherited from Entity.) | |
WasInvokedThisTick | (Inherited from Trigger.) |
Remarks
Examples
[Test] public void ShowRedCircleOnTap() { new FontText(Font.Default, "Tap screen to show red circle", Rectangle.One); var ellipse = new Ellipse(new Rectangle(0.1f, 0.1f, 0.1f, 0.1f), Color.Red); new Command(() => ellipse.Center = Vector2D.Half).Add(new TouchTapTrigger()); new Command(() => ellipse.Center = Vector2D.Zero).Add(new TouchPressTrigger(State.Released)); }
[Test] public void InvokeTouch() { var touch = Resolve<Touch>() as MockTouch; if (touch == null) return; //ncrunch: no coverage var trigger = new TouchTapTrigger(); bool wasInvoked = false; new Command(() => wasInvoked = true).Add(trigger); touch.SetTouchState(0, State.Pressing, Vector2D.Half); AdvanceTimeAndUpdateEntities(); touch.SetTouchState(0, State.Releasing, Vector2D.Half); AdvanceTimeAndUpdateEntities(); Assert.IsTrue(wasInvoked); }
[Test] public void TouchTapTrigger() { Assert.Throws<TouchTapTrigger.TouchTapTriggerHasNoParameters>( () => new TouchTapTrigger(new Dictionary<string, string> { { "a", "b" } })); }
See Also