Пример #1
0
		protected override void DrawDebugHUDBorders(IBatchRenderer sbatch)
		{
			sbatch.DrawRectangle(BoundingRectangle, Color.Magenta, 2f);

			sbatch.DrawRectangle(imageBounds, Color.Magenta, 1f);
			sbatch.DrawLine(imageBounds.VectorTopLeft, imageBounds.VectorBottomRight, Color.Magenta, 1f);
			sbatch.DrawLine(imageBounds.VectorTopRight, imageBounds.VectorBottomLeft, Color.Magenta, 1f);
		}
Пример #2
0
		protected override void DrawDebugHUDBorders(IBatchRenderer sbatch)
		{
			sbatch.DrawRectangle(BoundingRectangle, Color.Magenta, 2f);

			sbatch.DrawRectangle(imageBounds, Color.Magenta, 1f);
			sbatch.DrawLine(imageBounds.TopLeft,  imageBounds.BottomRight, Color.Magenta, 1f);
			sbatch.DrawLine(imageBounds.TopRight, imageBounds.BottomLeft,  Color.Magenta, 1f);
		}
Пример #3
0
        protected override void DrawDebugBorders(IBatchRenderer sbatch)
        {
            base.DrawDebugBorders(sbatch);

            sbatch.DrawRectangle(Position - new Vector2(8, 8) * 0.5f, new FSize(8, 8), Color.LightGreen, 1);
            sbatch.DrawRectangle(vectorPath.Boundings.AsTranslated(Position - vectorPathCenter), Color.LightBlue, 1);

            sbatch.DrawPath(Position.RelativeTo(vectorPathCenter), vectorPath, 48, Color.LightGreen, 1);
        }
		protected override void DrawDebugBorders(IBatchRenderer sbatch)
		{
			base.DrawDebugBorders(sbatch);

			sbatch.DrawRectangle(Position - new FSize(8, 8) * 0.5f, new FSize(8, 8), Color.LightGreen, 1);
			sbatch.DrawRectangle(vectorPath.Boundings.AsOffseted(Position - vectorPathCenter), Color.LightBlue, 1);

			sbatch.DrawPath(Position - vectorPathCenter, vectorPath, 48, Color.LightGreen, 1);

		}
Пример #5
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);
                    }
                }
            }
        }
Пример #6
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);
            }
        }
Пример #7
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);
        }
Пример #8
0
        public override void DrawOverlay(IBatchRenderer sbatch)
        {
            int extensionX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetX / TILE_WIDTH) + 2;
            int extensionY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetY / TILE_WIDTH) + 2;

            if (_wrapMode == GameWrapMode.Donut || _wrapMode == GameWrapMode.Reflect)
            {
                var fextx = extensionX * TILE_WIDTH;
                var fexty = extensionY * TILE_WIDTH;

                var rn = new FRectangle(-fextx, -fexty, Owner.MapFullBounds.Width + 2 * fextx, fexty);
                var re = new FRectangle(Owner.MapFullBounds.Width, -fexty, fextx, Owner.MapFullBounds.Height + 2 * fexty);
                var rs = new FRectangle(-fextx, Owner.MapFullBounds.Height, Owner.MapFullBounds.Width + 2 * fextx, fexty);
                var rw = new FRectangle(-fextx, -fexty, fextx, Owner.MapFullBounds.Height + 2 * fexty);

                sbatch.DrawStretched(Textures.TexPixel, rn, FlatColors.Clouds);
                sbatch.DrawStretched(Textures.TexPixel, re, FlatColors.Clouds);
                sbatch.DrawStretched(Textures.TexPixel, rs, FlatColors.Clouds);
                sbatch.DrawStretched(Textures.TexPixel, rw, FlatColors.Clouds);

                FlatRenderHelper.DrawForegroundDropShadow(sbatch, Owner.MapFullBounds, GDConstants.TILE_WIDTH / 2f, GDConstants.TILE_WIDTH / 2f);

                sbatch.DrawRectangle(Owner.MapFullBounds, Color.White, 3f);
            }
        }
Пример #9
0
        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);
            }
        }
Пример #10
0
		protected override void DrawDebugHUDBorders(IBatchRenderer sbatch)
		{
			sbatch.DrawRectangle(BoundingRectangle, Color.Magenta);

			if (OverrideEllipseSize.IsEmpty)
			{
				sbatch.DrawEllipse(BoundingRectangle, 90, Color.Magenta, 2f);
			}
			else
			{
				sbatch.DrawEllipse(BoundingRectangle.AsResized(OverrideEllipseSize), 90, Color.Magenta, 2f);
			}
		}
Пример #11
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);
				}
			}
		}
Пример #12
0
        protected override void DrawDebugHUDBorders(IBatchRenderer sbatch)
        {
            sbatch.DrawRectangle(BoundingRectangle, Color.Magenta);

            if (OverrideEllipseSize.IsEmpty)
            {
                sbatch.DrawEllipse(BoundingRectangle, 90, Color.Magenta, 2f);
            }
            else
            {
                sbatch.DrawEllipse(BoundingRectangle.AsResized(OverrideEllipseSize), 90, Color.Magenta, 2f);
            }
        }
Пример #13
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 / 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));
        }
