/* * 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; }
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); }
public bool IsPressed(Button button) { return mState.IsPressed((Key) button); }
/* * 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); }
/* * 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; }
public void setInput(Button[] keys) { _keys.setInput(keys); }
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); }