Example #1
0
        private static InputState GetOtherState(OtherInput pOtherInput)
        {
            InputState state = new InputState();

            state.Down = false;
            state.Pressed = false;
            state.Released = false;

            if (sOtherInputState.ContainsKey(pOtherInput))
            {
                state.Down |= sOtherInputState[pOtherInput].Down;
                state.Pressed |= sOtherInputState[pOtherInput].Pressed;
                state.Released |= sOtherInputState[pOtherInput].Released;
            }

            return state;
        }
Example #2
0
        private static InputState GetMouseState(MouseButtons pMouseButton)
        {
            InputState state = new InputState();

            state.Down = false;
            state.Pressed = false;
            state.Released = false;

            if (sMouseInputState.ContainsKey(pMouseButton))
            {
                state.Down |= sMouseInputState[pMouseButton].Down;
                state.Pressed |= sMouseInputState[pMouseButton].Pressed;
                state.Released |= sMouseInputState[pMouseButton].Released;
            }

            return state;
        }
Example #3
0
        private static InputState GetOtherState(string alias)
        {
            InputState state = new InputState();

            state.Down = false;
            state.Pressed = false;
            state.Released = false;

            if (sOtherAlias.ContainsKey(alias))
            {
                foreach (OtherInput otherInput in sOtherAlias[alias])
                {
                    if (sOtherInputState.ContainsKey(otherInput))
                    {
                        state.Down |= sOtherInputState[otherInput].Down;
                        state.Pressed |= sOtherInputState[otherInput].Pressed;
                        state.Released |= sOtherInputState[otherInput].Released;
                    }
                }
            }

            return state;
        }
Example #4
0
        private static InputState GetKeyState(Keys pKey)
        {
            InputState state = new InputState();

            state.Down = false;
            state.Pressed = false;
            state.Released = false;

            if (sKeyInputState.ContainsKey(pKey))
            {
                state.Down |= sKeyInputState[pKey].Down;
                state.Pressed |= sKeyInputState[pKey].Pressed;
                state.Released |= sKeyInputState[pKey].Released;
            }

            return state;
        }
Example #5
0
        private static InputState GetMouseState(string alias)
        {
            InputState state = new InputState();

            state.Down = false;
            state.Pressed = false;
            state.Released = false;

            if (sMouseAlias.ContainsKey(alias))
            {
                foreach (MouseButtons mouseButton in sMouseAlias[alias])
                {
                    if (sMouseInputState.ContainsKey(mouseButton))
                    {
                        state.Down |= sMouseInputState[mouseButton].Down;
                        state.Pressed |= sMouseInputState[mouseButton].Pressed;
                        state.Released |= sMouseInputState[mouseButton].Released;
                    }
                }
            }

            return state;
        }
Example #6
0
        private void UpdateMouse()
        {
            MouseState oldState = sMouseState;
            sMouseState = Mouse.GetState();

            MouseButtons[] mouseButtons = sMouseInputState.Keys.ToArray<MouseButtons>();

            foreach (MouseButtons mouseButton in mouseButtons)
            {

                InputState state = new InputState();

                ButtonState curMouseState = GetMouseButtonState(mouseButton, sMouseState);
                ButtonState oldMouseState = GetMouseButtonState(mouseButton, oldState);

                state.Down = (curMouseState == ButtonState.Pressed);
                state.Pressed = ((curMouseState == ButtonState.Pressed) && (oldMouseState == ButtonState.Released));
                state.Released = ((curMouseState == ButtonState.Released) && (oldMouseState == ButtonState.Pressed));

                sMouseInputState[mouseButton] = state;

            }
        }
Example #7
0
        public void Alias(string pIndex, Buttons pButton)
        {
            if (!sGamePadAlias.ContainsKey(pIndex))
                sGamePadAlias.Add(pIndex, new List<Buttons>());

            sGamePadAlias[pIndex].Add(pButton);

            if (!sGamePadInputState.ContainsKey(pButton))
            {

                InputState state = new InputState();

                state.Down = sGamePadState.IsButtonDown(pButton);
                state.Pressed = false;
                state.Released = false;

                sGamePadInputState.Add(pButton, state);
            }
        }
Example #8
0
        public void Listen(OtherInput pOtherInput)
        {
            if (!sOtherInputState.ContainsKey(pOtherInput))
            {

                InputState state = new InputState();

                OtherInputState otherState = GetOtherState(pOtherInput, sOtherState);

                state.Down = (otherState == OtherInputState.Pressed);
                state.Pressed = false;
                state.Released = false;

                sOtherInputState.Add(pOtherInput, state);
            }
        }
Example #9
0
        private static InputState GetGamePadState(string alias)
        {
            InputState state = new InputState();

            state.Down = false;
            state.Pressed = false;
            state.Released = false;

            if (sGamePadAlias.ContainsKey(alias))
            {
                foreach (Buttons button in sGamePadAlias[alias])
                {
                    if (sGamePadInputState.ContainsKey(button))
                    {
                        state.Down |= sGamePadInputState[button].Down;
                        state.Pressed |= sGamePadInputState[button].Pressed;
                        state.Released |= sGamePadInputState[button].Released;
                    }
                }
            }

            return state;
        }
Example #10
0
        public void Listen(Buttons pButton)
        {
            if (!sGamePadInputState.ContainsKey(pButton))
            {

                InputState state = new InputState();

                state.Down = sGamePadState.IsButtonDown(pButton);
                state.Pressed = false;
                state.Released = false;

                sGamePadInputState.Add(pButton, state);
            }
        }
