protected override void OnDraw(IBatchRenderer sbatch)
        {
            var outerBounds = FRectangle.CreateByCenter(Position, DrawingBoundingBox);
            var innerBounds = FRectangle.CreateByCenter(Position, new FSize(INNERSIZE, INNERSIZE));

            if (!MainGame.Inst.Profile.GetLevelData(Levels.LEVEL_TUTORIAL.UniqueID).HasAnyCompleted())
            {
                var iconBounds = FRectangle.CreateByCenter(Position, new FSize(ICONSIZE + ICONSIZESWIGGLE * FloatMath.Sin(Lifetime), ICONSIZE + ICONSIZESWIGGLE * FloatMath.Sin(Lifetime)));

                FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
                SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

                sbatch.FillRectangle(innerBounds, FlatColors.Background);

                sbatch.DrawStretched(Textures.TexIconTutorial, iconBounds, Color.White * AlphaOverride);

                FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
            }
            else
            {
                var iconBounds = FRectangle.CreateByCenter(Position, new FSize(ICONSIZE, ICONSIZE));

                FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
                SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

                sbatch.FillRectangle(innerBounds, FlatColors.Background);

                sbatch.DrawStretched(Textures.TexIconTutorial, iconBounds, FlatColors.Emerald * AlphaOverride);

                FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
            }
        }
        private void DrawScreenDebug(IBatchRenderer sbatch)
        {
            if (DebugSettings.Get("DebugBackground"))
            {
                DebugRenderHelper.DrawCrossedCircle(sbatch, Color.Red, MapViewportCenter, 8, 2);
                DebugRenderHelper.DrawHalfCrossedCircle(sbatch, Color.Red, MapOffset.Negate(), 8, 2);

                var rTop = new FRectangle(CompleteMapViewport.X, CompleteMapViewport.Y, CompleteMapViewport.Width, GuaranteedMapViewport.Y - CompleteMapViewport.Y);
                var rBot = new FRectangle(CompleteMapViewport.X, GuaranteedMapViewport.Bottom, CompleteMapViewport.Width, CompleteMapViewport.Bottom - GuaranteedMapViewport.Bottom);
                var rLef = new FRectangle(CompleteMapViewport.X, CompleteMapViewport.Y, GuaranteedMapViewport.X - CompleteMapViewport.X, CompleteMapViewport.Height);
                var rRig = new FRectangle(GuaranteedMapViewport.Right, CompleteMapViewport.Y, CompleteMapViewport.Right - GuaranteedMapViewport.Right, CompleteMapViewport.Height);

                if (rTop.Area > 0.001f)
                {
                    sbatch.FillRectangle(rTop, Color.DarkRed * 0.35f);
                }
                if (rBot.Area > 0.001f)
                {
                    sbatch.FillRectangle(rBot, Color.DarkRed * 0.35f);
                }
                if (rLef.Area > 0.001f)
                {
                    sbatch.FillRectangle(rLef, Color.DarkRed * 0.35f);
                }
                if (rRig.Area > 0.001f)
                {
                    sbatch.FillRectangle(rRig, Color.DarkRed * 0.35f);
                }

                sbatch.DrawRectangle(GuaranteedMapViewport, Color.Red * 0.8f, 1f);
            }
        }
Beispiel #3
0
        public void Draw(IBatchRenderer sbatch)
        {
            if (!DebugSettings.Get("ShowDebugMiniMap"))
            {
                return;
            }

            var rectBoundings = Owner.MapFullBounds;
            var scale         = FloatMath.Min(MaxSize / rectBoundings.Width, MaxSize / rectBoundings.Height);

            var sizeOuter = rectBoundings.AsScaled(scale).Size;
            var sizeView  = Owner.GuaranteedMapViewport.AsScaled(scale).Size;
            var sizeView2 = Owner.CompleteMapViewport.AsScaled(scale).Size;
            var posView   = (Owner.GuaranteedMapViewport.VectorTopLeft - rectBoundings.VectorTopLeft) * scale;
            var posView2  = (Owner.CompleteMapViewport.VectorTopLeft - rectBoundings.VectorTopLeft) * scale;

            var offset     = new FPoint(Owner.VAdapterHUD.VirtualTotalWidth - Padding - sizeOuter.Width, Padding) - Owner.VAdapterHUD.VirtualGuaranteedBoundingsOffset;
            var offsetZero = offset - rectBoundings.VectorTopLeft * scale;

            sbatch.FillRectangle(offset, sizeOuter, Color.Red * 0.25f);
            sbatch.DrawRectangle(offset, sizeOuter, Color.Red);

            sbatch.FillRectangle(offset + posView, sizeView, Color.Black * 0.1f);
            sbatch.DrawRectangle(offset + posView, sizeView, Color.Black, 2);
            sbatch.DrawRectangle(offset + posView2, sizeView2, Color.Black * 0.666f, 1);

            sbatch.DrawLine(offsetZero.X, offset.Y, offsetZero.X, offset.Y + sizeOuter.Height, Color.Black * 0.5f);
            sbatch.DrawLine(offset.X, offsetZero.Y, offset.X + sizeOuter.Width, offsetZero.Y, Color.Black * 0.5f);
            sbatch.FillRectangle(FRectangle.CreateByCenter(offsetZero, 0, 0, 5, 5), Color.Black * 0.5f);

            foreach (var entity in Owner.GetAllEntities())
            {
                float radius = scale * (entity.DrawingBoundingBox.Width + entity.DrawingBoundingBox.Height) / 4;

                if (radius < 0.5f)
                {
                    continue;
                }

                if (entity.IsInViewport)
                {
                    if (entity.DebugIdentColor.A > 0)
                    {
                        sbatch.FillCircle(offsetZero + entity.Position.ToVec2D() * scale, radius, 8, entity.DebugIdentColor * 0.85f);
                    }
                }
                else
                {
                    if (entity.DebugIdentColor.A > 0)
                    {
                        sbatch.FillCircle(offsetZero + entity.Position.ToVec2D() * scale, radius, 8, entity.DebugIdentColor * 0.25f);
                    }
                }
            }
        }
