Exemplo n.º 1
0
        /*
         * A deep copy constructor. After copying, the two Buttons will be identical.
         */
        public Button(Button button)
        {
            mIsKey = button.mIsKey;
            mIsMouse = button.mIsMouse;
            mIsButton = button.mIsButton;

            mKey = button.mKey;
            mMouseButton = button.mMouseButton;
            mButton = button.mButton;
        }
Exemplo n.º 2
0
        public Hotkey(Button[] buttons, Modifier[] modifiers = null)
        {
            _keys = new ButtonCombo(buttons);

            initModifiers();

            _modifiers = new bool[Enum.GetNames(typeof(Modifier)).Length];
            for (int i = 0; i < _modifiers.Length; i++)
                _modifiers[i] = false;

            setModifiers(modifiers);
        }
Exemplo n.º 3
0
 public bool IsPressed(Button button)
 {
     return mState.IsPressed((Key) button);
 }
Exemplo n.º 4
0
 /*
  * Initializes the axis to a pair of keys
  *
  * Precondition:
  *      'negative' and 'postive' must not be the same key
  */
 public Axis(Button negative, Button postive)
 {
     setInput(negative, postive);
 }
Exemplo n.º 5
0
        /*
         * Sets the axis to a pair of keys
         *
         * Precondition:
         *      'negative' and 'postive' must not be the same key
         */
        public bool setInput(Button negative, Button postive)
        {
            //Argument Checking
            if (negative == null || postive == null || negative == postive)
                return false;

            mIsAxis = false;
            mIsKeys = true;

            mNegative = new Hotkey(new[] { negative });
            mPositive = new Hotkey(new[] { postive });

            return true;
        }
Exemplo n.º 6
0
 public void setInput(Button[] keys)
 {
     _keys.setInput(keys);
 }
Exemplo n.º 7
0
        private static void initModifiers()
        {
            if (_leftControl != null)
                return;

            _leftControl = new Button(KeyCode.LeftControl);
            _rightControl = new Button(KeyCode.RightControl);

            _leftShift = new Button(KeyCode.LeftShift);
            _rightShift = new Button(KeyCode.RightShift);

            _leftAlt = new Button(KeyCode.LeftAlt);
            _rightAlt = new Button(KeyCode.RightAlt);
        }