public static float GetAxisRaw(XbAxis axis) { switch (axis) { case XbAxis.DPadX: return (float)m.GetDPadXRaw (); case XbAxis.DPadY: return (float)m.GetDPadYRaw (); case XbAxis.LT: return m.GetLTRaw (); case XbAxis.RT: return m.GetRTRaw (); case XbAxis.LY: return -Input.GetAxisRaw (axisToString(axis)); // XXX: Assumes "Y Axis" doesn't have the "Inverted" checkbox checked. case XbAxis.RY: return -Input.GetAxisRaw (axisToString(axis)); default: return Input.GetAxisRaw (axisToString(axis)); } }
static string axisToString(XbAxis axis) { switch(axis) { case XbAxis.LX: return m.LX; case XbAxis.LY: return m.LY; case XbAxis.RX: return m.RX; case XbAxis.RY: return m.RY; case XbAxis.LT: throw new InternalMisuseException ("The range of triggers is OS-specific and requires special handling"); case XbAxis.RT: throw new InternalMisuseException ("The range of triggers is OS-specific and requires special handling"); case XbAxis.DPadX: throw new InternalMisuseException ("On some OSes, D-pad isn't an axis"); case XbAxis.DPadY: throw new InternalMisuseException ("On some OSes, D-pad isn't an axis"); } throw new MakeCSharpHappyException (); }