Beispiel #4
0
 protected override void OnDraw(IBatchRenderer sbatch)
 {
     if (rectHorz != null)
     {
         sbatch.FillRectangle(rectHorz.Value, NodeSource.NodeEnabled ? COLOR_ON : COLOR_OFF);
     }
     if (rectVert != null)
     {
         sbatch.FillRectangle(rectVert.Value, NodeSource.NodeEnabled ? COLOR_ON : COLOR_OFF);
     }
 }
Beispiel #5
0
 protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
 {
     if (_dimFactor > 0)
     {
         if (Lifetime >= _dimTime)
         {
             sbatch.FillRectangle(bounds, Color.Black * _dimFactor);
         }
         else
         {
             sbatch.FillRectangle(bounds, Color.Black * FloatMath.Lerp(0, _dimFactor, Lifetime / _dimTime));
         }
     }
 }
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            var outerBounds = FRectangle.CreateByCenter(Position, DrawingBoundingBox);
            var innerBounds = FRectangle.CreateByCenter(Position, new FSize(INNERSIZE, INNERSIZE));

            FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
            SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

            sbatch.FillRectangle(innerBounds, FlatColors.Background);

            var scoreRectSize = innerBounds.Width / 8f;

            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    var bc = ((x % 2 == 0) ^ (y % 2 == 0)) ? FlatColors.Background : FlatColors.BackgroundLight;

                    if (_ustate == WorldUnlockState.OpenAndUnlocked)
                    {
                        var d = FloatMath.Sqrt((x - 3.5f) * (x - 3.5f) + (y - 3.5f) * (y - 3.5f));

                        var p = 1 - (d / 4.5f);
                        if (p < 0)
                        {
                            p = 0;
                        }

                        p *= FloatMath.PercSin(_pulseTimer * FloatMath.TAU * 0.25f);

                        bc = ColorMath.Blend(bc, FlatColors.PeterRiver, p);
                    }

                    var col = ColorMath.Blend(FlatColors.Background, bc, AlphaOverride);
                    sbatch.FillRectangle(new FRectangle(innerBounds.X + scoreRectSize * x, innerBounds.Y + scoreRectSize * y, scoreRectSize, scoreRectSize), col);
                }
            }

            sbatch.DrawStretched(Textures.TexIconNetworkBase, innerBounds, Color.White);
            sbatch.DrawStretched(Textures.TexIconNetworkVertex1, innerBounds, Color.White, VertexRotations[0]);
            sbatch.DrawStretched(Textures.TexIconNetworkVertex2, innerBounds, Color.White, VertexRotations[1]);
            sbatch.DrawStretched(Textures.TexIconNetworkVertex3, innerBounds, Color.White, VertexRotations[2]);
            sbatch.DrawStretched(Textures.TexIconNetworkVertex4, innerBounds, Color.White, VertexRotations[3]);
            sbatch.DrawStretched(Textures.TexIconNetworkVertex5, innerBounds, Color.White, VertexRotations[4]);

            sbatch.DrawRectangle(innerBounds, Color.Black, Owner.PixelWidth);

            FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
        }
Beispiel #7
0
        protected void DrawGridProgress(IBatchRenderer sbatch)
        {
            var outerBounds = FRectangle.CreateByCenter(Position, DrawingBoundingBox);
            var innerBounds = FRectangle.CreateByCenter(Position, new FSize(INNERSIZE, INNERSIZE));

            var scoreRectSize = innerBounds.Width / 8f;

            FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
            SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    var col = ColorMath.Blend(FlatColors.Background, GetCellColor(x, y), AlphaOverride);
                    sbatch.FillRectangle(new FRectangle(innerBounds.X + scoreRectSize * x, innerBounds.Y + scoreRectSize * y, scoreRectSize, scoreRectSize), col);
                }
            }

            for (int i = 0; i <= 8; i++)
            {
                sbatch.DrawLine(innerBounds.Left, innerBounds.Top + i * scoreRectSize, innerBounds.Right, innerBounds.Top + i * scoreRectSize, Color.Black * AlphaOverride, Owner.PixelWidth);
                sbatch.DrawLine(innerBounds.Left + i * scoreRectSize, innerBounds.Top, innerBounds.Left + i * scoreRectSize, innerBounds.Bottom, Color.Black * AlphaOverride, Owner.PixelWidth);
            }

            FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
        }
