Ejemplo n.º 1
0
        static Input SetUpInput()
        {
            Input inp = new InputLib.Input(1f / Stopwatch.Frequency);

            //wasd
            inp.MapAction(MyActions.MoveForward, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.W);
            inp.MapAction(MyActions.MoveLeft, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.A);
            inp.MapAction(MyActions.MoveBack, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.S);
            inp.MapAction(MyActions.MoveRight, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.D);
            inp.MapAction(MyActions.MoveForwardFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.W);
            inp.MapAction(MyActions.MoveBackFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.S);
            inp.MapAction(MyActions.MoveLeftFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.A);
            inp.MapAction(MyActions.MoveRightFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.D);

            //arrow keys
            inp.MapAction(MyActions.MoveForward, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Up);
            inp.MapAction(MyActions.MoveBack, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Down);
            inp.MapAction(MyActions.MoveForwardFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.Up);
            inp.MapAction(MyActions.MoveBackFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.Down);
            inp.MapAction(MyActions.TurnLeft, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Left);
            inp.MapAction(MyActions.TurnRight, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Right);
            inp.MapAction(MyActions.PitchUp, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Q);
            inp.MapAction(MyActions.PitchDown, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.E);

            inp.MapToggleAction(MyActions.ToggleMouseLookOn,
                                MyActions.ToggleMouseLookOff, Modifiers.None,
                                Input.VariousButtons.RightMouseButton);
            inp.MapToggleAction(MyActions.ToggleMouseLookOn,
                                MyActions.ToggleMouseLookOff, Modifiers.ShiftHeld,
                                Input.VariousButtons.RightMouseButton);

            inp.MapAxisAction(MyActions.Pitch, Input.MoveAxis.GamePadRightYAxis);
            inp.MapAxisAction(MyActions.Turn, Input.MoveAxis.GamePadRightXAxis);
            inp.MapAxisAction(MyActions.MoveLeftRight, Input.MoveAxis.GamePadLeftXAxis);
            inp.MapAxisAction(MyActions.MoveForwardBack, Input.MoveAxis.GamePadLeftYAxis);

            //exit
            inp.MapAction(MyActions.Exit, ActionTypes.PressAndRelease,
                          Modifiers.None, System.Windows.Forms.Keys.Escape);
            inp.MapAction(MyActions.Exit, ActionTypes.PressAndRelease,
                          Modifiers.None, Input.VariousButtons.GamePadBack);

            return(inp);
        }
Ejemplo n.º 2
0
        static Input SetUpInput(bool bHoldClickTurn)
        {
            Input inp = new InputLib.Input(1f / Stopwatch.Frequency);

            //exit
            inp.MapAction(MyActions.Exit, ActionTypes.PressAndRelease,
                          Modifiers.None, System.Windows.Forms.Keys.Escape);
            inp.MapAction(MyActions.Exit, ActionTypes.PressAndRelease,
                          Modifiers.None, Input.VariousButtons.GamePadBack);

            return(inp);
        }
Ejemplo n.º 3
0
        static Input SetUpInput(bool bHoldClickTurn)
        {
            Input inp = new InputLib.Input(1f / Stopwatch.Frequency);

            inp.MapAction(MyActions.MoveForward, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.W);
            inp.MapAction(MyActions.MoveLeft, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.A);
            inp.MapAction(MyActions.MoveBack, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.S);
            inp.MapAction(MyActions.MoveRight, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.D);

            //arrow keys
            inp.MapAction(MyActions.MoveForward, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Up);
            inp.MapAction(MyActions.MoveBack, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Down);
            inp.MapAction(MyActions.TurnLeft, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Left);
            inp.MapAction(MyActions.TurnRight, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Right);
            inp.MapAction(MyActions.PitchUp, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Q);
            inp.MapAction(MyActions.PitchDown, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.E);

            //press and hold style jump
            inp.MapAction(MyActions.Jump, ActionTypes.ActivateOnce,
                          Modifiers.None, System.Windows.Forms.Keys.Space);
            inp.MapAction(MyActions.Jump, ActionTypes.ActivateOnce,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.Space);
            inp.MapAction(MyActions.Jump, ActionTypes.ActivateOnce,
                          Modifiers.ControlHeld, System.Windows.Forms.Keys.Space);
            inp.MapAction(MyActions.Jump, ActionTypes.ActivateOnce,
                          Modifiers.None, Input.VariousButtons.GamePadY);

            //climb / swim up / fly up style jump
            inp.MapAction(MyActions.Climb, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Space);

            if (bHoldClickTurn)
            {
                inp.MapToggleAction(MyActions.ToggleMouseLookOn,
                                    MyActions.ToggleMouseLookOff, Modifiers.None,
                                    Input.VariousButtons.RightMouseButton);
            }
            else
            {
                inp.MapAxisAction(MyActions.Pitch, Input.MoveAxis.MouseYAxis);
                inp.MapAxisAction(MyActions.Turn, Input.MoveAxis.MouseXAxis);
            }

            inp.MapAxisAction(MyActions.Pitch, Input.MoveAxis.GamePadRightYAxis);
            inp.MapAxisAction(MyActions.Turn, Input.MoveAxis.GamePadRightXAxis);
            inp.MapAxisAction(MyActions.MoveLeftRight, Input.MoveAxis.GamePadLeftXAxis);
            inp.MapAxisAction(MyActions.MoveForwardBack, Input.MoveAxis.GamePadLeftYAxis);


            //sensitivity adjust
            inp.MapAction(MyActions.SensitivityDown, ActionTypes.PressAndRelease,
                          Modifiers.None, System.Windows.Forms.Keys.OemMinus);
            //for numpad
            inp.MapAction(MyActions.SensitivityUp, ActionTypes.PressAndRelease,
                          Modifiers.None, System.Windows.Forms.Keys.Oemplus);
            //non numpad will have shift held too
            inp.MapAction(MyActions.SensitivityUp, ActionTypes.PressAndRelease,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.Oemplus);

            return(inp);
        }