Пример #14
0
        protected override void OnDrawGame(IBatchRenderer sbatch)
        {
            if (!MainGame.Inst.Profile.EffectsEnabled)
            {
                var hh = 4.5f * GDConstants.TILE_WIDTH;
                sbatch.DrawCentered(Textures.TexLogo, _banner.TargetRect.Center, hh * Textures.TexLogo.Width / Textures.TexLogo.Height, hh, Color.White);
            }

#if DEBUG
            if (DebugSettings.Get("DebugEntityBoundaries"))
            {
                sbatch.DrawRectangle(_banner.TargetRect, Color.DodgerBlue, 3f);
            }
#endif
        }
Пример #15
0
        protected void DrawLockSwing(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.DrawRectangle(innerBounds, Color.Black);

            var rot = FloatMath.Sin(Lifetime * FloatMath.TAU / _swingPeriode) * FloatMath.RAD_POS_005;

            sbatch.DrawCentered(Textures.TexIconLock, innerBounds.Center, INNERSIZE * 0.75f, INNERSIZE * 0.75f, Color.White, rot);

            FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.Asbestos, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
        }
        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);
        }
Пример #17
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));
        }
Пример #18
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);
			}
		}
Пример #19
0
		protected override void DrawDebugBorders(IBatchRenderer sbatch)
		{
			base.DrawDebugBorders(sbatch);

			sbatch.DrawRectangle(Position - new FSize(8,8) * 0.5f, new FSize(8, 8), Color.LightGreen, 1);
		}
Пример #20
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);
        }
Пример #21
0
		protected override void DrawDebugBorders(IBatchRenderer sbatch)
		{
			base.DrawDebugBorders(sbatch);

			sbatch.DrawRectangle(Position - new FSize(8, 8) * 0.5f, new FSize(8, 8), Color.LightGreen, 1);

			for (int i = 0; i < ParticleCount; i++)
			{
				var p = particlePool[i];

				sbatch.DrawLine(p.StartPosition, p.Position, Color.GreenYellow * 0.5f);
			}
		}
Пример #22
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);
            }
        }
Пример #23
0
 public static void DrawSimpleRectOutline(IBatchRenderer sbatch, FRectangle bounds, float bsize, Color color)
 {
     sbatch.DrawRectangle(bounds, color, bsize);
 }
Пример #24
0
		protected virtual void DrawDebugHUDBorders(IBatchRenderer sbatch)
		{
			sbatch.DrawRectangle(BoundingRectangle, Color.Magenta, 2f);
		}
Пример #25
0
 protected virtual void DrawDebugBorders(IBatchRenderer sbatch)
 {
     sbatch.DrawRectangle(Position.AsTranslated(-DrawingBoundingBox.Width * 0.5f, -DrawingBoundingBox.Height * 0.5f), DrawingBoundingBox, Color.LightGreen, 1);
 }
Пример #26
0
		public override void Draw(IBatchRenderer sbatch)
		{
			int extensionX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetX / GDConstants.TILE_WIDTH);
			int extensionY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetY / GDConstants.TILE_WIDTH);

			for (int x = -extensionX; x < TILE_COUNT_X + extensionX; x++)
			{
				for (int y = -extensionY; y < TILE_COUNT_Y + extensionY; y++)
				{
					var color = GetGridColor(x, y);

					sbatch.Draw(Textures.TexPixel, new Rectangle(x * GDConstants.TILE_WIDTH, y * GDConstants.TILE_WIDTH, GDConstants.TILE_WIDTH, GDConstants.TILE_WIDTH), color);
					sbatch.Draw(Textures.TexTileBorder, new Rectangle(x * GDConstants.TILE_WIDTH, y * GDConstants.TILE_WIDTH, GDConstants.TILE_WIDTH, GDConstants.TILE_WIDTH), Color.White);

#if DEBUG
					if (DebugSettings.Get("DebugBackground"))
					{
						if (x < -1) continue;
						if (y < -1) continue;
						if (x > TILE_COUNT_X) continue;
						if (y > TILE_COUNT_Y) continue;

						var tx = x * GDConstants.TILE_WIDTH + 8;
						var ty = y * GDConstants.TILE_WIDTH + 8;

						sbatch.DrawString(
							Textures.DebugFontSmall,
							string.Format("{0,2}: {1:000}", gridColor[x + 1, y + 1].Fraction?.ToString() ?? "##", gridColor[x + 1, y + 1].Strength * 100),
							new Vector2(tx, ty),
							gridColor[x + 1, y + 1].Fraction?.Color ?? Color.Black);
					}
#endif
				}
			}

#if DEBUG
			if (DebugSettings.Get("DebugBackground"))
			{
				foreach (var particle in Particles)
				{
					sbatch.Draw(
						Textures.TexPixel.Texture,
						new Vector2(particle.X, particle.Y),
						Textures.TexPixel.Bounds,
						particle.Fraction.Color * 0.6f * particle.PowerPercentage,
						0,
						new Vector2(0.5f, 0.5f),
						8,
						SpriteEffects.None, 1);
				}

				sbatch.DrawRectangle(new FRectangle(0, 0, TILE_COUNT_X * GDConstants.TILE_WIDTH, TILE_COUNT_Y * GDConstants.TILE_WIDTH), Color.Magenta);
			}
#endif
		}
Пример #27
0
        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
        }
Пример #28
0
		protected virtual void DrawDebugBorders(IBatchRenderer sbatch)
		{
			sbatch.DrawRectangle(Position - DrawingBoundingBox * 0.5f, DrawingBoundingBox, Color.LightGreen, 1);
		}