Beispiel #8
0
        protected override void DrawDebugBorders(IBatchRenderer sbatch)
        {
            base.DrawDebugBorders(sbatch);

            sbatch.FillRectangle(TargetNodePos.AsTranslated(-DrawingBoundingBox.Width * 0.5f, -DrawingBoundingBox.Height * 0.5f), DrawingBoundingBox, Color.Firebrick * 0.2f);
            sbatch.DrawRectangle(TargetNodePos.AsTranslated(-DrawingBoundingBox.Width * 0.5f, -DrawingBoundingBox.Height * 0.5f), DrawingBoundingBox, Color.Firebrick, 2);
        }
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            sbatch.FillRectangle(bounds, _colSource.Background);

            float rowHeight = _colSource.FontSize + 2 * _colSource.LineWidth;

            // rows
            {
                float x = 0;
                for (int ci = 0; ci < _data.Count; ci++)
                {
                    if (FloatMath.IsZero(_colSource.GetColumnWidth(ci)))
                    {
                        continue;
                    }

                    FontRenderHelper.DrawTextVerticallyCentered(
                        sbatch,
                        _colSource.Font,
                        _colSource.FontSize,
                        _data[ci],
                        Foreground,
                        new FPoint(bounds.Left + x + _colSource.LineWidth * 2, bounds.Top + rowHeight / 2f));

                    x += _colSource.GetColumnWidth(ci);
                }
            }

            // scroll
            {
                sbatch.FillRectangle(new FRectangle(bounds.Right - _colSource.ScrollWidth, bounds.Top, _colSource.ScrollWidth, bounds.Height), _colSource.ScrollThumbColor);
            }

            // Vert Lines
            {
                float x = 0;
                for (int i = 0; i < _data.Count; i++)
                {
                    x += _colSource.GetColumnWidth(i);
                    sbatch.DrawLine(bounds.Left + x, bounds.Top, bounds.Left + x, bounds.Bottom, _colSource.LineColor, _colSource.LineWidth);
                }
            }

            sbatch.DrawRectangle(bounds, _colSource.LineColor, _colSource.LineWidth);
        }
Beispiel #10
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            var outerBounds = FRectangle.CreateByCenter(Position, DrawingBoundingBox);
            var innerBounds = FRectangle.CreateByCenter(Position, new FSize(INNERSIZE, INNERSIZE));

            FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
            SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

            sbatch.FillRectangle(innerBounds, FlatColors.Background);

            var scoreRectSize = innerBounds.Width / 10f;

            for (int x = 0; x < 10; x++)
            {
                for (int y = 0; y < 10; y++)
                {
                    var bc = ((x % 2 == 0) ^ (y % 2 == 0)) ? FlatColors.Background : FlatColors.BackgroundLight;

                    if (_ustate == WorldUnlockState.OpenAndUnlocked)
                    {
                        var d = FloatMath.Sqrt((x - 4.5f) * (x - 4.5f) + (y - 4.5f) * (y - 4.5f));

                        var p = FloatMath.PercSin(FloatMath.PI * 3 * d / 14f - Lifetime);

                        p *= 0.25f;

                        bc = ColorMath.Blend(bc, FlatColors.PeterRiver, p);
                    }

                    var col = ColorMath.Blend(FlatColors.Background, bc, AlphaOverride);
                    sbatch.FillRectangle(new FRectangle(innerBounds.X + scoreRectSize * x, innerBounds.Y + scoreRectSize * y, scoreRectSize, scoreRectSize), col);
                }
            }

            foreach (var block in Blocks)
            {
                sbatch.FillRectangle(block.Item1.WithOrigin(Position), block.Item2);
            }

            sbatch.DrawRectangle(innerBounds, Color.Black, Owner.PixelWidth);

            FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
        }
Beispiel #11
0
        public void Draw()
        {
            if (!IsEnabled)
            {
                return;
            }

            debugBatch.Begin(1f, blendState: BlendState.NonPremultiplied);             //scale=1f is ok because we use no textures

            foreach (var line in lines.SelectMany(p => p.GetLines()).Where(p => p.Active()))
            {
                var columns = line.DisplayText();

                var pos = new FPoint(TEXT_OFFSET * Scale, line.PositionY * Scale);

                if (columns.Count == 0 || columns.All(string.IsNullOrWhiteSpace))
                {
                    continue;
                }

                foreach (var _text in columns)
                {
                    var text = FontRenderHelper.MakeTextSafeWithWarn(font, _text, '_');

                    var size = font.MeasureString(text) * Scale;

                    var bg = line.Background;
                    if (bg.A == 255)
                    {
                        bg = ColorMath.Fade(line.Background, line.Decay * backgroundAlpha);
                    }

                    debugBatch.FillRectangle(
                        new FRectangle(pos.X - TEXT_OFFSET * Scale, pos.Y, size.X + 2 * TEXT_OFFSET * Scale, size.Y),
                        bg);

                    debugBatch.DrawString(
                        font,
                        text,
                        pos,
                        ColorMath.Fade(line.Color, line.Decay),
                        0,
                        FPoint.Zero,
                        Scale,
                        SpriteEffects.None,
                        0);

                    pos = new FPoint(pos.X + 3 * TEXT_OFFSET * Scale + size.X, pos.Y);
                }
            }

            debugBatch.End();
        }
