示例#1
0
    public static void SetupControls(Input input)
    {
        #if WINDOWS
        input.AddButtonMapping((int)E_UiButton.Quit, E_Device.Keyboard, (int)Keys.Escape);
        input.AddButtonMapping((int)E_UiButton.Up, E_Device.Keyboard, (int)Keys.Up);
        input.AddButtonMapping((int)E_UiButton.Down, E_Device.Keyboard, (int)Keys.Down);
        input.AddButtonMapping((int)E_UiButton.Left, E_Device.Keyboard, (int)Keys.Left);
        input.AddButtonMapping((int)E_UiButton.Right, E_Device.Keyboard, (int)Keys.Right);
        input.AddButtonMapping((int)E_UiButton.A, E_Device.Keyboard, (int)Keys.Enter);
        input.AddButtonMapping((int)E_UiButton.B, E_Device.Keyboard, (int)Keys.Back);

        input.AddButtonMapping((int)E_UiButton.MouseLeft, E_Device.Mouse, (int)E_MouseButton.Left);
        input.AddButtonMapping((int)E_UiButton.MouseRight, E_Device.Mouse, (int)E_MouseButton.Right);
        #endif

        #if !RELEASE
        input.AddButtonMapping((int)E_UiButton.Quit, E_Device.Controller, (int)E_Button.RightStick);
        #endif

        input.AddButtonMapping((int)E_UiButton.Up, E_Device.Controller, (int)E_Button.LeftStickUp);
        input.AddButtonMapping((int)E_UiButton.Up, E_Device.Controller, (int)E_Button.DPadUp);
        input.AddButtonMapping((int)E_UiButton.Down, E_Device.Controller, (int)E_Button.LeftStickDown);
        input.AddButtonMapping((int)E_UiButton.Down, E_Device.Controller, (int)E_Button.DPadDown);
        input.AddButtonMapping((int)E_UiButton.Left, E_Device.Controller, (int)E_Button.LeftStickLeft);
        input.AddButtonMapping((int)E_UiButton.Left, E_Device.Controller, (int)E_Button.DPadLeft);
        input.AddButtonMapping((int)E_UiButton.Right, E_Device.Controller, (int)E_Button.LeftStickRight);
        input.AddButtonMapping((int)E_UiButton.Right, E_Device.Controller, (int)E_Button.DPadRight);
        input.AddButtonMapping((int)E_UiButton.A, E_Device.Controller, (int)E_Button.A);
        input.AddButtonMapping((int)E_UiButton.B, E_Device.Controller, (int)E_Button.B);
        input.AddButtonMapping((int)E_UiButton.X, E_Device.Controller, (int)E_Button.X);
        input.AddButtonMapping((int)E_UiButton.Y, E_Device.Controller, (int)E_Button.Y);
        input.AddButtonMapping((int)E_UiButton.Start, E_Device.Controller, (int)E_Button.Start);
        input.AddButtonMapping((int)E_UiButton.Back, E_Device.Controller, (int)E_Button.Back);
        input.AddButtonMapping((int)E_UiButton.LeftTrigger, E_Device.Controller, (int)E_Button.LeftTrigger);
        input.AddButtonMapping((int)E_UiButton.RightTrigger, E_Device.Controller, (int)E_Button.RightTrigger);
        input.AddButtonMapping((int)E_UiButton.LeftShoulder, E_Device.Controller, (int)E_Button.LeftShoulder);
        input.AddButtonMapping((int)E_UiButton.RightShoulder, E_Device.Controller, (int)E_Button.RightShoulder);
        input.AddButtonMapping((int)E_UiButton.LeftStick, E_Device.Controller, (int)E_Button.LeftStick);
        input.AddButtonMapping((int)E_UiButton.RightStick, E_Device.Controller, (int)E_Button.RightStick);
        input.AddButtonMapping((int)E_UiButton.DPadUp, E_Device.Controller, (int)E_Button.DPadUp);
        input.AddButtonMapping((int)E_UiButton.DPadDown, E_Device.Controller, (int)E_Button.DPadDown);
        input.AddButtonMapping((int)E_UiButton.DPadLeft, E_Device.Controller, (int)E_Button.DPadLeft);
        input.AddButtonMapping((int)E_UiButton.DPadRight, E_Device.Controller, (int)E_Button.DPadRight);

        input.AddAxisMapping((int)E_UiAxis.LeftStickX, E_Device.Controller, (int)E_Button.LeftStickLeft, (int)E_Button.LeftStickRight);
        input.AddAxisMapping((int)E_UiAxis.LeftStickY, E_Device.Controller, (int)E_Button.LeftStickDown, (int)E_Button.LeftStickUp);
        input.AddAxisMapping((int)E_UiAxis.RightStickX, E_Device.Controller, (int)E_Button.RightStickLeft, (int)E_Button.RightStickRight);
        input.AddAxisMapping((int)E_UiAxis.RightStickY, E_Device.Controller, (int)E_Button.RightStickDown, (int)E_Button.RightStickUp);
    }
