Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
GestureEventComposite.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 Composite gesture.
11  /// </summary>
12  public sealed class GestureEventComposite : GestureEvent
13  {
14  /// <summary>
15  /// The position of the center of the composite transformation at the beginning of the gesture (in normalized coordinates [0,1]).
16  /// </summary>
17  /// <remarks>The center of the transformation corresponds to the middle of the 2 fingers.</remarks>
18  public Vector2 CenterBeginningPosition { get; internal set; }
19 
20  /// <summary>
21  /// The current position of the center of the composite transformation (in normalized coordinates [0,1]).
22  /// </summary>
23  /// <remarks>The center of the transformation corresponds to the middle of the 2 fingers.</remarks>
24  public Vector2 CenterCurrentPosition { get; internal set; }
25 
26  /// <summary>
27  /// The rotation angle (in radian) since the last event of the gesture.
28  /// </summary>
29  public float DeltaRotation { get; internal set; }
30 
31  /// <summary>
32  /// The rotation angle (in radian) since the beginning of the gesture.
33  /// </summary>
34  public float TotalRotation { get; internal set; }
35 
36  /// <summary>
37  /// The difference of scale since the last event of the gesture.
38  /// </summary>
39  public float DeltaScale { get; internal set; }
40 
41  /// <summary>
42  /// The difference of scale since the beginning of the gesture.
43  /// </summary>
44  public float TotalScale { get; internal set; }
45 
46  /// <summary>
47  /// The translation (in pixels) performed since the last event of the gesture.
48  /// </summary>
49  public Vector2 DeltaTranslation { get; internal set; }
50 
51  /// <summary>
52  /// The translation (in pixels) performed since the beginning of the gesture.
53  /// </summary>
54  public Vector2 TotalTranslation { get; internal set; }
55 
56  internal GestureEventComposite(GestureState state, TimeSpan deltaTime, TimeSpan totalTime, float deltaAngle, float totalAngle,
57  float deltaScale, float totalScale, Vector2 firstCenter, Vector2 lastCenter, Vector2 currentCenter)
58  {
59  Type = GestureType.Composite;
60  State = state;
61  DeltaTime = deltaTime;
62  TotalTime = totalTime;
63  DeltaRotation = deltaAngle;
64  TotalRotation = totalAngle;
65  DeltaScale = deltaScale;
66  TotalScale = totalScale;
67  DeltaTranslation = currentCenter-lastCenter;
68  TotalTranslation = currentCenter-firstCenter;
69  CenterBeginningPosition = firstCenter;
70  CenterCurrentPosition = currentCenter;
71  }
72  }
73 }
Represents a two dimensional mathematical vector.
Definition: Vector2.cs:42
GestureState
The different possible states of a gestures.
Definition: GestureState.cs:8
Event class for the Composite gesture.
Base class for the gesture events.
Definition: GestureEvent.cs:10