|
|
@@ -14,25 +14,25 @@ By default, the input system doesn't recognize gestures, as this requires CPU ti
|
|
|
|
|
|
To turn on gesture recognition:
|
|
|
|
|
|
-1. Create an instance of the configuration class for the gesture you want to recognize. For example, for the drag gesture, create an instance of @'SiliconStudio.Xenko.Input.GestureConfigDrag'.
|
|
|
+1. Create an instance of the configuration class for the gesture you want to recognize. For example, for the drag gesture, create an instance of @'Xenko.Input.GestureConfigDrag'.
|
|
|
2. Configure the class parameters.
|
|
|
-3. Add the gesture configuration to the @'SiliconStudio.Xenko.Input.InputManager.Gestures' collection.
|
|
|
+3. Add the gesture configuration to the @'Xenko.Input.InputManager.Gestures' collection.
|
|
|
|
|
|
> [!Warning]
|
|
|
-> After you activate recognition for a gesture, you can't modify the gesture's parameters. If you need to do this, delete the gesture from the @'SiliconStudio.Xenko.Input.InputManager.Gestures' collection and create a new entry with new parameters.
|
|
|
+> After you activate recognition for a gesture, you can't modify the gesture's parameters. If you need to do this, delete the gesture from the @'Xenko.Input.InputManager.Gestures' collection and create a new entry with new parameters.
|
|
|
|
|
|
### Turn off gesture recognition
|
|
|
|
|
|
-Delete the gesture from the [InputManager.Gestures](xref:SiliconStudio.Xenko.Input.InputManager.Gestures) collection.
|
|
|
+Delete the gesture from the [InputManager.Gestures](xref:Xenko.Input.InputManager.Gestures) collection.
|
|
|
|
|
|
## Gesture recognition
|
|
|
|
|
|
-When the input system detects a gesture, it adds a @'SiliconStudio.Xenko.Input.GestureEvent' to the list of [InputManager.GestureEvents](xref:SiliconStudio.Xenko.Input.InputManager.GestureEvents). The event contains information about the gesture and its state, such as its location and the number of fingers used.
|
|
|
+When the input system detects a gesture, it adds a @'Xenko.Input.GestureEvent' to the list of [InputManager.GestureEvents](xref:Xenko.Input.InputManager.GestureEvents). The event contains information about the gesture and its state, such as its location and the number of fingers used.
|
|
|
|
|
|
> [!Note]
|
|
|
> Each gesture has its own associated gesture event class (see below).
|
|
|
|
|
|
-The [GestureEvent.Type](xref:SiliconStudio.Xenko.Input.GestureEvent.Type) field indicates which gesture has been recognized. You can then cast the base gesture event into the gesture-specific event type to have gesture-type-specific information about the event.
|
|
|
+The [GestureEvent.Type](xref:Xenko.Input.GestureEvent.Type) field indicates which gesture has been recognized. You can then cast the base gesture event into the gesture-specific event type to have gesture-type-specific information about the event.
|
|
|
|
|
|
Xenko can detect several gestures simultaneously, so the event list can contain more than one item in an update.
|
|
|
|
|
|
@@ -40,7 +40,7 @@ The list is cleared with every update, so you don't need to clear it manually.
|
|
|
|
|
|
## Configure gestures
|
|
|
|
|
|
-In the @'SiliconStudio.Xenko.Input.GestureConfig' classes, you can configure parameters including:
|
|
|
+In the @'Xenko.Input.GestureConfig' classes, you can configure parameters including:
|
|
|
|
|
|
* the number of fingers the gesture uses
|
|
|
|
|
|
@@ -77,14 +77,14 @@ Xenko supports two main types of gesture:
|
|
|
|
|
|
The user touches the screen and quickly removes their finger.
|
|
|
|
|
|
-**Configuration class**: @'SiliconStudio.Xenko.Input.GestureConfigTap'
|
|
|
+**Configuration class**: @'Xenko.Input.GestureConfigTap'
|
|
|
|
|
|
-**Event class**: @'SiliconStudio.Xenko.Input.GestureEventTap'
|
|
|
+**Event class**: @'Xenko.Input.GestureEventTap'
|
|
|
|
|
|
-The number of fingers on the screen can't vary during the gesture. To set the number of fingers required for a tap, modify @'SiliconStudio.Xenko.Input.GestureConfig.RequiredNumberOfFingers'.
|
|
|
+The number of fingers on the screen can't vary during the gesture. To set the number of fingers required for a tap, modify @'Xenko.Input.GestureConfig.RequiredNumberOfFingers'.
|
|
|
|
|
|
> [!TIP]
|
|
|
-> To distinguish single taps from multi-taps, the system uses latency in tap events. To disable this, set the [GestureConfigTap.MaximumTimeBetweenTaps](xref:SiliconStudio.Xenko.Input.GestureConfigTap.MaximumTimeBetweenTaps) field to **0**.
|
|
|
+> To distinguish single taps from multi-taps, the system uses latency in tap events. To disable this, set the [GestureConfigTap.MaximumTimeBetweenTaps](xref:Xenko.Input.GestureConfigTap.MaximumTimeBetweenTaps) field to **0**.
|
|
|
|
|
|
#### <a name="Flick"> Flick</a>
|
|
|
|
|
|
@@ -92,16 +92,16 @@ The number of fingers on the screen can't vary during the gesture. To set the nu
|
|
|
|
|
|
The user touches the screen, performs a quick straight translation, and withdraws their finger(s).
|
|
|
|
|
|
-**Configuration class**: @'SiliconStudio.Xenko.Input.GestureConfigFlick'
|
|
|
+**Configuration class**: @'Xenko.Input.GestureConfigFlick'
|
|
|
|
|
|
-**Event class**: @'SiliconStudio.Xenko.Input.GestureEventFlick'
|
|
|
+**Event class**: @'Xenko.Input.GestureEventFlick'
|
|
|
|
|
|
The number of fingers on the screen can't during the gesture.
|
|
|
|
|
|
-To set a minimum length for the flick gesture, use [GestureConfigFlick.MinimumFlickLength](xref:SiliconStudio.Xenko.Input.GestureConfigFlick.MinimumFlickLength).
|
|
|
+To set a minimum length for the flick gesture, use [GestureConfigFlick.MinimumFlickLength](xref:Xenko.Input.GestureConfigFlick.MinimumFlickLength).
|
|
|
|
|
|
To restrict the direction of the flick to **vertical** or **horizontal**, use
|
|
|
-[GestureConfigFlick.FlickShape](xref:SiliconStudio.Xenko.Input.GestureConfigFlick.FlickShape).
|
|
|
+[GestureConfigFlick.FlickShape](xref:Xenko.Input.GestureConfigFlick.FlickShape).
|
|
|
|
|
|
#### <a name="Long-press"> Long press</a>
|
|
|
|
|
|
@@ -109,13 +109,13 @@ To restrict the direction of the flick to **vertical** or **horizontal**, use
|
|
|
|
|
|
The user touches the screen and maintains pressure without removing their finger for a certain period of time (the default time is one second).
|
|
|
|
|
|
-**Configuration class**: [GestureConfigLongPress](xref:SiliconStudio.Xenko.Input.GestureConfigLongPress)
|
|
|
+**Configuration class**: [GestureConfigLongPress](xref:Xenko.Input.GestureConfigLongPress)
|
|
|
|
|
|
-**Event class**: [GestureEventLongPress](xref:SiliconStudio.Xenko.Input.GestureEventLongPress)
|
|
|
+**Event class**: [GestureEventLongPress](xref:Xenko.Input.GestureEventLongPress)
|
|
|
|
|
|
The number of fingers on the screen can't vary during the gesture.
|
|
|
|
|
|
-To change the minimum press length for the long press gesture, modify [GestureConfigLongPress.RequiredPressTime](xref:SiliconStudio.Xenko.Input.GestureConfigLongPress.RequiredPressTime).
|
|
|
+To change the minimum press length for the long press gesture, modify [GestureConfigLongPress.RequiredPressTime](xref:Xenko.Input.GestureConfigLongPress.RequiredPressTime).
|
|
|
|
|
|
### Continuous gestures
|
|
|
|
|
|
@@ -125,15 +125,15 @@ To change the minimum press length for the long press gesture, modify [GestureC
|
|
|
|
|
|
The user touches the screen, performs a translation, and withdraws their finger(s).
|
|
|
|
|
|
-**Configuration class**: [GestureConfigDrag](xref:SiliconStudio.Xenko.Input.GestureConfigDrag)
|
|
|
+**Configuration class**: [GestureConfigDrag](xref:Xenko.Input.GestureConfigDrag)
|
|
|
|
|
|
-**Event class**: [GestureEventDrag](xref:SiliconStudio.Xenko.Input.GestureEventDrag)
|
|
|
+**Event class**: [GestureEventDrag](xref:Xenko.Input.GestureEventDrag)
|
|
|
|
|
|
The number of fingers on the screen can't vary during the gesture.
|
|
|
|
|
|
-To detect smaller drags, decrease [GestureConfigDrag.MinimumDragDistance](xref:SiliconStudio.Xenko.Input.GestureConfigDrag.MinimumDragDistance).
|
|
|
+To detect smaller drags, decrease [GestureConfigDrag.MinimumDragDistance](xref:Xenko.Input.GestureConfigDrag.MinimumDragDistance).
|
|
|
|
|
|
-To restrict the direction of the drag to **vertical** or **horizontal**, use [GestureConfigDrag.DragShape](xref:SiliconStudio.Xenko.Input.GestureConfigDrag.DragShape).
|
|
|
+To restrict the direction of the drag to **vertical** or **horizontal**, use [GestureConfigDrag.DragShape](xref:Xenko.Input.GestureConfigDrag.DragShape).
|
|
|
|
|
|
#### <a name="Composite"> Composite</a>
|
|
|
|
|
|
@@ -141,9 +141,9 @@ To restrict the direction of the drag to **vertical** or **horizontal**, use [Ge
|
|
|
|
|
|
The user touches the screen with two fingers and moves them independently.
|
|
|
|
|
|
-**Configuration class**: @'SiliconStudio.Xenko.Input.GestureConfigComposite'
|
|
|
+**Configuration class**: @'Xenko.Input.GestureConfigComposite'
|
|
|
|
|
|
-**Event class**: @'SiliconStudio.Xenko.Input.GestureEventComposite'
|
|
|
+**Event class**: @'Xenko.Input.GestureEventComposite'
|
|
|
|
|
|
The composite gesture requires exactly two fingers on the screen. It's triggered when the system detects one of the three basic actions:
|
|
|
* _Translation_: the user translates two fingers together in the same direction.
|
|
|
@@ -164,7 +164,7 @@ A gesture always has one of four states:
|
|
|
|
|
|
**Discrete** gestures (tap, flick, long press) always have the state _occurred_. **Continuous** gestures (drag and composite) always begin with the state _began_, followed by any _changed_ states, and end with the _ended_ state.
|
|
|
|
|
|
-To query the current state of a gesture, use the [GestureEvent.State](xref:SiliconStudio.Xenko.Input.GestureEvent.State) field of the triggered gesture event.
|
|
|
+To query the current state of a gesture, use the [GestureEvent.State](xref:Xenko.Input.GestureEvent.State) field of the triggered gesture event.
|
|
|
|
|
|
## Example code
|
|
|
|
|
|
@@ -213,7 +213,7 @@ var noLatencyTap = new GestureConfigTap() { MaximumTimeBetweenTaps= TimeSpan.Zer
|
|
|
|
|
|
### Access gesture events
|
|
|
|
|
|
-You can access the list of events triggered by recognized gestures using the [InputManager.GestureEvents](xref:SiliconStudio.Xenko.Input.InputManager.GestureEvents) collection. The collection is automatically cleared at every update.
|
|
|
+You can access the list of events triggered by recognized gestures using the [InputManager.GestureEvents](xref:Xenko.Input.InputManager.GestureEvents) collection. The collection is automatically cleared at every update.
|
|
|
|
|
|
```cs
|
|
|
var currentFrameGestureEvents = Input.GestureEvents;
|
|
|
@@ -221,7 +221,7 @@ var currentFrameGestureEvents = Input.GestureEvents;
|
|
|
|
|
|
### Identify the gesture type
|
|
|
|
|
|
-Use the [GestureEvent.Type](xref:SiliconStudio.Xenko.Input.GestureEvent.Type) field to identity the gesture type, then cast it to the appropriate event type to get extra information about the event.
|
|
|
+Use the [GestureEvent.Type](xref:Xenko.Input.GestureEvent.Type) field to identity the gesture type, then cast it to the appropriate event type to get extra information about the event.
|
|
|
|
|
|
```cs
|
|
|
foreach( var gestureEvent in Input.GestureEvents)
|
|
|
@@ -240,7 +240,7 @@ foreach( var gestureEvent in Input.GestureEvents)
|
|
|
|
|
|
### Identify the gesture state
|
|
|
|
|
|
-Use the [GestureEvent.State](xref:SiliconStudio.Xenko.Input.GestureEvent.State) field to get gesture event state.
|
|
|
+Use the [GestureEvent.State](xref:Xenko.Input.GestureEvent.State) field to get gesture event state.
|
|
|
|
|
|
```cs
|
|
|
switch(compositeGestureEvent.State)
|