예제 #1
0
 /// <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);
     }
 }
예제 #2
0
        /// <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);
        }