Ejemplo n.º 1
0
        public static void InitialiseStandardMappings()
        {
            ControllerMap map = new ControllerMap();

            map.AddAxis(Axis.LeftX, new StandardAxis(0));
            map.AddAxis(Axis.LeftY, new StandardAxis(1, true));

            map.AddAxis(Axis.RightX, new StandardAxis(4));
            map.AddAxis(Axis.RightY, new StandardAxis(3, true));

            map.AddButton(Button.Cross, new StandardButton(0));
            map.AddButton(Button.Circle, new StandardButton(1));
            map.AddButton(Button.Square, new StandardButton(2));
            map.AddButton(Button.Triangle, new StandardButton(3));

            map.AddButton(Button.LeftBumper, new StandardButton(4));
            map.AddButton(Button.RightBumper, new StandardButton(5));
            map.AddButton(Button.LeftTrigger, new AxisButton(2, AxisButton.Type.ActiveAbove, 50f));
            map.AddButton(Button.RightTrigger, new AxisButton(2, AxisButton.Type.ActiveBelow, -50f));

            map.AddButton(Button.Share, new StandardButton(6));
            map.AddButton(Button.Options, new StandardButton(7));

            X360 = map;
        }
Ejemplo n.º 2
0
        public Controller(uint id, ControllerMap map)
        {
            this.id  = id;
            this.map = map;

            // Initialise, should be rewritten asap by the app.
            state = lastState = GetState();
        }
Ejemplo n.º 3
0
        public ControllerState(Controller controller, ControllerMap map)
        {
            buttons = new Dictionary <Button, bool>();
            axises  = new Dictionary <Axis, float>();

            foreach (Axis axis in map.Axises)
            {
                axises[axis] = map.GetAxis(controller, axis);
            }

            foreach (Button button in map.Buttons)
            {
                buttons[button] = map.IsDown(controller, button);
            }
        }