Ejemplo n.º 4
0
        static Input SetUpInput()
        {
            Input inp = new InputLib.Input(1f / Stopwatch.Frequency);

            inp.MapAction(MyActions.MoveForward, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.W);
            inp.MapAction(MyActions.MoveLeft, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.A);
            inp.MapAction(MyActions.MoveBack, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.S);
            inp.MapAction(MyActions.MoveRight, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.D);
            inp.MapAction(MyActions.MoveForwardFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.W);
            inp.MapAction(MyActions.MoveBackFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.S);
            inp.MapAction(MyActions.MoveLeftFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.A);
            inp.MapAction(MyActions.MoveRightFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.D);

            //arrow keys
            inp.MapAction(MyActions.MoveForward, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Up);
            inp.MapAction(MyActions.MoveBack, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Down);
            inp.MapAction(MyActions.MoveForwardFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.Up);
            inp.MapAction(MyActions.MoveBackFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.Down);
            inp.MapAction(MyActions.TurnLeft, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Left);
            inp.MapAction(MyActions.TurnRight, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Right);
            inp.MapAction(MyActions.PitchUp, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Q);
            inp.MapAction(MyActions.PitchDown, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.E);

            inp.MapAction(MyActions.ToggleFly, ActionTypes.PressAndRelease,
                          Modifiers.None, System.Windows.Forms.Keys.F);

            inp.MapAction(MyActions.Jump, ActionTypes.ActivateOnce,
                          Modifiers.None, System.Windows.Forms.Keys.Space);
            inp.MapAction(MyActions.Jump, ActionTypes.ActivateOnce,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.Space);
            inp.MapAction(MyActions.Jump, ActionTypes.ActivateOnce,
                          Modifiers.ControlHeld, System.Windows.Forms.Keys.Space);
            inp.MapAction(MyActions.Jump, ActionTypes.ActivateOnce,
                          Modifiers.None, Input.VariousButtons.GamePadY);

            inp.MapAction(MyActions.PlaceDynamicLight, ActionTypes.ActivateOnce,
                          Modifiers.None, System.Windows.Forms.Keys.G);
            inp.MapAction(MyActions.ClearDynamicLights, ActionTypes.PressAndRelease,
                          Modifiers.None, System.Windows.Forms.Keys.H);

            inp.MapToggleAction(MyActions.ToggleMouseLookOn,
                                MyActions.ToggleMouseLookOff, Modifiers.None,
                                Input.VariousButtons.RightMouseButton);

            inp.MapAxisAction(MyActions.Pitch, Input.MoveAxis.GamePadRightYAxis);
            inp.MapAxisAction(MyActions.Turn, Input.MoveAxis.GamePadRightXAxis);
            inp.MapAxisAction(MyActions.MoveLeftRight, Input.MoveAxis.GamePadLeftXAxis);
            inp.MapAxisAction(MyActions.MoveForwardBack, Input.MoveAxis.GamePadLeftYAxis);

            inp.MapAction(MyActions.NextAnim, ActionTypes.PressAndRelease,
                          Modifiers.None, System.Windows.Forms.Keys.K);
            inp.MapAction(MyActions.NextLevel, ActionTypes.PressAndRelease,
                          Modifiers.None, System.Windows.Forms.Keys.L);

            //rays
            inp.MapAction(MyActions.RayStart, ActionTypes.PressAndRelease,
                          Modifiers.None, System.Windows.Forms.Keys.T);
            inp.MapAction(MyActions.RayEnd, ActionTypes.PressAndRelease,
                          Modifiers.None, System.Windows.Forms.Keys.Y);
            inp.MapAction(MyActions.RayCrazy, ActionTypes.PressAndRelease,
                          Modifiers.None, System.Windows.Forms.Keys.U);

            //exit
            inp.MapAction(MyActions.Exit, ActionTypes.PressAndRelease,
                          Modifiers.None, System.Windows.Forms.Keys.Escape);
            inp.MapAction(MyActions.Exit, ActionTypes.PressAndRelease,
                          Modifiers.None, Input.VariousButtons.GamePadBack);

            return(inp);
        }
