public bool CreateAnalogEvent(String macro, out AnalogEvent analogEvent) { String[] tokens = macro.Split( c_spacedelim ); if(tokens.Length > 0 && m_ximAnalogMap.ContainsKey(tokens[0])) { Xim.Analog ximAnalog; ximAnalog = m_ximAnalogMap[tokens[0]]; int deadzone = 0; Joystick.AnalogFlags flags = 0; for( uint i = 1;i < tokens.Length ; i++) { int tryDeadzone; String token = tokens[i]; if (token.StartsWith("-")) { // parse modifiers. token = token.Substring(1); Joystick.AnalogFlags flag = (Joystick.AnalogFlags)Enum.Parse(typeof(Joystick.AnalogFlags), token, true); flags |= flag; } else if (int.TryParse(token, out tryDeadzone)) { deadzone = tryDeadzone; } } analogEvent = new AnalogEvent(ximAnalog, deadzone, flags); return true; } analogEvent = default(AnalogEvent); return false; }
public XInputAnalogEventHandler(Xim.Analog button, AnalogEvent inputEvent) : base(null) { this.button = button; this.inputEvent = inputEvent; }
public JoyAnalogEventHandler(Joystick.Analog button, AnalogEvent inputEvent) : base(null) { this.button = button; this.inputEvent = inputEvent; }