private void Mouse(InputHelper state) { Vector2 position = Camera2D.ConvertScreenToWorld(state.MousePosition); if (state.IsOldButtonPress(MouseButtons.LeftButton)) { MouseUp(); } else if (state.IsNewButtonPress(MouseButtons.LeftButton)) { MouseDown(position); } if (_fixedMouseJoint != null) { _fixedMouseJoint.WorldAnchorB = position; } }
public override void HandleInput(InputHelper input) { //Xbox if (input.IsNewButtonPress(Buttons.Start)) { EnableOrDisableFlag(DebugViewFlags.Shape); EnableOrDisableFlag(DebugViewFlags.DebugPanel); EnableOrDisableFlag(DebugViewFlags.PerformanceGraph); } if (input.IsNewButtonPress(Buttons.Back)) { ExitScreen(); } //Windows if (input.IsNewKeyPress(Keys.F1)) { EnableOrDisableFlag(DebugViewFlags.Shape); } else if (input.IsNewKeyPress(Keys.F2)) { EnableOrDisableFlag(DebugViewFlags.DebugPanel); } else if (input.IsNewKeyPress(Keys.F3)) { EnableOrDisableFlag(DebugViewFlags.PerformanceGraph); } else if (input.IsNewKeyPress(Keys.F4)) { EnableOrDisableFlag(DebugViewFlags.AABB); } else if (input.IsNewKeyPress(Keys.F5)) { EnableOrDisableFlag(DebugViewFlags.CenterOfMass); } else if (input.IsNewKeyPress(Keys.F6)) { EnableOrDisableFlag(DebugViewFlags.Joint); } else if (input.IsNewKeyPress(Keys.F7)) { EnableOrDisableFlag(DebugViewFlags.ContactPoints); EnableOrDisableFlag(DebugViewFlags.ContactNormals); } else if (input.IsNewKeyPress(Keys.F8)) { EnableOrDisableFlag(DebugViewFlags.PolygonPoints); } if (input.IsNewKeyPress(Keys.Escape)) { ExitScreen(); } if (World != null) { #if XBOX GamePad(input.CurrentGamePadState, input.LastGamePadState); #else Mouse(input); #endif } base.HandleInput(input); }