Ejemplo n.º 5
0
        public void AttachInput(InputLib.Input inp)
        {
            mAttachedInput = inp;

            Glfw.SetKeyCallback(mWnd, KeyCB);
        }
Ejemplo n.º 6
0
        static Input SetUpInput()
        {
            Input inp = new InputLib.Input(1f / Stopwatch.Frequency);

            inp.MapAction(MyActions.MoveForward, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.W);
            inp.MapAction(MyActions.MoveLeft, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.A);
            inp.MapAction(MyActions.MoveBack, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.S);
            inp.MapAction(MyActions.MoveRight, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.D);
            inp.MapAction(MyActions.MoveForwardFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.W);
            inp.MapAction(MyActions.MoveBackFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.S);
            inp.MapAction(MyActions.MoveLeftFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.A);
            inp.MapAction(MyActions.MoveRightFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.D);

            //arrow keys
            inp.MapAction(MyActions.MoveForward, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Up);
            inp.MapAction(MyActions.MoveBack, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Down);
            inp.MapAction(MyActions.MoveForwardFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.Up);
            inp.MapAction(MyActions.MoveBackFast, ActionTypes.ContinuousHold,
                          Modifiers.ShiftHeld, System.Windows.Forms.Keys.Down);
            inp.MapAction(MyActions.TurnLeft, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Left);
            inp.MapAction(MyActions.TurnRight, ActionTypes.ContinuousHold,
                          Modifiers.None, System.Windows.Forms.Keys.Right);

            inp.MapAction(MyActions.PitchUp, ActionTypes.ContinuousHold, Modifiers.None, 16);
            inp.MapAction(MyActions.PitchDown, ActionTypes.ContinuousHold, Modifiers.None, 18);
            inp.MapAction(MyActions.LightX, ActionTypes.ContinuousHold, Modifiers.None, 36);
            inp.MapAction(MyActions.LightY, ActionTypes.ContinuousHold, Modifiers.None, 37);
            inp.MapAction(MyActions.LightZ, ActionTypes.ContinuousHold, Modifiers.None, 38);

            inp.MapToggleAction(MyActions.ToggleMouseLookOn,
                                MyActions.ToggleMouseLookOff, Modifiers.None,
                                Input.VariousButtons.RightMouseButton);

            inp.MapAxisAction(MyActions.Pitch, Input.MoveAxis.GamePadRightYAxis);
            inp.MapAxisAction(MyActions.Turn, Input.MoveAxis.GamePadRightXAxis);
            inp.MapAxisAction(MyActions.MoveLeftRight, Input.MoveAxis.GamePadLeftXAxis);
            inp.MapAxisAction(MyActions.MoveForwardBack, Input.MoveAxis.GamePadLeftYAxis);

            inp.MapAction(MyActions.LightX, ActionTypes.ContinuousHold, Modifiers.None, Input.VariousButtons.GamePadDPadLeft);
            inp.MapAction(MyActions.LightY, ActionTypes.ContinuousHold, Modifiers.None, Input.VariousButtons.GamePadDPadDown);
            inp.MapAction(MyActions.LightZ, ActionTypes.ContinuousHold, Modifiers.None, Input.VariousButtons.GamePadDPadRight);

            inp.MapAction(MyActions.IncrementFaceIndex, ActionTypes.PressAndRelease, Modifiers.None, Keys.PageUp);
            inp.MapAction(MyActions.DecrementFaceIndex, ActionTypes.PressAndRelease, Modifiers.None, Keys.PageDown);
            inp.MapAction(MyActions.BigIncrementFaceIndex, ActionTypes.PressAndRelease, Modifiers.ShiftHeld, Keys.PageUp);
            inp.MapAction(MyActions.BigDecrementFaceIndex, ActionTypes.PressAndRelease, Modifiers.ShiftHeld, Keys.PageDown);
            inp.MapAction(MyActions.SnapIndexToAimed, ActionTypes.PressAndRelease, Modifiers.None, Keys.E);

            inp.MapAction(MyActions.ToggleWorld, ActionTypes.PressAndRelease, Modifiers.None, Keys.X);

            inp.MapAction(MyActions.Close, ActionTypes.PressAndRelease, Modifiers.None, Keys.Escape);

            return(inp);
        }