public void Update() { if (InputHandler.Get().LockedMouse) { UpdateMouse(); UpdateKeyboard(); } }
private void UpdateMouse() { float rotationSpeed = 0.001f; MouseState currentMouseState = InputHandler.Get().MouseState; float xDifference = currentMouseState.X; float yDifference = currentMouseState.Y; this.leftrightRot += rotationSpeed * xDifference; this.updownRot -= rotationSpeed * yDifference; this.UpdateViewMatrix(); }
private void UpdateKeyboard() { KeyboardState keyState = InputHandler.Get().KeyboardState; if (keyState.IsPressed(Key.Up)) { this.AddToCameraPosition(new Vector3(0, 0, -1)); } if (keyState.IsPressed(Key.Down)) { this.AddToCameraPosition(new Vector3(0, 0, 1)); } if (keyState.IsPressed(Key.Right)) { this.AddToCameraPosition(new Vector3(-1, 0, 0)); } if (keyState.IsPressed(Key.Left)) { this.AddToCameraPosition(new Vector3(1, 0, 0)); } }
public virtual void Update(Timer timer) { InputHandler.Get().Update(); }