示例#2
0
    public static void SetupControls( Input input )
    {
        #if WINDOWS
        input.AddButtonMapping((int)E_UiButton.D1, E_Device.Keyboard, (int)Keys.D1);
        input.AddButtonMapping((int)E_UiButton.D2, E_Device.Keyboard, (int)Keys.D2);
        input.AddButtonMapping((int)E_UiButton.D3, E_Device.Keyboard, (int)Keys.D3);
        input.AddButtonMapping((int)E_UiButton.D4, E_Device.Keyboard, (int)Keys.D4);
        input.AddButtonMapping((int)E_UiButton.D5, E_Device.Keyboard, (int)Keys.D5);
        input.AddButtonMapping((int)E_UiButton.D6, E_Device.Keyboard, (int)Keys.D6);
        input.AddButtonMapping((int)E_UiButton.D7, E_Device.Keyboard, (int)Keys.D7);
        input.AddButtonMapping((int)E_UiButton.D8, E_Device.Keyboard, (int)Keys.D8);
        input.AddButtonMapping((int)E_UiButton.D9, E_Device.Keyboard, (int)Keys.D9);
        input.AddButtonMapping((int)E_UiButton.D0, E_Device.Keyboard, (int)Keys.D0);

        input.AddButtonMapping((int)E_UiButton.D1, E_Device.Keyboard, (int)Keys.D1);
        input.AddButtonMapping((int)E_UiButton.Space, E_Device.Keyboard, (int)Keys.Space);
        for (int i = (int)E_UiButton.A; i <= (int)E_UiButton.Z;i++ )
        {
            input.AddButtonMapping(i, E_Device.Keyboard, (int)Keys.A + (i - (int)E_UiButton.A));
        }

        input.AddButtonMapping( (int)E_UiButton.Quit, E_Device.Keyboard, (int)Keys.Escape );
        input.AddButtonMapping( (int)E_UiButton.Up, E_Device.Keyboard, (int)Keys.Up );
        input.AddButtonMapping( (int)E_UiButton.Down, E_Device.Keyboard, (int)Keys.Down );
        input.AddButtonMapping( (int)E_UiButton.Left, E_Device.Keyboard, (int)Keys.Left );
        input.AddButtonMapping( (int)E_UiButton.Right, E_Device.Keyboard, (int)Keys.Right );
        input.AddButtonMapping( (int)E_UiButton.Enter, E_Device.Keyboard, (int)Keys.Enter );
        input.AddButtonMapping( (int)E_UiButton.Back, E_Device.Keyboard, (int)Keys.Back );

        input.AddButtonMapping( (int)E_UiButton.MouseLeft, E_Device.Mouse, (int)E_MouseButton.Left );
        input.AddButtonMapping( (int)E_UiButton.MouseRight, E_Device.Mouse, (int)E_MouseButton.Right );
        #endif

        #if !RELEASE
        input.AddButtonMapping( (int)E_UiButton.Quit, E_Device.Controller, (int)E_Button.RightStick );
        #endif

        input.AddButtonMapping( (int)E_UiButton.Up, E_Device.Controller, (int)E_Button.LeftStickUp );
        input.AddButtonMapping( (int)E_UiButton.Up, E_Device.Controller, (int)E_Button.DPadUp );
        input.AddButtonMapping( (int)E_UiButton.Down, E_Device.Controller, (int)E_Button.LeftStickDown );
        input.AddButtonMapping( (int)E_UiButton.Down, E_Device.Controller, (int)E_Button.DPadDown );
        input.AddButtonMapping( (int)E_UiButton.Left, E_Device.Controller, (int)E_Button.LeftStickLeft );
        input.AddButtonMapping( (int)E_UiButton.Left, E_Device.Controller, (int)E_Button.DPadLeft );
        input.AddButtonMapping( (int)E_UiButton.Right, E_Device.Controller, (int)E_Button.LeftStickRight );
        input.AddButtonMapping( (int)E_UiButton.Right, E_Device.Controller, (int)E_Button.DPadRight );
        input.AddButtonMapping( (int)E_UiButton.A, E_Device.Controller, (int)E_Button.A );
        input.AddButtonMapping( (int)E_UiButton.B, E_Device.Controller, (int)E_Button.B );
        input.AddButtonMapping( (int)E_UiButton.X, E_Device.Controller, (int)E_Button.X );
        input.AddButtonMapping( (int)E_UiButton.Y, E_Device.Controller, (int)E_Button.Y );
        input.AddButtonMapping( (int)E_UiButton.Start, E_Device.Controller, (int)E_Button.Start );
        input.AddButtonMapping( (int)E_UiButton.Back, E_Device.Controller, (int)E_Button.Back );
        input.AddButtonMapping( (int)E_UiButton.LeftTrigger, E_Device.Controller, (int)E_Button.LeftTrigger );
        input.AddButtonMapping( (int)E_UiButton.RightTrigger, E_Device.Controller, (int)E_Button.RightTrigger );
        input.AddButtonMapping( (int)E_UiButton.LeftShoulder, E_Device.Controller, (int)E_Button.LeftShoulder );
        input.AddButtonMapping( (int)E_UiButton.RightShoulder, E_Device.Controller, (int)E_Button.RightShoulder );
        input.AddButtonMapping( (int)E_UiButton.LeftStick, E_Device.Controller, (int)E_Button.LeftStick );
        input.AddButtonMapping( (int)E_UiButton.RightStick, E_Device.Controller, (int)E_Button.RightStick );
        input.AddButtonMapping( (int)E_UiButton.DPadUp, E_Device.Controller, (int)E_Button.DPadUp );
        input.AddButtonMapping( (int)E_UiButton.DPadDown, E_Device.Controller, (int)E_Button.DPadDown );
        input.AddButtonMapping( (int)E_UiButton.DPadLeft, E_Device.Controller, (int)E_Button.DPadLeft );
        input.AddButtonMapping( (int)E_UiButton.DPadRight, E_Device.Controller, (int)E_Button.DPadRight );

        input.AddAxisMapping( (int)E_UiAxis.LeftStickX, E_Device.Controller, (int)E_Button.LeftStickLeft, (int)E_Button.LeftStickRight );
        input.AddAxisMapping( (int)E_UiAxis.LeftStickY, E_Device.Controller, (int)E_Button.LeftStickDown, (int)E_Button.LeftStickUp );
        input.AddAxisMapping( (int)E_UiAxis.RightStickX, E_Device.Controller, (int)E_Button.RightStickLeft, (int)E_Button.RightStickRight );
        input.AddAxisMapping( (int)E_UiAxis.RightStickY, E_Device.Controller, (int)E_Button.RightStickDown, (int)E_Button.RightStickUp );
    }
    public static void SetupControls( Input input )
    {
        #if WINDOWS
        input.AddButtonMapping( (int)E_UiButton.Quit, E_Device.Keyboard, (int)Keys.Escape );
        input.AddButtonMapping( (int)E_UiButton.Up, E_Device.Keyboard, (int)Keys.Up );
        input.AddButtonMapping( (int)E_UiButton.Down, E_Device.Keyboard, (int)Keys.Down );
        input.AddButtonMapping( (int)E_UiButton.Left, E_Device.Keyboard, (int)Keys.Left );
        input.AddButtonMapping( (int)E_UiButton.Right, E_Device.Keyboard, (int)Keys.Right );
        input.AddButtonMapping( (int)E_UiButton.A, E_Device.Keyboard, (int)Keys.Enter );
        input.AddButtonMapping( (int)E_UiButton.B, E_Device.Keyboard, (int)Keys.Back );

        input.AddButtonMapping( (int)E_UiButton.MouseLeft, E_Device.Mouse, (int)E_MouseButton.Left );
        input.AddButtonMapping( (int)E_UiButton.MouseRight, E_Device.Mouse, (int)E_MouseButton.Right );
        #endif

        #if !RELEASE
        input.AddButtonMapping( (int)E_UiButton.Quit, E_Device.Controller, (int)E_Button.RightStick );
        #endif

        input.AddButtonMapping( (int)E_UiButton.Up, E_Device.Controller, (int)E_Button.LeftStickUp );
        input.AddButtonMapping( (int)E_UiButton.Up, E_Device.Controller, (int)E_Button.DPadUp );
        input.AddButtonMapping( (int)E_UiButton.Down, E_Device.Controller, (int)E_Button.LeftStickDown );
        input.AddButtonMapping( (int)E_UiButton.Down, E_Device.Controller, (int)E_Button.DPadDown );
        input.AddButtonMapping( (int)E_UiButton.Left, E_Device.Controller, (int)E_Button.LeftStickLeft );
        input.AddButtonMapping( (int)E_UiButton.Left, E_Device.Controller, (int)E_Button.DPadLeft );
        input.AddButtonMapping( (int)E_UiButton.Right, E_Device.Controller, (int)E_Button.LeftStickRight );
        input.AddButtonMapping( (int)E_UiButton.Right, E_Device.Controller, (int)E_Button.DPadRight );
        input.AddButtonMapping( (int)E_UiButton.A, E_Device.Controller, (int)E_Button.A );
        input.AddButtonMapping( (int)E_UiButton.B, E_Device.Controller, (int)E_Button.B );
        input.AddButtonMapping( (int)E_UiButton.X, E_Device.Controller, (int)E_Button.X );
        input.AddButtonMapping( (int)E_UiButton.Y, E_Device.Controller, (int)E_Button.Y );
        input.AddButtonMapping( (int)E_UiButton.Start, E_Device.Controller, (int)E_Button.Start );
        input.AddButtonMapping( (int)E_UiButton.Back, E_Device.Controller, (int)E_Button.Back );
        input.AddButtonMapping( (int)E_UiButton.LeftTrigger, E_Device.Controller, (int)E_Button.LeftTrigger );
        input.AddButtonMapping( (int)E_UiButton.RightTrigger, E_Device.Controller, (int)E_Button.RightTrigger );
        input.AddButtonMapping( (int)E_UiButton.LeftShoulder, E_Device.Controller, (int)E_Button.LeftShoulder );
        input.AddButtonMapping( (int)E_UiButton.RightShoulder, E_Device.Controller, (int)E_Button.RightShoulder );
        input.AddButtonMapping( (int)E_UiButton.LeftStick, E_Device.Controller, (int)E_Button.LeftStick );
        input.AddButtonMapping( (int)E_UiButton.RightStick, E_Device.Controller, (int)E_Button.RightStick );
        input.AddButtonMapping( (int)E_UiButton.DPadUp, E_Device.Controller, (int)E_Button.DPadUp );
        input.AddButtonMapping( (int)E_UiButton.DPadDown, E_Device.Controller, (int)E_Button.DPadDown );
        input.AddButtonMapping( (int)E_UiButton.DPadLeft, E_Device.Controller, (int)E_Button.DPadLeft );
        input.AddButtonMapping( (int)E_UiButton.DPadRight, E_Device.Controller, (int)E_Button.DPadRight );

        input.AddAxisMapping( (int)E_UiAxis.LeftStickX, E_Device.Controller, (int)E_Button.LeftStickLeft, (int)E_Button.LeftStickRight );
        input.AddAxisMapping( (int)E_UiAxis.LeftStickY, E_Device.Controller, (int)E_Button.LeftStickDown, (int)E_Button.LeftStickUp );
        input.AddAxisMapping( (int)E_UiAxis.RightStickX, E_Device.Controller, (int)E_Button.RightStickLeft, (int)E_Button.RightStickRight );
        input.AddAxisMapping( (int)E_UiAxis.RightStickY, E_Device.Controller, (int)E_Button.RightStickDown, (int)E_Button.RightStickUp );
    }