Example #1
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));
        }
Example #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);
		}
Example #3
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);
		}
Example #4
0
        public static void DrawCrossedCircle(IBatchRenderer sbatch, Color color, FPoint pos, float radius, float thickness = 1)
        {
            sbatch.DrawCircle(pos, radius, 32, color, thickness);

            var offset = radius * FloatMath.SQRT_ONE_HALF;

            sbatch.DrawLine(pos.X - offset, pos.Y - offset, pos.X + offset, pos.Y + offset, color, thickness);
            sbatch.DrawLine(pos.X - offset, pos.Y + offset, pos.X + offset, pos.Y - offset, color, thickness);
        }
Example #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);
                    }
                }
            }
        }
Example #6
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            if (node == null)
            {
                return;
            }

            SimpleRenderHelper.DrawRoundedRect(sbatch, bounds, Color.Black * 0.8f * progressDisplay, true, false, false, false, 16);

            sbatch.DrawLine(Position + new Vector2(0, HEADER_HEIGHT), Position + new Vector2(Width, HEADER_HEIGHT), FlatColors.MidnightBlue * progressDisplay, 2);

            sbatch.DrawLine(Position + new Vector2(1 * (Width / 3f), 0), Position + new Vector2(1 * (Width / 3f), 32), FlatColors.MidnightBlue * progressDisplay, 2);
            sbatch.DrawLine(Position + new Vector2(2 * (Width / 3f), 0), Position + new Vector2(2 * (Width / 3f), 32), FlatColors.MidnightBlue * progressDisplay, 2);

            FontRenderHelper.DrawTextCentered(sbatch, (tab == 0 ? Textures.HUDFontBold : Textures.HUDFontRegular), 32, L10N.T(_header1), (tab == 0 ? FlatColors.TextHUD : FlatColors.Asbestos) * progressDisplay, Position + new Vector2(1 * (Width / 6f), HEADER_HEIGHT / 2f));
            FontRenderHelper.DrawTextCentered(sbatch, (tab == 1 ? Textures.HUDFontBold : Textures.HUDFontRegular), 32, L10N.T(_header2), (tab == 1 ? FlatColors.TextHUD : FlatColors.Asbestos) * progressDisplay, Position + new Vector2(3 * (Width / 6f), HEADER_HEIGHT / 2f));
            FontRenderHelper.DrawTextCentered(sbatch, (tab == 2 ? Textures.HUDFontBold : Textures.HUDFontRegular), 32, L10N.T(_header3), (tab == 2 ? FlatColors.TextHUD : FlatColors.Asbestos) * progressDisplay, Position + new Vector2(5 * (Width / 6f), HEADER_HEIGHT / 2f));

            if (tab == 0)
            {
                // Best time local

                DrawInfoLine(sbatch, FractionDifficulty.DIFF_0, 0, node.LevelData.GetTimeString(FractionDifficulty.DIFF_0, true), true);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_1, 1, node.LevelData.GetTimeString(FractionDifficulty.DIFF_1, true), true);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_2, 2, node.LevelData.GetTimeString(FractionDifficulty.DIFF_2, true), true);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_3, 3, node.LevelData.GetTimeString(FractionDifficulty.DIFF_3, true), true);
            }
            else if (tab == 1)
            {
                // Best time global

                DrawInfoLine(sbatch, FractionDifficulty.DIFF_0, 0, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_0].GlobalBestTime, true), true);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_1, 1, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_1].GlobalBestTime, true), true);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_2, 2, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_2].GlobalBestTime, true), true);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_3, 3, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_3].GlobalBestTime, true), true);
            }
            else if (tab == 2)
            {
                // global count

                DrawInfoLine(sbatch, FractionDifficulty.DIFF_0, 0, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_0].GlobalCompletionCount), false);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_1, 1, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_1].GlobalCompletionCount), false);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_2, 2, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_2].GlobalCompletionCount), false);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_3, 3, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_3].GlobalCompletionCount), false);
            }
        }
Example #7
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            CommonObstacleRenderer.DrawPortal(sbatch, _renderRects, Color, Normal);

#if DEBUG
            if (DebugSettings.Get("DebugEntityBoundaries"))
            {
                sbatch.FillCircle(Position, 4, 16, Color.Turquoise);
                sbatch.DrawLine(Position, Position + Vector2.UnitX.RotateWithLength(Normal, 32), Color.Turquoise, 2);
            }
#endif
        }
Example #8
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            sbatch.DrawCentered(
                Textures.TexBullet,
                BulletPosition,
                Scale * BulletExtraScale * BULLET_DIAMETER,
                Scale * BulletExtraScale * BULLET_DIAMETER,
                Fraction.Color * BulletAlpha, BulletRotation);

#if DEBUG
            if (DebugSettings.Get("DebugMultiplayer"))
            {
                sbatch.DrawCircle(LastRemotePosition, Scale * BulletExtraScale * BULLET_DIAMETER / 2f, 6, ClientPredictionMiss ? Color.Crimson : Color.DeepSkyBlue, 2 * Owner.PixelWidth);
                sbatch.DrawLine(LastRemotePosition, BulletPosition, Color.DeepSkyBlue, Owner.PixelWidth);
            }
#endif
        }
        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);
        }
