/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { Exit(); } // TODO: Add your update logic here var state = Keyboard.GetState(); foreach (var key in state.GetPressedKeys()) { switch (key) { case Keys.NumPad1: mouse = factory.GetThickLine(mouse.Start, mouse.End, mouse.Color, mouse.Thickness, "Label"); break; case Keys.NumPad2: mouse = factory.GetAngledLine(mouse.Start, mouse.End, mouse.Color, mouse.Thickness, "Label"); break; case Keys.NumPad3: mouse = factory.GetBezierCurve(mouse.Start, mouse.End, mouse.Color, mouse.Thickness, "Label"); break; } } var mouseState = Mouse.GetState(); mouse.End = new Vector2(mouseState.X, mouseState.Y); if (wheel != mouseState.ScrollWheelValue) { mouse.Thickness = wheel < mouseState.ScrollWheelValue ? mouse.Thickness + 1 : mouse.Thickness - 1; } wheel = mouseState.ScrollWheelValue; var translate = Matrix.CreateTranslation(300, 300, 0); transform = Matrix.Invert(translate) * Matrix.CreateRotationZ((float)(0.2f * Math.PI * gameTime.TotalGameTime.TotalSeconds)) * translate; base.Update(gameTime); }