public MouseInputAction(Mouse.Button button, InputState state, Vector2i position = new Vector2i()) { this.button = button; this.state = state; this.mouseInputType = MouseInputType.Button; this.position = position; }
/// <summary> /// Setup for a mouse move event /// </summary> /// <param name="_type"></param> /// <param name="x"></param> /// <param name="y"></param> public MouseInput(MouseInputType _type, int x, int y, int sentivity) { mouseInputType = _type; XMove = x; YMove = y; mouseSensitivity = sentivity; }
/// <summary> /// Get the KeyCode that corresponds to mouse buttons /// </summary> public static KeyCode GetMouseButton(MouseInputType mouseInputType) { if (mouseInputType >= MouseInputType.Mouse0 && mouseInputType <= MouseInputType.Mouse6) { return(KeyCode.Mouse0 + (mouseInputType - MouseInputType.Mouse0)); } return(KeyCode.None); }
public void AddMouseInput(MouseInputType mouseInputType) { DeviceInput input = new DeviceInput(InputDeviceType.Mouse); input.mouseInputType = mouseInputType; input.commonMappingType = CommonGamepadInputs.NOBUTTON; inputs.Add(input); }
void MouseCheck(MouseInputType m) { if (!AcceptChangesFromSlot(-1)) { return; } KeyCode keyCode = KeyCode.Mouse0 + (m - MouseInputType.Mouse0); if (Input.GetKeyDown(keyCode)) { changeFound = true; changedMouse = m; } }
public void AddMouseBinding(MouseInputType type, int commandId) { if (!mouseHandler.MouseState.ContainsKey(type)) { return; } if (!mouseBindings.ContainsKey(commandId)) { mouseBindings.Add(commandId, new List<MouseInputType>()); } mouseBindings[commandId].Add(type); UpdateBindings(commandId); }
public void LogMouseClick(DateTime time, string mouseInput, MouseInputType inputType) { WorksheetRow row = sheet.Table.Rows.Add(); row.Cells.Add(this.GetTime(time).ToString()); if (inputType.Equals(MouseInputType.Released)) { row.Cells.Add("Released"); } else { row.Cells.Add("Pressed"); } row.Cells.Add(""); row.Cells.Add(""); row.Cells.Add(mouseInput); }
void MouseCheck(MouseInputType m) { if (!AcceptChangesFromSlot(-1)) { return; } bool change = false; if (m == MouseInputType.Mouse0 && Input.GetKeyDown(KeyCode.Mouse0)) { change = true; } if (m == MouseInputType.Mouse1 && Input.GetKeyDown(KeyCode.Mouse1)) { change = true; } if (m == MouseInputType.Mouse2 && Input.GetKeyDown(KeyCode.Mouse2)) { change = true; } if (m == MouseInputType.Mouse3 && Input.GetKeyDown(KeyCode.Mouse3)) { change = true; } if (m == MouseInputType.Mouse4 && Input.GetKeyDown(KeyCode.Mouse4)) { change = true; } if (m == MouseInputType.Mouse5 && Input.GetKeyDown(KeyCode.Mouse5)) { change = true; } if (m == MouseInputType.Mouse6 && Input.GetKeyDown(KeyCode.Mouse6)) { change = true; } if (change) { changeFound = true; changedMouse = m; } }
// Update is called once per frame void Update() { changeFound = false; changedKey = KeyCode.None; changedPadAxis = new gamepadStateChange(); changedPadAxis.padIndex = -1; changedPadAxis.inputIndex = -1; changedPadAxis.axisMotionIsPositive = true; changedPadAxis.restingValue = 0f; changedPadAxis.minRecordedValue = 0f; changedPadAxis.maxRecordedValue = 0f; changedPadButton = new gamepadStateChange(); changedPadButton.padIndex = -1; changedPadButton.inputIndex = -1; changedMouse = MouseInputType.None; //keyboard check foreach (KeyboardInputType keycode in Enum.GetValues(typeof(KeyboardInputType))) { KeyCheck((KeyCode)Enum.Parse(typeof(KeyCode), keycode.ToString())); } //gamepad checks UpdateAxisMonitoring(); //mouse checks if (AcceptChangesFromSlot(-1)) { mouseHorizontalTotal += Input.GetAxis("Mouse Horizontal"); mouseVerticalTotal += Input.GetAxis("Mouse Vertical"); mouseScrollTotal += Input.GetAxis("Mouse Scroll"); if (mouseHorizontalTotal > mouseMovementMin) { changedMouse = MouseInputType.MouseMoveRight; } if (mouseHorizontalTotal < -mouseMovementMin) { changedMouse = MouseInputType.MouseMoveLeft; } if (mouseVerticalTotal > mouseMovementMin) { changedMouse = MouseInputType.MouseMoveUp; } if (mouseVerticalTotal < -mouseMovementMin) { changedMouse = MouseInputType.MouseMoveDown; } if (mouseScrollTotal >= 1) { changedMouse = MouseInputType.MouseScrollUp; } if (mouseScrollTotal <= -1) { changedMouse = MouseInputType.MouseScrollDown; } if (changedMouse != MouseInputType.None) { changeFound = true; } } foreach (MouseInputType mouseInput in Enum.GetValues(typeof(MouseInputType))) { MouseCheck(mouseInput); } /*if (changeFound){ * if (changedKey != KeyCode.None){ * //change was keyboard input * Debug.Log(changedKey.ToString()); * } * if (changedPadAxis.padIndex >=0){ * //change was a gamepad axis * Debug.Log("Found change in gamepad " + (changedPadAxis.padIndex+1).ToString() + " axis " + (changedPadAxis.inputIndex+1).ToString()); * } * if (changedPadButton.padIndex >=0){ * //change was a gamepad button * Debug.Log("Found change in gamepad " + (changedPadButton.padIndex+1).ToString() + " button " + changedPadButton.inputIndex.ToString()); * } * if (changedMouse != MouseInputType.None){ * //change was mouse click * Debug.Log(changedMouse.ToString()); * } * }*/ }
public void LogMouseClick(DateTime time, String mouseInput, MouseInputType inputType, int x, int y) { sw.Write(this.GetTime(time) + "\t" + inputType.ToString() + " " + mouseInput + "\t" + x.ToString() + "\t" + y.ToString() + "\r\n"); }
public static bool GetMouseButton(MouseInputType keyCode) { return(instance.mouse[(int)keyCode]); }
private void SetMouseButtonState(MouseInputType button, ButtonState state, ButtonState previousState) { // The button is pressed if (state == ButtonState.Pressed) { MouseState[button].Pressed = true; MouseState[button].Value = 1; // If the button was just pressed if (previousState != ButtonState.Pressed) { MouseState[button].WasJustPressed = true; } } // The button is released else { // If the button was just released if (previousState == ButtonState.Pressed) { MouseState[button].WasJustReleased = true; } } }
private void SetMouseAnalogState(MouseInputType button, int current, int previous) { float delta = previous - current; // The button is pressed if (delta != 0f) { MouseState[button].Pressed = true; MouseState[button].Value = delta * Sensitivity; } }
public MouseInputAction(Mouse.Wheel wheel, InputState state, Vector2f delta = new Vector2f()) { this.mouseInputType = MouseInputType.Wheel; }
public MouseInput(MouseInputType _type, bool _clickType) { mouseInputType = _type; clickType = _clickType; }
/// <summary> /// ClickType false = left click, true = right click /// </summary> /// <param name="_type"></param> /// <param name="clickType"></param> public MouseInput(MouseInputType _type, bool _clickType, int _duration) { mouseInputType = _type; clickType = _clickType; duration = _duration; }