Beispiel #12
0
		public void Draw(IBatchRenderer sbatch)
		{
			if (!DebugSettings.Get("ShowDebugMiniMap")) return;

			var rectBoundings = Owner.MapFullBounds;
			var scale = FloatMath.Min(MaxSize / rectBoundings.Width, MaxSize / rectBoundings.Height);

			var sizeOuter = rectBoundings.AsScaled(scale).Size;
			var sizeView = Owner.GuaranteedMapViewport.AsScaled(scale).Size;
			var sizeView2 = Owner.CompleteMapViewport.AsScaled(scale).Size;
			var posView = (Owner.GuaranteedMapViewport.VectorTopLeft - rectBoundings.VectorTopLeft) * scale;
			var posView2 = (Owner.CompleteMapViewport.VectorTopLeft - rectBoundings.VectorTopLeft) * scale;

			var offset = new Vector2(Owner.VAdapter.VirtualTotalWidth - Padding - sizeOuter.Width, Padding) - Owner.VAdapter.VirtualGuaranteedBoundingsOffset;
			var offsetZero = offset - rectBoundings.VectorTopLeft *scale;

			sbatch.FillRectangle(offset, sizeOuter, Color.Red * 0.25f);
			sbatch.DrawRectangle(offset, sizeOuter, Color.Red);

			sbatch.FillRectangle(offset + posView, sizeView, Color.Black * 0.1f);
			sbatch.DrawRectangle(offset + posView, sizeView, Color.Black, 2);
			sbatch.DrawRectangle(offset + posView2, sizeView2, Color.Black * 0.666f, 1);

			foreach (var entity in Owner.GetAllEntities())
			{
				float radius = scale * (entity.DrawingBoundingBox.Width + entity.DrawingBoundingBox.Height) / 4;

				if (radius < 0.5f) continue;

				if (entity.IsInViewport)
				{
					sbatch.FillCircle(offsetZero + entity.Position * scale, radius, 8, entity.DebugIdentColor * 0.85f);
				}
				else
				{
					sbatch.FillCircle(offsetZero + entity.Position * scale, radius, 8, entity.DebugIdentColor * 0.25f);
				}
			}
		}
        private void DrawColoredNormal(IBatchRenderer sbatch)
        {
            sbatch.FillRectangle(VAdapter.VirtualTotalBoundingBox, FlatColors.Background);

            int offX = (int)(Owner.MapOffsetX / TILE_WIDTH);
            int offY = (int)(Owner.MapOffsetY / TILE_WIDTH);

            int extensionX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetX / TILE_WIDTH) + 2;
            int extensionY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetY / TILE_WIDTH) + 2;

            int countX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedWidth / TILE_WIDTH);
            int countY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedHeight / TILE_WIDTH);

            for (int x = -extensionX; x < countX + extensionX; x++)
            {
                for (int y = -extensionY; y < countY + extensionY; y++)
                {
                    var color = FlatColors.Background;

                    var rx = x - offX;
                    var ry = y - offY;

                    float perc;
                    if (_tileValues.TryGetValue(100000 * rx + ry, out perc))
                    {
                        color = ColorMath.Blend(FlatColors.Background, FlatColors.BackgroundGreen, (((int)(perc * GRADIENT_RESOLUTION) * 1f) / GRADIENT_RESOLUTION) * BackgroundPercentageOverride);
                    }

                    sbatch.DrawStretched(
                        Textures.TexPixel,
                        new FRectangle(
                            rx * GDConstants.TILE_WIDTH,
                            ry * GDConstants.TILE_WIDTH,
                            GDConstants.TILE_WIDTH,
                            GDConstants.TILE_WIDTH),
                        color);

                    if (GridLineAlpha > 0)
                    {
                        sbatch.DrawStretched(
                            Textures.TexTileBorder,
                            new FRectangle(
                                rx * GDConstants.TILE_WIDTH,
                                ry * GDConstants.TILE_WIDTH,
                                GDConstants.TILE_WIDTH,
                                GDConstants.TILE_WIDTH),
                            Color.White * GridLineAlpha);
                    }
                }
            }
        }
