void ProcessInput(TimeSpan delta) { input.Update(); if (!ui.KeyboardGrabbed) { if (input.ActionDown(InputAction.ID_THROTTLEUP)) { shipInput.Throttle += (float)(delta.TotalSeconds); shipInput.Throttle = MathHelper.Clamp(shipInput.Throttle, 0, 1); } else if (input.ActionDown(InputAction.ID_THROTTLEDOWN)) { shipInput.Throttle -= (float)(delta.TotalSeconds); shipInput.Throttle = MathHelper.Clamp(shipInput.Throttle, 0, 1); } } StrafeControls strafe = StrafeControls.None; if (!ui.KeyboardGrabbed) { if (input.ActionDown(InputAction.ID_STRAFELEFT)) { strafe |= StrafeControls.Left; } if (input.ActionDown(InputAction.ID_STRAFERIGHT)) { strafe |= StrafeControls.Right; } if (input.ActionDown(InputAction.ID_STRAFEUP)) { strafe |= StrafeControls.Up; } if (input.ActionDown(InputAction.ID_STRAFEDOWN)) { strafe |= StrafeControls.Down; } } var pc = player.PhysicsComponent; shipInput.Viewport = new Vector2(Game.Width, Game.Height); shipInput.Camera = camera; if (Game.Mouse.IsButtonDown(MouseButtons.Left) || mouseFlight) { var mX = Game.Mouse.X; var mY = Game.Mouse.Y; camera.MousePosition = new Vector2( mX, Game.Height - mY ); shipInput.MouseFlight = true; shipInput.MousePosition = new Vector2(mX, mY); camera.MouseFlight = true; } else { shipInput.MouseFlight = false; camera.MouseFlight = false; } control.CurrentStrafe = strafe; //control.EnginePower = Velocity / MAX_VELOCITY; var obj = GetSelection(Game.Mouse.X, Game.Mouse.Y); current_cur = obj == null ? cur_arrow : cur_reticle; var ep = Vector3Ex.UnProject(new Vector3(Game.Mouse.X, Game.Mouse.Y, 0.25f), camera.Projection, camera.View, new Vector2(Game.Width, Game.Height)); var tgt = Vector3Ex.UnProject(new Vector3(Game.Mouse.X, Game.Mouse.Y, 0f), camera.Projection, camera.View, new Vector2(Game.Width, Game.Height)); var dir = (tgt - ep).Normalized(); weapons.AimPoint = tgt; if (!Game.Mouse.IsButtonDown(MouseButtons.Left) && Game.TotalTime - lastDown < 0.25) { var newselected = GetSelection(Game.Mouse.X, Game.Mouse.Y); if (newselected != null) { selected = newselected; } } if (Game.Mouse.IsButtonDown(MouseButtons.Right)) { weapons.FireAll(); } }