Ejemplo n.º 1
0
        public override EffectLayer Render(IGameState gamestate)
        {
            EffectLayer layer = new EffectLayer();

            if (isActive)
            {
                switch (Properties.AnimationType)
                {
                case TimerLayerAnimationType.OnOff:
                    layer.Set(Properties.Sequence, Properties.SecondaryColor);
                    break;

                case TimerLayerAnimationType.Fade:
                    layer.Set(Properties.Sequence, ColorUtils.BlendColors(Properties.SecondaryColor, Properties.PrimaryColor, timer.InterpolationValue));
                    break;

                case TimerLayerAnimationType.Progress:
                case TimerLayerAnimationType.ProgressGradual:
                    layer.PercentEffect(Properties.SecondaryColor, Properties.PrimaryColor, Properties.Sequence, timer.InterpolationValue, 1, Properties.AnimationType == TimerLayerAnimationType.Progress ? PercentEffectType.Progressive : PercentEffectType.Progressive_Gradual);
                    break;
                }
            }
            else
            {
                layer.Set(Properties.Sequence, Properties.PrimaryColor);
            }
            return(layer);
        }
        public override EffectLayer Render(IGameState gamestate)
        {
            EffectLayer layer = new EffectLayer("Background Layer");

            if (gamestate is GameState_Minecraft)
            {
                long time = (gamestate as GameState_Minecraft).World.WorldTime;

                if (time >= 1000 && time <= 11000) // Between 1000 and 11000, world is fully bright day time
                {
                    layer.Set(Properties.Sequence, Properties.PrimaryColor);
                }
                else if (time <= 14000) // Between 11000 and 14000 world transitions from day to night
                {
                    layer.Set(Properties.Sequence, ColorUtils.BlendColors(Properties.PrimaryColor, Properties.SecondaryColor, ((float)(time - 11000) / 3000)));
                }
                else if (time <= 22000) // Between 14000 and 22000 world is fully night time
                {
                    layer.Set(Properties.Sequence, Properties.SecondaryColor);
                }
                else // Between 22000 and 1000 world is transitions from night to day
                {
                    layer.Set(Properties.Sequence, ColorUtils.BlendColors(Properties.SecondaryColor, Properties.PrimaryColor, (((float)(time + 2000) % 24000) / 3000))); // This weird calculation converts range (22,1) into range (0,1) respecting that 24000 = 0
                }
            }
            return(layer);
        }
Ejemplo n.º 3
0
 private void BgFadeOut(EffectLayer animation_layer)
 {
     if (!(layerFadeState > 0))
     {
         return;
     }
     layerFadeState = Math.Max(0, layerFadeState - 0.03f);
     animation_layer.Fill(ColorUtils.BlendColors(Color.Empty, Color.Black, layerFadeState));
 }
        private void lvwIcons_DrawItem(object sender, DrawListViewItemEventArgs e)
        {
            var item = e.Item as IconListViewItem;

            // Draw item

            e.Graphics.InterpolationMode  = InterpolationMode.HighQualityBicubic;
            e.Graphics.CompositingQuality = CompositingQuality.HighQuality;

            if (e.Item.Selected)
            {
                //If the skin ever gets a highlight color property specific
                //to listview (something like ListViewSelectedBackColor),
                //it is the one that we should use here instead of the generic highlight color.
                using (var b = new SolidBrush(FormSkin.HighlightBackColor))
                    e.Graphics.FillRectangle(b, e.Bounds);
            }

            var w = (int)Math.Ceiling(lvwIcons.TileSize.Width * 0.8);
            var h = (int)Math.Ceiling(lvwIcons.TileSize.Height * 0.8);

            var x       = e.Bounds.X + (e.Bounds.Width - w) / 2;
            var y       = e.Bounds.Y + (e.Bounds.Height - h) / 2;
            var dstRect = new Rectangle(x, y, w, h);

            if (item != null)
            {
                var srcRect = new Rectangle(Point.Empty, item.Bitmap.Size);

                e.Graphics.DrawImage(item.Bitmap, dstRect, srcRect, GraphicsUnit.Pixel);
            }

            //Draw a border that uses a blend of the ForeColor and the BackColor to
            //ensure that it is good looking and visible with any skin.
            var borderColor = ColorUtils.BlendColors(FormSkin.ListViewForeColor, 1, FormSkin.ListViewBackColor, 10);
            var borderRect  = e.Bounds;

            borderRect.Width--;
            borderRect.Height--;

            using (var p = new Pen(borderColor))
                e.Graphics.DrawRectangle(p, e.Bounds);
        }
 public Color GetBlendedColor()
 {
     return(ColorUtils.BlendColors(colorFrom, colorTo, transitionProgress));
 }
Ejemplo n.º 6
0
 private void BgFadeIn(EffectLayer animation_layer)
 {
     layerFadeState = Math.Min(1, layerFadeState + 0.07f);
     animation_layer.Fill(ColorUtils.BlendColors(Color.Empty, Color.Black, layerFadeState));
 }