Beispiel #14
0
        private void DrawNetworkDebug(IBatchRenderer sbatch)
        {
            foreach (var src in _network.Sources)
            {
                foreach (var ray in src.Lasers)
                {
                    sbatch.DrawLine(ray.Start, ray.End, src.LaserPowered ? Color.LimeGreen : Color.LightGreen, 4);

                    if (ray.Terminator == LaserRayTerminator.LaserMultiTerm)
                    {
                        sbatch.FillRectangle(ray.End - new Vector2(4, 4), new FSize(8, 8), Color.Salmon);
                    }
                    if (ray.Terminator == LaserRayTerminator.LaserSelfTerm)
                    {
                        sbatch.FillRectangle(ray.End - new Vector2(4, 4), new FSize(8, 8), Color.CornflowerBlue);
                    }
                    if (ray.Terminator == LaserRayTerminator.LaserFaultTerm)
                    {
                        sbatch.FillRectangle(ray.End - new Vector2(4, 4), new FSize(8, 8), Color.Magenta);
                    }
                }
            }
        }
Beispiel #15
0
        protected void DrawGridGreenLock(IBatchRenderer sbatch)
        {
            var outerBounds = FRectangle.CreateByCenter(Position, DrawingBoundingBox);
            var innerBounds = FRectangle.CreateByCenter(Position, new FSize(INNERSIZE, INNERSIZE));

            FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
            SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

            sbatch.FillRectangle(innerBounds, FlatColors.Background);

            sbatch.DrawCentered(Textures.TexIconLockOpen, innerBounds.Center, INNERSIZE * 0.75f, INNERSIZE * 0.75f, FlatColors.Nephritis);

            FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
        }
Beispiel #16
0
        protected override void OnDrawGame(IBatchRenderer sbatch)
        {
#if DEBUG
            if (DebugSettings.Get("DebugBackground"))
            {
                sbatch.DrawRectangle(Graph.BoundingRect, Color.OrangeRed, 3f);
                sbatch.DrawRectangle(Graph.BoundingViewport, Color.Purple, 3f);
            }
#endif

            if (ColorOverdraw > 0)
            {
                sbatch.FillRectangle(CompleteMapViewport, FlatColors.Background * ColorOverdraw);
            }
        }
Beispiel #17
0
        public static void DrawRoundedBlurPanelBackgroundPart(IBatchRenderer sbatch, FRectangle bounds, float cornerSize = 16f, float alpha = 1f)
        {
            StaticTextures.ThrowIfNotInitialized();

            var alphaWhite = Color.White * alpha;
            var alphaBlack = Color.Black * alpha;

            var r_tl = new FRectangle(bounds.Left - cornerSize, bounds.Top - cornerSize, 2 * cornerSize, 2 * cornerSize);
            var r_tr = new FRectangle(bounds.Right - cornerSize, bounds.Top - cornerSize, 2 * cornerSize, 2 * cornerSize);
            var r_br = new FRectangle(bounds.Right - cornerSize, bounds.Bottom - cornerSize, 2 * cornerSize, 2 * cornerSize);
            var r_bl = new FRectangle(bounds.Left - cornerSize, bounds.Bottom - cornerSize, 2 * cornerSize, 2 * cornerSize);

            var r_l = new FRectangle(r_tl.Left, r_tl.Bottom, r_tl.Width, r_bl.Top - r_tl.Bottom);
            var r_t = new FRectangle(r_tl.Right, r_tl.Top, r_tr.Left - r_tl.Right, r_tl.Height);
            var r_r = new FRectangle(r_tr.Left, r_tr.Bottom, r_tr.Width, r_br.Top - r_tr.Bottom);
            var r_b = new FRectangle(r_bl.Right, r_bl.Top, r_br.Left - r_bl.Right, r_bl.Height);

            // Top
            sbatch.DrawRot000(StaticTextures.PanelBlurEdge, r_t, alphaWhite, 0);

            // Right
            sbatch.DrawRot090(StaticTextures.PanelBlurEdge, r_r, alphaWhite, 0);

            // Bottom
            sbatch.DrawRot180(StaticTextures.PanelBlurEdge, r_b, alphaWhite, 0);

            // Left
            sbatch.DrawRot270(StaticTextures.PanelBlurEdge, r_l, alphaWhite, 0);

            // TL
            sbatch.DrawRot000(StaticTextures.PanelBlurCorner, r_tl, alphaWhite, 0);

            // TR
            sbatch.DrawRot090(StaticTextures.PanelBlurCorner, r_tr, alphaWhite, 0);

            // BR
            sbatch.DrawRot180(StaticTextures.PanelBlurCorner, r_br, alphaWhite, 0);

            // BL
            sbatch.DrawRot270(StaticTextures.PanelBlurCorner, r_bl, alphaWhite, 0);

            sbatch.FillRectangle(r_tl.BottomRight, new FSize(bounds.Width - 2 * cornerSize, bounds.Height - 2 * cornerSize), alphaBlack);
        }
Beispiel #18
0
        public static void DrawTextCenteredWithBackground(IBatchRenderer sbatch, SpriteFont font, float size, string text, Color color, FPoint position, Color background)
        {
            if (text == "")
            {
                return;
            }
            var bounds = MeasureStringCached(font, text);
            var scale  = GetFontScale(font, size);

            sbatch.FillRectangle(FRectangle.CreateByCenter(position, scale * bounds.Width + size / 3f, scale * bounds.Height), background);

            sbatch.DrawString(
                font,
                text,
                position,
                color,
                0,
                new FPoint(bounds.Width / 2f, bounds.Height / 2f - GetFontVCenterOffset(font)),
                scale,
                SpriteEffects.None,
                0);
        }
