/// <summary>Sets up the converters for the game pads axes</summary> private void addAxisConverters() { IList <DeviceObjectInstance> axes = this.joystick.GetObjects( ObjectDeviceType.AbsoluteAxis ); // If this game pad has an X axis, use it for the left thumb stick if (countInstances(axes, ObjectGuid.XAxis) > 0) { int id = (int)getInstance(axes, ObjectGuid.XAxis, 0).ObjectType; ObjectProperties properties = this.joystick.GetObjectPropertiesById(id); convertDelegate += new XAxisConverter( properties.LowerRange, properties.UpperRange ).Convert; } // If this game pad has an Y axis, use it for the left thumb stick if (countInstances(axes, ObjectGuid.YAxis) > 0) { int id = (int)getInstance(axes, ObjectGuid.YAxis, 0).ObjectType; ObjectProperties properties = this.joystick.GetObjectPropertiesById(id); convertDelegate += new YAxisConverter( properties.LowerRange, properties.UpperRange ).Convert; } // If this game pad has a rotational X axis, use it for the right thumb stick if (countInstances(axes, ObjectGuid.RotationalXAxis) > 0) { int id = (int)getInstance(axes, ObjectGuid.RotationalXAxis, 0).ObjectType; ObjectProperties properties = this.joystick.GetObjectPropertiesById(id); convertDelegate += new RotationalXAxisConverter( properties.LowerRange, properties.UpperRange ).Convert; } // If this game pad has a rotational Y axis, use it for the right thumb stick if (countInstances(axes, ObjectGuid.RotationalYAxis) > 0) { int id = (int)getInstance(axes, ObjectGuid.RotationalYAxis, 0).ObjectType; ObjectProperties properties = this.joystick.GetObjectPropertiesById(id); convertDelegate += new RotationalYAxisConverter( properties.LowerRange, properties.UpperRange ).Convert; } }
/// <summary>Sets up the converters for the game pads axes</summary> private void addAxisConverters() { IList<DeviceObjectInstance> axes = this.joystick.GetObjects( ObjectDeviceType.AbsoluteAxis ); // If this game pad has an X axis, use it for the left thumb stick if (countInstances(axes, ObjectGuid.XAxis) > 0) { int id = (int)getInstance(axes, ObjectGuid.XAxis, 0).ObjectType; ObjectProperties properties = this.joystick.GetObjectPropertiesById(id); convertDelegate += new XAxisConverter( properties.LowerRange, properties.UpperRange ).Convert; } // If this game pad has an Y axis, use it for the left thumb stick if (countInstances(axes, ObjectGuid.YAxis) > 0) { int id = (int)getInstance(axes, ObjectGuid.YAxis, 0).ObjectType; ObjectProperties properties = this.joystick.GetObjectPropertiesById(id); convertDelegate += new YAxisConverter( properties.LowerRange, properties.UpperRange ).Convert; } // If this game pad has a rotational X axis, use it for the right thumb stick if (countInstances(axes, ObjectGuid.RotationalXAxis) > 0) { int id = (int)getInstance(axes, ObjectGuid.RotationalXAxis, 0).ObjectType; ObjectProperties properties = this.joystick.GetObjectPropertiesById(id); convertDelegate += new RotationalXAxisConverter( properties.LowerRange, properties.UpperRange ).Convert; } // If this game pad has a rotational Y axis, use it for the right thumb stick if (countInstances(axes, ObjectGuid.RotationalYAxis) > 0) { int id = (int)getInstance(axes, ObjectGuid.RotationalYAxis, 0).ObjectType; ObjectProperties properties = this.joystick.GetObjectPropertiesById(id); convertDelegate += new RotationalYAxisConverter( properties.LowerRange, properties.UpperRange ).Convert; } }