Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
VirtualButtonBinding.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 namespace SiliconStudio.Paradox.Input
4 {
5  /// <summary>
6  /// Describes a binding between a name and a <see cref="IVirtualButton"/>.
7  /// </summary>
8  public class VirtualButtonBinding
9  {
10  /// <summary>
11  /// Initializes a new instance of the <see cref="VirtualButtonBinding" /> class.
12  /// </summary>
13  public VirtualButtonBinding() : this(null)
14  {
15  }
16 
17  /// <summary>
18  /// Initializes a new instance of the <see cref="VirtualButtonBinding" /> class.
19  /// </summary>
20  /// <param name="name">The name.</param>
21  /// <param name="button">The button.</param>
22  public VirtualButtonBinding(object name, IVirtualButton button = null)
23  {
24  Name = name;
25  Button = button;
26  }
27 
28  /// <summary>
29  /// Gets or sets the name of this virtual button.
30  /// </summary>
31  /// <value>The name.</value>
32  public object Name { get; set; }
33 
34  /// <summary>
35  /// Gets or sets the virtual button.
36  /// </summary>
37  /// <value>The virtual button.</value>
38  public IVirtualButton Button { get; set; }
39 
40  /// <summary>
41  /// Gets the value for a particular binding.
42  /// </summary>
43  /// <returns>Value of the binding</returns>
44  public virtual float GetValue(InputManagerBase manager)
45  {
46  return Button != null ? Button.GetValue(manager) : 0.0f;
47  }
48 
49  public override string ToString()
50  {
51  return string.Format("[{0}] => {1}", Name, Button);
52  }
53  }
54 }
Describes a binding between a name and a IVirtualButton.
VirtualButtonBinding(object name, IVirtualButton button=null)
Initializes a new instance of the VirtualButtonBinding class.
virtual float GetValue(InputManagerBase manager)
Gets the value for a particular binding.
Interface for input management system, including keyboard, mouse, gamepads and touch.
VirtualButtonBinding()
Initializes a new instance of the VirtualButtonBinding class.