void _SignalButtonEvent(bool down, MouseObjects button) { TorqueInputDevice.InputEventData data = _getEventData((int)button); // data fill in data.Value = down ? 1.0f : 0.0f; data.EventAction = down ? Action.Make : Action.Break; TorqueEventManager.PostEvent(MouseEvent, data); }
void _SignalMoveEvent(int val, MouseObjects axis) { TorqueInputDevice.InputEventData data = _getEventData((int)axis); // data fill in data.Value = (float)-val; data.EventAction = Action.Move; MouseState state = Microsoft.Xna.Framework.Input.Mouse.GetState(); if (state.LeftButton == ButtonState.Pressed) data.Modifier |= Action.LeftClick; if (state.MiddleButton == ButtonState.Pressed) data.Modifier |= Action.MiddleClick; if (state.RightButton == ButtonState.Pressed) data.Modifier |= Action.RightClick; TorqueEventManager.PostEvent(MouseEvent, data); }
static XMouseDevice() { // set up object name <--> id list MouseObjects sample = new MouseObjects(); MouseObjects[] mouseObjects = (MouseObjects[])Enum.GetValues(sample.GetType()); foreach (MouseObjects mouseObject in mouseObjects) _xinputObjectIdList.Add(new KeyValuePair<String, int>(mouseObject.ToString(), (int)mouseObject)); }