Beispiel #19
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            if (_needsTabRecalc)
            {
                RecalcTabData();
            }

            sbatch.FillRectangle(bounds, Background);

            float rowHeight = FontSize + 2 * LineWidth;
            float py        = 0;

            // Header
            {
                sbatch.FillRectangle(new FRectangle(bounds.X, bounds.Y, bounds.Width - ScrollWidth, rowHeight), HeaderBackground);
                float x = 0;
                for (int i = 0; i < _columns.Count; i++)
                {
                    if (FloatMath.IsZero(_columns[i].RealWidth))
                    {
                        continue;
                    }

                    FontRenderHelper.DrawTextCentered(
                        sbatch,
                        Font,
                        FontSize,
                        _columns[i].Text,
                        HeaderForeground,
                        new FPoint(bounds.Left + x + _columns[i].RealWidth / 2f, bounds.Top + rowHeight / 2f));

                    x += _columns[i].RealWidth;
                }
                sbatch.DrawLine(bounds.Left, bounds.Top + rowHeight, bounds.Right - ScrollWidth, bounds.Top + rowHeight, LineColor, LineWidth);

                py += rowHeight;
            }

            // rows
            for (int di = (int)ScrollPosition; di < _data.Count; di++)
            {
                if (py + rowHeight > Height)
                {
                    break;
                }

                float x = 0;
                for (int ci = 0; ci < _columns.Count; ci++)
                {
                    if (FloatMath.IsZero(_columns[ci].RealWidth))
                    {
                        continue;
                    }

                    FontRenderHelper.DrawTextVerticallyCentered(
                        sbatch,
                        Font,
                        FontSize,
                        _data[di].Data[ci],
                        _data[di].ForegroundOverride ?? Foreground,
                        new FPoint(bounds.Left + x + LineWidth * 2, bounds.Top + py + rowHeight / 2f));

                    x += _columns[ci].RealWidth;
                }
                sbatch.DrawLine(bounds.Left, bounds.Top + py + rowHeight, bounds.Right - ScrollWidth, bounds.Top + py + rowHeight, LineColor, LineWidth);

                py += rowHeight;
            }

            // scroll
            {
                var colPerPage = (int)(Height / rowHeight) - 1;
                var perc       = FloatMath.Clamp(((int)ScrollPosition) / (1f * _data.Count - colPerPage), 0, 1);

                var pos = perc * (Height - ScrollHeight);

                sbatch.FillRectangle(new FRectangle(bounds.Right - ScrollWidth, bounds.Top + pos, ScrollWidth, ScrollHeight), ScrollThumbColor);
            }

            // Vert Lines
            {
                float x = 0;
                for (int i = 0; i < _columns.Count; i++)
                {
                    x += _columns[i].RealWidth;
                    sbatch.DrawLine(bounds.Left + x, bounds.Top, bounds.Left + x, bounds.Bottom, LineColor, LineWidth);
                }
            }

            sbatch.DrawRectangle(bounds, LineColor, LineWidth);
        }
 public override void Draw(IBatchRenderer sbatch)
 {
     sbatch.FillRectangle(VAdapter.VirtualTotalBoundingBox, color);
 }
Beispiel #21
0
 protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
 {
     sbatch.FillRectangle(bounds, COLOR_BACKGROUND);
 }
        private void DrawColoredPartitions(IBatchRenderer sbatch)
        {
            sbatch.FillRectangle(VAdapter.VirtualTotalBoundingBox.RelativeTo(Owner.MapOffset), FlatColors.Background);

            if (FloatMath.IsEpsilonOne(BackgroundPercentageOverride))
            {
                foreach (var pt in partitions)
                {
                    sbatch.DrawStretched(Textures.TexPixel, pt.Item2, pt.Item1);
                }
            }
            else
            {
                foreach (var pt in partitions)
                {
                    var color = ColorMath.Blend(FlatColors.Background, pt.Item1, BackgroundPercentageOverride);

                    sbatch.DrawStretched(Textures.TexPixel, pt.Item2, color);
                }
            }

            if (GridLineAlpha > 0)
            {
                int offX = (int)(Owner.MapOffsetX / TILE_WIDTH);
                int offY = (int)(Owner.MapOffsetY / TILE_WIDTH);

                int extensionX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetX / TILE_WIDTH) + 2;
                int extensionY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetY / TILE_WIDTH) + 2;

                int countX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedWidth / TILE_WIDTH);
                int countY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedHeight / TILE_WIDTH);

                for (int x = -extensionX; x < countX + extensionX; x++)
                {
                    for (int y = -extensionY; y < countY + extensionY; y++)
                    {
                        var rx = x - offX;
                        var ry = y - offY;

                        sbatch.DrawStretched(
                            Textures.TexTileBorder,
                            new FRectangle(
                                rx * GDConstants.TILE_WIDTH,
                                ry * GDConstants.TILE_WIDTH,
                                GDConstants.TILE_WIDTH,
                                GDConstants.TILE_WIDTH),
                            Color.White * GridLineAlpha);
                    }
                }
            }

