Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
GestureEventTranslation.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 
5 using SiliconStudio.Core.Mathematics;
6 
7 namespace SiliconStudio.Paradox.Input
8 {
9  /// <summary>
10  /// Event class for the Drag gesture.
11  /// </summary>
13  {
14  /// <summary>
15  /// The Shape of the drag.
16  /// </summary>
17  public GestureShape Shape { get; internal set; }
18 
19  /// <summary>
20  /// The position (in pixels) where the drag event started.
21  /// </summary>
22  public Vector2 StartPosition { get; internal set; }
23 
24  /// <summary>
25  /// The current position (in pixels) of the drag event.
26  /// </summary>
27  public Vector2 CurrentPosition { get; internal set; }
28 
29  /// <summary>
30  /// The translation (in pixels) performed since the last event of the gesture.
31  /// </summary>
32  public Vector2 DeltaTranslation { get; internal set; }
33 
34  /// <summary>
35  /// The translation (in pixels) performed since the beginning of the gesture.
36  /// </summary>
37  public Vector2 TotalTranslation { get; internal set; }
38 
39  /// <summary>
40  /// The average translation speed (in pixels per seconds) of the drag event.
41  /// </summary>
42  public Vector2 AverageSpeed { get; internal set; }
43 
44  internal GestureEventTranslation(GestureType type, GestureState state, int numberOfFingers, TimeSpan deltaTime, TimeSpan totalTime,
45  GestureShape shape, Vector2 startPos, Vector2 currPos, Vector2 deltaTrans)
46  {
47  Type = type;
48  State = state;
49  NumberOfFinger = numberOfFingers;
50  DeltaTime = deltaTime;
51  TotalTime = totalTime;
52  Shape = shape;
53  StartPosition = startPos;
54  CurrentPosition = currPos;
55  DeltaTranslation = deltaTrans;
56  TotalTranslation = currPos - startPos;
57  AverageSpeed = TotalTranslation / (float)(TotalTime.TotalSeconds + 0.0001f); // avoid division by zero
58  }
59  }
60 }
Represents a two dimensional mathematical vector.
Definition: Vector2.cs:42
GestureState
The different possible states of a gestures.
Definition: GestureState.cs:8
GestureType
List all the available type of Gestures.
Definition: GestureType.cs:9
GestureShape
Gesture possible shapes.
Definition: GestureShape.cs:8
Base class for the gesture events.
Definition: GestureEvent.cs:10