Example #11
0
        public void Listen(MouseButtons pMouseButton)
        {
            if (!sMouseInputState.ContainsKey(pMouseButton))
            {

                InputState state = new InputState();

                ButtonState mouseState = GetMouseButtonState(pMouseButton, sMouseState);

                state.Down = (mouseState == ButtonState.Pressed);
                state.Pressed = false;
                state.Released = false;

                sMouseInputState.Add(pMouseButton, state);
            }
        }
Example #12
0
        public void Listen(Keys pKey)
        {
            if (!sKeyInputState.ContainsKey(pKey))
            {

                InputState state = new InputState();

                state.Down = sKeyState.IsKeyDown(pKey);
                state.Pressed = false;
                state.Released = false;

                sKeyInputState.Add(pKey, state);
            }
        }
Example #13
0
        public void Alias(string pIndex, OtherInput pOtherInput)
        {
            if (!sOtherAlias.ContainsKey(pIndex))
                sOtherAlias.Add(pIndex, new List<OtherInput>());

            sOtherAlias[pIndex].Add(pOtherInput);

            if (!sOtherInputState.ContainsKey(pOtherInput))
            {

                InputState state = new InputState();

                OtherInputState otherState = GetOtherState(pOtherInput, sOtherState);

                state.Down = (otherState == OtherInputState.Pressed);
                state.Pressed = false;
                state.Released = false;

                sOtherInputState.Add(pOtherInput, state);
            }
        }
Example #14
0
        public void Alias(string pIndex, MouseButtons pMouseButton)
        {
            if (!sMouseAlias.ContainsKey(pIndex))
                sMouseAlias.Add(pIndex, new List<MouseButtons>());

            sMouseAlias[pIndex].Add(pMouseButton);

            if (!sMouseInputState.ContainsKey(pMouseButton))
            {

                InputState state = new InputState();

                ButtonState mouseState = GetMouseButtonState(pMouseButton, sMouseState);

                state.Down = (mouseState == ButtonState.Pressed);
                state.Pressed = false;
                state.Released = false;

                sMouseInputState.Add(pMouseButton, state);
            }
        }
Example #15
0
        private void UpdateGamePad()
        {
            GamePadState oldState = sGamePadState;
            sGamePadState = GamePad.GetState(PlayerIndex.One);

            Buttons[] buttons = sGamePadInputState.Keys.ToArray<Buttons>();

            foreach (Buttons button in buttons)
            {

                InputState state = new InputState();

                state.Down = sGamePadState.IsButtonDown(button);
                state.Pressed = (sGamePadState.IsButtonDown(button) && oldState.IsButtonUp(button));
                state.Released = (sGamePadState.IsButtonUp(button) && oldState.IsButtonDown(button));

                sGamePadInputState[button] = state;

            }
        }
Example #16
0
        private static InputState GetGamePadState(Buttons pButton)
        {
            InputState state = new InputState();

            state.Down = false;
            state.Pressed = false;
            state.Released = false;

            if (sGamePadInputState.ContainsKey(pButton))
            {
                state.Down |= sGamePadInputState[pButton].Down;
                state.Pressed |= sGamePadInputState[pButton].Pressed;
                state.Released |= sGamePadInputState[pButton].Released;
            }

            return state;
        }
Example #17
0
        private void UpdateKeyboard()
        {
            KeyboardState oldState = sKeyState;
            sKeyState = Keyboard.GetState();

            Keys[] keys = sKeyInputState.Keys.ToArray<Keys>();

            foreach (Keys key in keys)
            {

                InputState state = new InputState();

                state.Down = sKeyState.IsKeyDown(key);
                state.Pressed = (sKeyState.IsKeyDown(key) && oldState.IsKeyUp(key));
                state.Released = (sKeyState.IsKeyUp(key) && oldState.IsKeyDown(key));

                sKeyInputState[key] = state;

            }
        }
Example #18
0
        private static InputState GetKeyState(string alias)
        {
            InputState state = new InputState();

            state.Down = false;
            state.Pressed = false;
            state.Released = false;

            if (sKeyAlias.ContainsKey(alias))
            {
                foreach (Keys key in sKeyAlias[alias])
                {
                    if (sKeyInputState.ContainsKey(key))
                    {
                        state.Down |= sKeyInputState[key].Down;
                        state.Pressed |= sKeyInputState[key].Pressed;
                        state.Released |= sKeyInputState[key].Released;
                    }
                }
            }

            return state;
        }
Example #19
0
        private void UpdateOther()
        {
            OtherState oldState = sOtherState;
            sOtherState = OtherState.GetState();

            OtherInput[] otherInputs = sOtherInputState.Keys.ToArray<OtherInput>();

            foreach (OtherInput otherInput in otherInputs)
            {

                InputState state = new InputState();

                OtherInputState curOtherState = GetOtherState(otherInput, sOtherState);
                OtherInputState oldOtherState = GetOtherState(otherInput, oldState);

                state.Down = (curOtherState == OtherInputState.Pressed);
                state.Pressed = ((curOtherState == OtherInputState.Pressed) && (oldOtherState == OtherInputState.Released));
                state.Released = ((curOtherState == OtherInputState.Released) && (oldOtherState == OtherInputState.Pressed));

                sOtherInputState[otherInput] = state;

            }
        }
Example #20
0
        public void Alias(string pIndex, Keys pKey)
        {
            if (!sKeyAlias.ContainsKey(pIndex))
                sKeyAlias.Add(pIndex, new List<Keys>());

            sKeyAlias[pIndex].Add(pKey);

            if (!sKeyInputState.ContainsKey(pKey))
            {

                InputState state = new InputState();

                state.Down = sKeyState.IsKeyDown(pKey);
                state.Pressed = false;
                state.Released = false;

                sKeyInputState.Add(pKey, state);
            }
        }