Example #10
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            sbatch.DrawStretched(Textures.TexPortalDropEnd1, _rectDropTop, Color.White, Normal);
            sbatch.DrawStretched(Textures.TexPortalDropMid, _rectDropMid, Color.White, Normal);
            sbatch.DrawStretched(Textures.TexPortalDropEnd2, _rectDropBot, Color.White, Normal);

            sbatch.DrawStretched(Textures.TexGradient, _rectGradient, Color, Normal - FloatMath.RAD_POS_090);
            sbatch.DrawStretched(Textures.TexPixel, _rectFull, FlatColors.Clouds, Normal - FloatMath.RAD_POS_090);
            sbatch.DrawStretched(Textures.TexPixel, _rectHorizon, Color, Normal - FloatMath.RAD_POS_090);

#if DEBUG
            if (DebugSettings.Get("DebugEntityBoundaries"))
            {
                sbatch.FillCircle(Position, 4, 16, Color.Turquoise);
                sbatch.DrawLine(Position, Position + Vector2.UnitX.RotateWithLength(Normal, 32), Color.Turquoise, 2);
            }
#endif
        }
Example #11
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);
                    }
                }
            }
        }
Example #12
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);
        }
Example #13
0
        public override void Draw(IBatchRenderer sbatch)
        {
            int ioffX = -(int)(Owner.MapOffsetX / TILE_WIDTH);
            int ioffY = -(int)(Owner.MapOffsetY / TILE_WIDTH);

            int extensionX = MathHelper.Min(MAX_EXTENSION_X, FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetX / TILE_WIDTH));
            int extensionY = MathHelper.Min(MAX_EXTENSION_Y, FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetY / TILE_WIDTH));

            int countX = FloatMath.Ceiling(VAdapter.VirtualTotalWidth / TILE_WIDTH) + 1;
            int countY = FloatMath.Ceiling(VAdapter.VirtualTotalHeight / TILE_WIDTH) + 1;

            for (int ox = ioffX - extensionX; ox < ioffX + countX + extensionX; ox++)
            {
                for (int oy = ioffY - extensionY; oy < ioffY + countY + extensionY; oy++)
                {
                    var x = ox + MAX_EXTENSION_X;                     // real coords -> array coords
                    var y = oy + MAX_EXTENSION_Y;

                    if (x < 0)
                    {
                        continue;
                    }
                    if (y < 0)
                    {
                        continue;
                    }
                    if (x >= tileCountX)
                    {
                        continue;
                    }
                    if (y >= tileCountY)
                    {
                        continue;
                    }

                    var color = GetGridColor(x, y);

                    var rect = new FRectangle(ox * TILE_WIDTH, oy * TILE_WIDTH, TILE_WIDTH, TILE_WIDTH);

                    sbatch.DrawStretched(Textures.TexPixel, rect, color);
                    sbatch.DrawStretched(Textures.TexTileBorder, rect, Color.White);

#if DEBUG
                    if (DebugSettings.Get("DebugBackground"))
                    {
                        var tx = rect.X + 8;
                        var ty = rect.Y + 8;

                        sbatch.DrawString(
                            Textures.DebugFontSmall,
                            string.Format("({4}|{5})\n{0,2}: {1:000}\n[{2}]{3}", _grid[x, y].Fraction?.ToString() ?? "##", _grid[x, y].PowerCurr * 100, _grid[x, y].SourceDistance, _grid[x, y].IsNeutralDraining ? "D" : "", ox, oy),
                            new FPoint(tx, ty),
                            _grid[x, y].Fraction?.Color ?? Color.Black);

                        if (_grid[x, y].SpawnSource != null)
                        {
                            SimpleRenderHelper.DrawCross(sbatch, rect, _grid[x, y].SpawnSource.Fraction.Color * 0.5f, 2);
                        }

                        var v4tl = new Vector2(+5, +5);
                        var v4tr = new Vector2(-5, +5);
                        var v4br = new Vector2(-5, -5);
                        var v4bl = new Vector2(+5, -5);

                        if (_grid[x, y].BlockNorth)
                        {
                            sbatch.DrawLine(rect.TopLeft + v4tl, rect.TopRight + v4tr, Color.Yellow * 0.6f, 4);
                        }

                        if (_grid[x, y].BlockEast)
                        {
                            sbatch.DrawLine(rect.TopRight + v4tr, rect.BottomRight + v4br, Color.Yellow * 0.6f, 4);
                        }

                        if (_grid[x, y].BlockSouth)
                        {
                            sbatch.DrawLine(rect.BottomRight + v4br, rect.BottomLeft + v4bl, Color.Yellow * 0.6f, 4);
                        }

                        if (_grid[x, y].BlockWest)
                        {
                            sbatch.DrawLine(rect.BottomLeft + v4bl, rect.TopLeft + v4tl, Color.Yellow * 0.6f, 4);
                        }
                    }
#endif
                }
            }
        }
Example #14
0
 public static void DrawCross(IBatchRenderer sbatch, FRectangle rect, Color color, float thickness)
 {
     sbatch.DrawLine(rect.TopLeft, rect.BottomRight, color, thickness);
     sbatch.DrawLine(rect.TopRight, rect.BottomLeft, color, thickness);
 }
		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);
			}
		}