コード例 #1
0
ファイル: DebugMinimap.cs プロジェクト: ssttv/GridDominance
        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);
                    }
                }
            }
        }
コード例 #2
0
ファイル: Portal.cs プロジェクト: sorke/GridDominance
        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
        }
コード例 #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 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);
				}
			}
		}
コード例 #4
0
ファイル: Portal.cs プロジェクト: ssttv/GridDominance
        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
        }