#if DEBUG
            if (DebugSettings.Get("DebugBackground"))
            {
                foreach (var pt in partitions)
                {
                    sbatch.FillRectangle(pt.Item2.AsDeflated(GDConstants.TILE_WIDTH / 6, GDConstants.TILE_WIDTH / 6), Color.Blue * 0.1f);
                    sbatch.DrawRectangle(pt.Item2.AsDeflated(GDConstants.TILE_WIDTH / 6, GDConstants.TILE_WIDTH / 6), Color.Blue, Owner.PixelWidth);
                }
            }
#endif
        }
		public override void Draw(IBatchRenderer sbatch)
		{
			sbatch.FillRectangle(VAdapter.VirtualTotalBoundingBox, color);
		}
Beispiel #24
0
        private void DrawDebugView(IBatchRenderer sbatch)
        {
            var innerRadius = Scale * CANNON_DIAMETER / 2;

            if (this is BulletCannon)
            {
                var rectChargeFull = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (0 * 12) + 4, innerRadius * 2, 8);
                var rectChargeProg = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (0 * 12) + 4, innerRadius * 2 * ((BulletCannon)this).BarrelCharge, 8);

                sbatch.FillRectangle(rectChargeFull, Color.White);
                sbatch.FillRectangle(rectChargeProg, Color.DarkGray);
                sbatch.DrawRectangle(rectChargeFull, Color.Black);
            }
            else if (this is RelayCannon)
            {
                var rectChargeFull = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (0 * 12) + 4, innerRadius * 2, 8);
                var rectChargeProg = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (0 * 12) + 4, innerRadius * 2 * ((RelayCannon)this).BarrelCharge / RELAY_BARREL_CHARGE_TIME, 8);

                sbatch.FillRectangle(rectChargeFull, Color.White);
                sbatch.FillRectangle(rectChargeProg, Color.DarkGray);
                sbatch.DrawRectangle(rectChargeFull, Color.Black);
            }
            else if (this is TrishotCannon)
            {
                var rectChargeFull = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (0 * 12) + 4, innerRadius * 2, 8);
                var rectChargeProg = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (0 * 12) + 4, innerRadius * 2 * ((TrishotCannon)this).BarrelCharge, 8);

                sbatch.FillRectangle(rectChargeFull, Color.White);
                sbatch.FillRectangle(rectChargeProg, Color.DarkGray);
                sbatch.DrawRectangle(rectChargeFull, Color.Black);
            }
            else if (this is MinigunCannon)
            {
                var rectChargeFull = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (0 * 12) + 4, innerRadius * 2, 8);
                var rectChargeProg = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (0 * 12) + 4, innerRadius * 2 * ((MinigunCannon)this).BarrelCharge, 8);

                sbatch.FillRectangle(rectChargeFull, Color.White);
                sbatch.FillRectangle(rectChargeProg, Color.DarkGray);
                sbatch.DrawRectangle(rectChargeFull, Color.Black);
            }
            else if (this is LaserCannon)
            {
                var rectChargeFull = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (0 * 12) + 4, innerRadius * 2, 8);
                var rectChargeProg = new FRectangle(Position.X, Position.Y + innerRadius + (0 * 12) + 4, ((((LaserCannon)this).CorePulse.ActualValue - 1) / CORE_PULSE) * innerRadius, 8).AsNormalized();

                sbatch.FillRectangle(rectChargeFull, Color.White);
                sbatch.FillRectangle(rectChargeProg, Color.OrangeRed);
                sbatch.DrawRectangle(rectChargeFull, Color.Black);
            }

            var rectHealthFull  = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (1 * 12) + 4, innerRadius * 2, 8);
            var rectHealthProgT = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (1 * 12) + 4, innerRadius * 2 * CannonHealth.TargetValue, 8);
            var rectHealthProgA = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (1 * 12) + 4, innerRadius * 2 * CannonHealth.ActualValue, 8);

            if (CannonHealth.IsDecreasing())
            {
                sbatch.FillRectangle(rectHealthFull, Color.White);
                sbatch.FillRectangle(rectHealthProgA, Fraction.Color.Lighten());
                sbatch.FillRectangle(rectHealthProgT, Fraction.Color);
                sbatch.DrawRectangle(rectHealthFull, Color.Black);
            }
            else if (CannonHealth.IsIncreasing())
            {
                sbatch.FillRectangle(rectHealthFull, Color.White);
                sbatch.FillRectangle(rectHealthProgT, Fraction.Color.Lighten());
                sbatch.FillRectangle(rectHealthProgA, Fraction.Color);
                sbatch.DrawRectangle(rectHealthFull, Color.Black);
            }
            else
            {
                sbatch.FillRectangle(rectHealthFull, Color.White);
                sbatch.FillRectangle(rectHealthProgA, Fraction.Color);
                sbatch.DrawRectangle(rectHealthFull, Color.Black);
            }

            sbatch.FillRectangle(Position.AsTranslated(DrawingBoundingBox.Width / 2, -DrawingBoundingBox.Height / 2), new FSize(3, DrawingBoundingBox.Height), Color.DimGray);
            sbatch.FillRectangle(Position.AsTranslated(DrawingBoundingBox.Width / 2, -DrawingBoundingBox.Height / 2), new FSize(3, DrawingBoundingBox.Height * controller.UpdateWaitPercentage), Color.Linen);

            var yy = 2;

            for (int i = 0; i < ActiveOperations.Count; i++)
            {
                if (!(ActiveOperations[i] is CannonBooster))
                {
                    return;
                }

                var rectFull = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (yy * 12) + 16, innerRadius * 2, 8);
                var rectProg = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (yy * 12) + 16, innerRadius * 2 * (1 - ActiveOperations[i].Progress), 8);

                sbatch.FillRectangle(rectFull, Color.White);
                sbatch.FillRectangle(rectProg, Color.Chocolate);
                sbatch.DrawRectangle(rectFull, Color.Black);

                yy++;
            }
            foreach (var booster in _laserBoosts)
            {
                var rectFull = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (yy * 12) + 16, innerRadius * 2, 8);
                var rectProg = new FRectangle(Position.X - innerRadius, Position.Y + innerRadius + (yy * 12) + 16, innerRadius * 2 * (booster.RemainingTime / LASER_BOOSTER_LIFETIME), 8);

                sbatch.FillRectangle(rectFull, Color.White);
                sbatch.FillRectangle(rectProg, Color.Chocolate);
                sbatch.DrawRectangle(rectFull, Color.Black);

                yy++;
            }

            var kicontroller = controller as KIController;

            if (kicontroller != null)
            {
                var r = new FRectangle(Position.X - DrawingBoundingBox.Width * 0.5f, Position.Y - DrawingBoundingBox.Height / 2f, DrawingBoundingBox.Width, 12);

                sbatch.FillRectangle(r, Color.LightGray * 0.5f);
                FontRenderHelper.DrawSingleLineInBox(sbatch, Textures.DebugFontSmall, kicontroller.LastKIFunction, r, 1, true, Color.Black);
            }
        }
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
#if DEBUG
            sbatch.FillRectangle(bounds, Color.Magenta);
