Example #1
0
        public void Update(KeyboardState keystate, KeyboardState lastKeyState)
        {
            if (typ == type.always || isFirstTime)
            {
                if (Game1.isPressed_Inverted(keystate, lastKeyState, name))
                {
                    if (hasBeenPressed)
                    {
                        toReturn       = true;
                        hasBeenPressed = false;
                        isFirstTime    = false;
                    }
                    else
                    {
                        toReturn = false;
                    }
                }
                else
                {
                    toReturn = false;
                }

                if (!hasBeenPressed)
                {
                    hasBeenPressed = Game1.isPressed(keystate, lastKeyState, name);
                }
            }
            else
            {
                toReturn = keystate.IsKeyDown(name);
            }
        }
Example #2
0
        public void Update(MouseState state, MouseState lastState)
        {
            if (isLefttMouse)
            {
                if (Game1.isPressed_Inverted(state, lastState, "l"))
                {
                    if (hasBeenPressed)
                    {
                        toReturn       = true;
                        hasBeenPressed = false;
                    }
                    else
                    {
                        toReturn = false;
                    }
                }
                else
                {
                    toReturn = false;
                }
            }
            else
            {
                if (Game1.isPressed_Inverted(state, lastState, "r"))
                {
                    if (hasBeenPressed)
                    {
                        toReturn       = true;
                        hasBeenPressed = false;
                    }
                    else
                    {
                        toReturn = false;
                    }
                }
                else
                {
                    toReturn = false;
                }
            }

            if (!hasBeenPressed)
            {
                hasBeenPressed = Game1.isPressed(state, lastState, isLefttMouse ? "l" : "r");
            }
        }