Allows a touch pinch to be detected.
View code on GitHub
Inheritance Hierarchy
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
The TouchPinchTrigger type exposes the following members.
Constructors
Name | Description | |
---|---|---|
TouchPinchTrigger | Initializes a new instance of the TouchPinchTrigger class | |
TouchPinchTrigger(Dictionary String, String ) | Initializes a new instance of the TouchPinchTrigger 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.) | |
ZoomAmount |
Remarks
Examples
[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