#endif
        }
Beispiel #26
0
		private void DrawDebugView(IBatchRenderer sbatch)
		{
			var innerRadius = Scale*CANNON_DIAMETER/2;

			var rectChargeFull = new FRectangle(Center.X - innerRadius, Center.Y + innerRadius + (0 * 12) + 4, innerRadius * 2, 8);
			var rectChargeProg = new FRectangle(Center.X - innerRadius, Center.Y + innerRadius + (0 * 12) + 4, innerRadius * 2 * barrelCharge, 8);

			sbatch.FillRectangle(rectChargeFull, Color.White);
			sbatch.FillRectangle(rectChargeProg, Color.DarkGray);
			sbatch.DrawRectangle(rectChargeFull, Color.Black);

			var rectHealthFull = new FRectangle(Center.X - innerRadius, Center.Y + innerRadius + (1 * 12) + 4, innerRadius * 2, 8);
			var rectHealthProgT = new FRectangle(Center.X - innerRadius, Center.Y + innerRadius + (1 * 12) + 4, innerRadius * 2 * CannonHealth.TargetValue, 8);
			var rectHealthProgA = new FRectangle(Center.X - innerRadius, Center.Y + innerRadius + (1 * 12) + 4, innerRadius * 2 * CannonHealth.ActualValue, 8);

			if (CannonHealth.IsDecreasing())
			{
				sbatch.FillRectangle(rectHealthFull, Color.White);
				sbatch.FillRectangle(rectHealthProgA, Fraction.Color.Lighten());
				sbatch.FillRectangle(rectHealthProgT, Fraction.Color);
				sbatch.DrawRectangle(rectHealthFull, Color.Black);
			}
			else if (CannonHealth.IsIncreasing())
			{
				sbatch.FillRectangle(rectHealthFull, Color.White);
				sbatch.FillRectangle(rectHealthProgT, Fraction.Color.Lighten());
				sbatch.FillRectangle(rectHealthProgA, Fraction.Color);
				sbatch.DrawRectangle(rectHealthFull, Color.Black);
			}
			else
			{
				sbatch.FillRectangle(rectHealthFull, Color.White);
				sbatch.FillRectangle(rectHealthProgA, Fraction.Color);
				sbatch.DrawRectangle(rectHealthFull, Color.Black);
			}

			for (int i = 0; i < ActiveOperations.Count; i++)
			{
				var rectFull = new FRectangle(Center.X - innerRadius, Center.Y + innerRadius + ((i+2) * 12) + 16, innerRadius * 2, 8);
				var rectProg = new FRectangle(Center.X - innerRadius, Center.Y + innerRadius + ((i+2) * 12) + 16, innerRadius * 2 * (1- ActiveOperations[i].Progress), 8);

				sbatch.FillRectangle(rectFull, Color.White);
				sbatch.FillRectangle(rectProg, Color.Chocolate);
				sbatch.DrawRectangle(rectFull, Color.Black);
			}
		}