private static float InputGetAxisState(ref GamePadState state, GmpdAxis gAxis) {

            switch (gAxis) {
                case (GmpdAxis.LStickX): return state.ThumbSticks.Left.X; break;
                case (GmpdAxis.LStickY): return state.ThumbSticks.Left.Y; break;
                case (GmpdAxis.RStickX): return state.ThumbSticks.Right.X; break;
                case (GmpdAxis.RStickY): return state.ThumbSticks.Right.Y; break;
                case (GmpdAxis.LTrigger): return state.Triggers.Left; break;
                case (GmpdAxis.RTrigger): return state.Triggers.Right; break;
            }
            return 0;
        }
        private void UpdateAxisStates(ref InputForm inptForm, GamePadState gmpdState, GmpdAxis[] axsCodes) {
            inptForm.m_axis = new float[axsCodes.Length];

            // Get axises
            for (int j = 0; j < axsCodes.Length; j++) {
                if(IsDPad(axsCodes[j])) {
                    inptForm.m_axis[j] = InputGetDPadAxisState(gmpdState.DPad, axsCodes[j]);
                } else {
                    inptForm.m_axis[j] = InputGetAxisState(ref gmpdState, axsCodes[j]);
                }
            }
        }
Beispiel #3
0
        public static float InputGetDPadAxisState(GamePadDPad pad, GmpdAxis gAxis)
        {
            float valToReturn = 0.0f;

            if (GmpdAxis.DpadX == gAxis)
            {
                valToReturn  = (pad.Left == ButtonState.Pressed ? -1f : 0f);
                valToReturn += (pad.Right == ButtonState.Pressed ? 1f : 0f);
            }
            else if (GmpdAxis.DpadY == gAxis)
            {
                valToReturn  = (pad.Up == ButtonState.Pressed ? 1f : 0f);
                valToReturn += (pad.Down == ButtonState.Pressed ? -1f : 0f);
            }

            return(valToReturn);
        }
Beispiel #4
0
        private static float InputGetAxisState(ref GamePadState state, GmpdAxis gAxis)
        {
            switch (gAxis)
            {
            case (GmpdAxis.LStickX): return(state.ThumbSticks.Left.X); break;

            case (GmpdAxis.LStickY): return(state.ThumbSticks.Left.Y); break;

            case (GmpdAxis.RStickX): return(state.ThumbSticks.Right.X); break;

            case (GmpdAxis.RStickY): return(state.ThumbSticks.Right.Y); break;

            case (GmpdAxis.LTrigger): return(state.Triggers.Left); break;

            case (GmpdAxis.RTrigger): return(state.Triggers.Right); break;
            }
            return(0);
        }
Beispiel #5
0
 public bool IsDPad(GmpdAxis gAxis)
 {
     return(gAxis == GmpdAxis.DpadX ||
            gAxis == GmpdAxis.DpadY);
 }
        public static float InputGetDPadAxisState(GamePadDPad pad, GmpdAxis gAxis) {
            float valToReturn = 0.0f;

            if (GmpdAxis.DpadX == gAxis) {
                valToReturn = (pad.Left == ButtonState.Pressed ? -1f : 0f);
                valToReturn += (pad.Right == ButtonState.Pressed ? 1f : 0f);
            } else if (GmpdAxis.DpadY == gAxis) {
                valToReturn = (pad.Up == ButtonState.Pressed ? 1f : 0f);
                valToReturn += (pad.Down == ButtonState.Pressed ? -1f : 0f);
            }

            return valToReturn;
        }
 public bool IsDPad(GmpdAxis gAxis) {
     return (gAxis == GmpdAxis.DpadX ||
         gAxis == GmpdAxis.DpadY);
 }