/// <summary> /// Called when the context is shutting down or suspending. It will be /// called before those events and means the context is becoming /// inactive. /// </summary> private void blur() { if (Blurred != null) { Blurred.Invoke(this); } if (!String.IsNullOrEmpty(BlurAction)) { runFinalAction(BlurAction); } }
/// <summary> /// Set per screen. /// </summary> /// <param name="gameTime"></param> public static void Draw(GameTime gameTime) { if (ShouldBlur) { try { GameBase.Game.SpriteBatch.End(); } catch (Exception e) { // ignored } var blur = new GaussianBlur(0.1f); BlurredTexture = blur.PerformGaussianBlur(blur.PerformGaussianBlur(blur.PerformGaussianBlur(blur.PerformGaussianBlur(RawTexture)))); ShouldBlur = false; Blurred?.Invoke(typeof(BackgroundHelper), new BackgroundBlurredEventArgs(Map, BlurredTexture)); } Background?.Draw(gameTime); }