示例#1
0
    public KeyboardDevice(Bindings a_bindings)
    {
        currentBindings = a_bindings;

        int axisCount = (int)InputAxisValue.COUNT;

        axisValues   = new float[axisCount];
        buttonValues = new sbyte[buttonCount];

        axisLookup = new Dictionary <InputAxisValue, string>(axisCount);
        keyLookup  = new Dictionary <InputButtonValue, KeyCode>(buttonCount);

        axisLookup[InputAxisValue.LeftX]  = currentBindings.LeftXAxis;
        axisLookup[InputAxisValue.LeftY]  = currentBindings.LeftYAxis;
        axisLookup[InputAxisValue.RightX] = currentBindings.RightXAxis;
        axisLookup[InputAxisValue.RightY] = currentBindings.RightYAxis;

        keyLookup[InputButtonValue.LeftStickButton]  = currentBindings.LeftStickButton;
        keyLookup[InputButtonValue.RightStickButton] = currentBindings.RightStickButton;

        keyLookup[InputButtonValue.DPadDown]  = currentBindings.DPadDown;
        keyLookup[InputButtonValue.DPadUp]    = currentBindings.DPadUp;
        keyLookup[InputButtonValue.DPadLeft]  = currentBindings.DPadLeft;
        keyLookup[InputButtonValue.DPadRight] = currentBindings.DPadRight;


        keyLookup[InputButtonValue.Action1] = currentBindings.Action1;
        keyLookup[InputButtonValue.Action2] = currentBindings.Action2;
        keyLookup[InputButtonValue.Action3] = currentBindings.Action3;
        keyLookup[InputButtonValue.Action4] = currentBindings.Action4;


        keyLookup[InputButtonValue.LeftTrigger]  = currentBindings.LeftTrigger;
        keyLookup[InputButtonValue.RightTrigger] = currentBindings.RightTrigger;

        keyLookup[InputButtonValue.LeftBumper]  = currentBindings.LeftBumper;
        keyLookup[InputButtonValue.RightBumper] = currentBindings.RightBumper;

        keyLookup[InputButtonValue.Start]   = currentBindings.Start;
        keyLookup[InputButtonValue.Return]  = currentBindings.Return;
        keyLookup[InputButtonValue.Select]  = currentBindings.Select;
        keyLookup[InputButtonValue.Pause]   = currentBindings.Pause;
        keyLookup[InputButtonValue.Menu]    = currentBindings.Menu;
        keyLookup[InputButtonValue.Options] = currentBindings.Options;


        keyboardAxis   = new TwoAxisInput(axisLookup[InputAxisValue.LeftX], axisLookup[InputAxisValue.LeftY]);
        mouseAxis      = new TwoAxisInput(axisLookup[InputAxisValue.RightX], axisLookup[InputAxisValue.RightY]);
        mouseWheelAxis = new OneAxisInput("Mouse ScrollWheel");
    }
示例#2
0
    public void SetupDevice(Bindings a_bindings)
    {
        KeyboardBindings bindings = (KeyboardBindings)a_bindings;

        currentBindings = bindings ? bindings : InputManager.Instance.KeyboardDefaults();

        keyboardAxis   = new TwoAxisInput(currentBindings.LeftXAxis, currentBindings.LeftYAxis);
        mouseAxis      = new TwoAxisInput(currentBindings.RightXAxis, currentBindings.RightYAxis);
        mouseWheelAxis = new OneAxisInput(currentBindings.MouseWheelAxis);

        keyLookup[InputButtonValue.LeftStickButton]  = currentBindings.LeftStickButton;
        keyLookup[InputButtonValue.RightStickButton] = currentBindings.RightStickButton;

        keyLookup[InputButtonValue.DPadDown]  = currentBindings.DPadDown;
        keyLookup[InputButtonValue.DPadUp]    = currentBindings.DPadUp;
        keyLookup[InputButtonValue.DPadLeft]  = currentBindings.DPadLeft;
        keyLookup[InputButtonValue.DPadRight] = currentBindings.DPadRight;


        keyLookup[InputButtonValue.Action1] = currentBindings.Action1;
        keyLookup[InputButtonValue.Action2] = currentBindings.Action2;
        keyLookup[InputButtonValue.Action3] = currentBindings.Action3;
        keyLookup[InputButtonValue.Action4] = currentBindings.Action4;


        keyLookup[InputButtonValue.LeftTrigger]  = currentBindings.LeftTrigger;
        keyLookup[InputButtonValue.RightTrigger] = currentBindings.RightTrigger;

        keyLookup[InputButtonValue.LeftBumper]  = currentBindings.LeftBumper;
        keyLookup[InputButtonValue.RightBumper] = currentBindings.RightBumper;

        keyLookup[InputButtonValue.Start]   = currentBindings.Start;
        keyLookup[InputButtonValue.Return]  = currentBindings.Return;
        keyLookup[InputButtonValue.Select]  = currentBindings.Select;
        keyLookup[InputButtonValue.Pause]   = currentBindings.Pause;
        keyLookup[InputButtonValue.Menu]    = currentBindings.Menu;
        keyLookup[InputButtonValue.Options] = currentBindings.Options;
    }
示例#3
0
 public TwoAxisInput(string a_XAxisName, string a_yAxisName)
 {
     XAxis = new OneAxisInput(a_XAxisName);
     YAxis = new OneAxisInput(a_yAxisName);
 }