BUG: TorqueInputDevice.Action
by Scott Goodwin · in Torque X 2D · 03/20/2008 (11:40 am) · 1 replies
TorqueInputDevice.Action enum should be defined with [Flags] attribute. Other parts of the code assume you can OR elements such as data.Modifier |= Action.Ctrl;
Here's the fix: (Part I: split over two posts due to length restriction)
Here's the fix: (Part I: split over two posts due to length restriction)
#region BUG(SDG)
// should be defined with [Flags] attribute since other parts of the code
// assume you can OR elements such as data.Modifier |= Action.Ctrl;
#if !SDG_APPLY_BUGFIXES
/// <summary>
/// Differntiates types of input events.
/// </summary>
public enum Action : int
{
None = 0,
// pure actions
/// <summary>
/// Make events occur when a button or key is pushed.
/// </summary>
Make,
/// <summary>
/// Break events occur when a button or key is released.
/// </summary>
Break,
/// <summary>
/// Move events occur when a thumbstick, trigger, or mouse is moved.
/// </summary>
Move,
// modifiers
/// <summary>
/// A modifier which signifies that an event occured with the shift key held down.
/// </summary>
Shift,
/// <summary>
/// A modifier which signifies that an event occured with the control key held down.
/// </summary>
Ctrl,
/// <summary>
/// A modifier which signifies that an event occured with the left mouse button held down.
/// </summary>
LeftClick,
/// <summary>
/// A modifier which signifies that an event occured with the middle mouse button held down.
/// </summary>
MiddleClick,
/// <summary>
/// A modifier which signifies that an event occured with the right mouse button held down.
/// </summary>
RightClick,
}
#endif
#endregionAbout the author
Torque Owner Scott Goodwin
#region BUGFIX(SDG) #if SDG_APPLY_BUGFIXES /// <summary> /// Differentiates types of input events. /// </summary> [Flags] public enum Action : int { None = 0, // pure actions /// <summary> /// Make events occur when a button or key is pushed. /// </summary> Make = 1, /// <summary> /// Break events occur when a button or key is released. /// </summary> Break = 2, /// <summary> /// Move events occur when a thumbstick, trigger, or mouse is moved. /// </summary> Move = 4, // modifiers /// <summary> /// A modifier which signifies that an event occured with the shift /// key held down. /// </summary> Shift = 8, /// <summary> /// A modifier which signifies that an event occured with the control /// key held down. /// </summary> Ctrl = 16, #region CODE ADDED(SDG) // add support for Alt modifier #if SDG_APPLY_CODE_CHANGES /// <summary> /// A modifier which signifies that an event occured with the alt key /// held down. /// </summary> Alt = 32, #endif #endregion /// <summary> /// A modifier which signifies that an event occured with the left /// mouse button held down. /// </summary> LeftClick = 64, /// <summary> /// A modifier which signifies that an event occured with the middle /// mouse button held down. /// </summary> MiddleClick = 128, /// <summary> /// A modifier which signifies that an event occured with the right /// mouse button held down. /// </summary> RightClick = 256, } #endif #endregion