public InputMappings() { ButtonMapping = new ButtonMapping(); AxisMapping = new AxisMapping(); ControllerId = 0; EmulationMapping = new EmulationButtonMapping(); }
/// <summary> /// Returns the index of the button that is to be checked within the controller's mapping configuration. /// </summary> /// <param name="button">The requested button whose index is to be obtained.</param> /// <param name="buttonMappings">The button mapping for the specified controller.</param> /// <returns></returns> public static int DInputGetEmulatedButtonIndex(EmulatedButtonsGeneric button, EmulationButtonMapping buttonMappings) { // Stores the button that is to be checked. int buttonToTest = ButtonNull; // Switch statement checks the mapping of each button to the virtual xbox button. switch (button) { case EmulatedButtonsGeneric.DpadDown: buttonToTest = buttonMappings.DpadDown; break; case EmulatedButtonsGeneric.DpadLeft: buttonToTest = buttonMappings.DpadLeft; break; case EmulatedButtonsGeneric.DpadRight: buttonToTest = buttonMappings.DpadRight; break; case EmulatedButtonsGeneric.DpadUp: buttonToTest = buttonMappings.DpadUp; break; case EmulatedButtonsGeneric.LeftStickDown: buttonToTest = buttonMappings.LeftStickDown; break; case EmulatedButtonsGeneric.LeftStickLeft: buttonToTest = buttonMappings.LeftStickLeft; break; case EmulatedButtonsGeneric.LeftStickRight: buttonToTest = buttonMappings.LeftStickRight; break; case EmulatedButtonsGeneric.LeftStickUp: buttonToTest = buttonMappings.LeftStickUp; break; case EmulatedButtonsGeneric.RightStickDown: buttonToTest = buttonMappings.RightStickDown; break; case EmulatedButtonsGeneric.RightStickLeft: buttonToTest = buttonMappings.RightStickLeft; break; case EmulatedButtonsGeneric.RightStickRight: buttonToTest = buttonMappings.RightStickRight; break; case EmulatedButtonsGeneric.RightStickUp: buttonToTest = buttonMappings.RightStickUp; break; case EmulatedButtonsGeneric.LeftTrigger: buttonToTest = buttonMappings.LeftTrigger; break; case EmulatedButtonsGeneric.RightTrigger: buttonToTest = buttonMappings.RightTrigger; break; } // Return the button that is to be checked. return(buttonToTest); }