public override void Draw(IBatchRenderer sbatch) //TODO this renders ~ 300 sprites which is ... suboptimal
		{
			int offX = TILE_WIDTH * (int)(Owner.MapOffsetX / TILE_WIDTH);
			int offY = TILE_WIDTH * (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);

			sbatch.Draw(
				Textures.TexPixel, 
				new Rectangle(
					-extensionX * TILE_WIDTH - offX, 
					-extensionY * TILE_WIDTH - offY, 
					(countX + 2*extensionX) * TILE_WIDTH, 
					(countY + 2 * extensionY) * TILE_WIDTH), 
				FlatColors.Background);

			for (int x = -extensionX; x < countX + extensionX; x++)
			{
				for (int y = -extensionY; y < countY + extensionY; y++)
				{
					sbatch.Draw(Textures.TexTileBorder, new Rectangle(x * TILE_WIDTH - offX, y * TILE_WIDTH - offY, TILE_WIDTH, TILE_WIDTH), Color.White);
				}
			}
		}
		public static void DrawRoundedBlurPanel(IBatchRenderer sbatch, FRectangle bounds, Color color, float scale = 1f)
		{
			StaticTextures.ThrowIfNotInitialized();

			DrawRoundedBlurPanelBackgroundPart(sbatch, bounds, scale);
			DrawRoundedBlurPanelSolidPart(sbatch, bounds, color, scale);
		}
Beispiel #3
0
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			if (BackgroundColor != Color.Transparent)
			{
				SimpleRenderHelper.DrawSimpleRect(sbatch, bounds, BackgroundColor);
			}
		}
Beispiel #4
0
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			if (Image == null) return;
			if (imageBounds.IsEmpty) return;
			
			sbatch.Draw(Image.Texture, imageBounds, Image.Bounds, Color.White);
		}
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			sbatch.Draw(
				Textures.TexHUDButtonBase.Texture,
				Center,
				Textures.TexHUDButtonBase.Bounds,
				ColorMath.Blend(FlatColors.Flamingo, FlatColors.Asbestos, openingProgress),
				0f,
				Textures.TexHUDButtonBase.Center(),
				Textures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None,
				0);
			
			sbatch.Draw(
				Textures.TexHUDButtonSpeedClock.Texture,
				Center,
				Textures.TexHUDButtonSpeedClock.Bounds,
				FlatColors.Clouds,
				0f,
				Textures.TexHUDButtonSpeedClock.Center(),
				Textures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None,
				0);

			sbatch.Draw(
				Textures.TexHUDButtonSpeedHand.Texture,
				Center,
				Textures.TexHUDButtonSpeedHand.Bounds,
				FlatColors.Clouds,
				rotation,
				Textures.TexHUDButtonSpeedHand.Center(),
				Textures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None,
				0);
		}
Beispiel #6
0
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			if (Alignment == HUDAlignment.CENTER || Alignment == HUDAlignment.CENTERLEFT || Alignment == HUDAlignment.CENTERRIGHT)
			{
				sbatch.DrawString(
					Font, 
					_textCache, 
					new Vector2(bounds.Left, bounds.Top + _fontVOffset), 
					TextColor, 
					0, 
					Vector2.Zero, 
					_fontScale, 
					SpriteEffects.None, 
					0);
			}
			else
			{
				sbatch.DrawString(
					Font, 
					_textCache, 
					bounds.VectorTopLeft, 
					TextColor, 
					0,
					Vector2.Zero, 
					_fontScale, 
					SpriteEffects.None, 
					0);
			}
		}
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            sbatch.DrawCentered(Textures.TexHUDButtonBase, Center, DIAMETER * ScaleProgress, DIAMETER * ScaleProgress, ColorMath.Blend(FlatColors.Asbestos, FlatColors.Alizarin, OffsetProgress * ScaleProgress));

            sbatch.DrawCentered(GetIcon(), Center, SIZE_ICON * ScaleProgress * IconScale, SIZE_ICON * ScaleProgress * IconScale, IsPressed ? FlatColors.WetAsphalt : FlatColors.Clouds, IconRotation);

            FontRenderHelper.DrawTextVerticallyCenteredWithBackground(sbatch, Textures.HUDFontRegular, SIZE_ICON, ButtonText, FlatColors.Clouds * FontProgress, new FPoint(CenterX + SIZE_ICON, CenterY), Color.Black * 0.5f * FontProgress);
        }
Beispiel #8
0
        protected override void OnDrawOrderedForegroundLayer(IBatchRenderer sbatch)
        {
            DrawCrosshair(sbatch);
            DrawBodyAndBarrel_FG(sbatch);
            DrawCore(sbatch);

            DrawShield(sbatch);
        }
Beispiel #9
0
        protected override void OnDrawOrderedForegroundLayer(IBatchRenderer sbatch)
        {
            DrawCrosshair(sbatch);

            CommonCannonRenderer.DrawShieldCannon_FG(sbatch, Position, Scale, Rotation.ActualValue, Fraction.IsNeutral, CannonHealth.ActualValue, _coreRotation, SatelliteExpansion.ActualValue, Fraction.Color);

            //DrawShield(sbatch);
        }
Beispiel #10
0
        protected override void OnDrawOrderedForegroundLayer(IBatchRenderer sbatch)
        {
            DrawCrosshair(sbatch);

            CommonCannonRenderer.DrawLaserCannon_FG(sbatch, Position, Scale, Rotation.ActualValue, Fraction.IsNeutral, CannonHealth.ActualValue, coreRotation, CorePulse.ActualValue, coreImage, Fraction.Color);

            DrawShield(sbatch);
        }
Beispiel #11
0
 public void Draw(IBatchRenderer sbatch)
 {
     if (root.IsVisible)
     {
         root.DrawBackground(sbatch);
         root.DrawForeground(sbatch);
     }
 }
Beispiel #12
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);
		}
Beispiel #13
0
 protected override void OnDraw(IBatchRenderer sbatch)
 {
     sbatch.DrawCentered(
         Textures.TexBulletSplitter,
         ShapePosition,
         scale * BaseBullet.BULLET_DIAMETER,
         scale * BaseBullet.BULLET_DIAMETER,
         Fraction.Color * ShapeAlpha, ShapeRotation);
 }
Beispiel #14
0
 protected override void OnDraw(IBatchRenderer sbatch)
 {
     SimpleRenderHelper.Draw9Patch(
         sbatch,
         _bounds,
         Color.White, Color.White, Color.White,
         Textures.TexGlassEdge, Textures.TexGlassCorner, Textures.TexGlassFill,
         CORNER_SIZE);
 }
Beispiel #15
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);
        }
Beispiel #16
0
 public static void DrawMirrorCircle(IBatchRenderer sbatch, FPoint position, float diameter)
 {
     sbatch.DrawCentered(
         diameter < 96 ? Textures.TexMirrorCircleSmall : Textures.TexMirrorCircleBig,
         position,
         diameter + 2 * MirrorCircle.MARGIN_TEX,
         diameter + 2 * MirrorCircle.MARGIN_TEX,
         Color.White);
 }
Beispiel #17
0
 protected override void OnDraw(IBatchRenderer sbatch)
 {
     sbatch.DrawCentered(
         Textures.TexBullet,
         BulletPosition,
         Scale * BulletExtraScale * BULLET_DIAMETER,
         Scale * BulletExtraScale * BULLET_DIAMETER,
         Fraction.Color * BulletAlpha, BulletRotation);
 }
        public static void DrawSimpleRect(IBatchRenderer sbatch, FRectangle bounds, Color color)
        {
            StaticTextures.ThrowIfNotInitialized();

            sbatch.DrawStretched(
                StaticTextures.SinglePixel,
                bounds,
                color);
        }
Beispiel #19
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);
        }
 public static void DrawGlassWall(IBatchRenderer sbatch, FRotatedRectangle rect)
 {
     SimpleRenderHelper.Draw9Patch(
         sbatch,
         rect,
         Color.White, Color.White, Color.White,
         Textures.TexGlassEdge, Textures.TexGlassCorner, Textures.TexGlassFill,
         GlassBlock.CORNER_SIZE);
 }
 public static void DrawMirrorWall(IBatchRenderer sbatch, FRotatedRectangle rect)
 {
     SimpleRenderHelper.Draw9Patch(
         sbatch,
         rect,
         Color.White, Color.White, FlatColors.Concrete,
         Textures.TexMirrorBlockEdge, Textures.TexMirrorBlockCorner, Textures.TexPixel,
         MirrorBlock.CORNER_SIZE);
 }
Beispiel #22
0
 protected override void OnDraw(IBatchRenderer sbatch)
 {
     SimpleRenderHelper.Draw9Patch(
         sbatch,
         _bounds,
         Color.White, Color.White, FlatColors.Concrete,
         Textures.TexMirrorBlockEdge, Textures.TexMirrorBlockCorner, Textures.TexPixel,
         CORNER_SIZE);
 }
 private static void DrawSingleDot(IBatchRenderer sbatch, FPoint position, float scale, Color fracColor)
 {
     sbatch.DrawCentered(
         Textures.TexCircle,
         position,
         scale * Cannon.CANNON_DIAMETER * 0.5f,
         scale * Cannon.CANNON_DIAMETER * 0.5f,
         fracColor);
 }
Beispiel #24
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            if (!Alive)
            {
                return;
            }

            FontRenderHelper.DrawTextCenteredWithScale(sbatch, Textures.LevelBackgroundFont, _scale, _text, Color, Position, _rotation + SuperRotation);
        }
		protected override void DrawDebugBorders(IBatchRenderer sbatch)
		{
			base.DrawDebugBorders(sbatch);

			if (Config.ParticleSpawnAngleIsTotal)
				sbatch.DrawCircle(Position, DrawingBoundingBox.Width / 2, 32, Color.LightGreen, 1);
			else if (Config.ParticleSpawnAngleIsRandom)
				sbatch.DrawCirclePiece(Position, DrawingBoundingBox.Width / 2, Config.ParticleSpawnAngleMin, Config.ParticleSpawnAngleMax, 32, Color.LightGreen, 1);
		}
Beispiel #26
0
 private void DrawCog(IBatchRenderer sbatch)
 {
     sbatch.DrawCentered(
         Textures.TexCircle,
         Position,
         Scale * CANNON_DIAMETER * 0.5f,
         Scale * CANNON_DIAMETER * 0.5f,
         Fraction.Color);
 }
Beispiel #27
0
        public static void DrawOutlinesBlurRectangle(IBatchRenderer sbatch, FRectangle bounds, float borderWidth, Color cInner, Color cBorder, float blurOuterWidth, float blurInset)
        {
            StaticTextures.ThrowIfNotInitialized();

            DrawDropShadow(sbatch, bounds, blurOuterWidth, blurInset);

            SimpleRenderHelper.DrawSimpleRect(sbatch, bounds.AsDeflated(borderWidth / 2f, borderWidth / 2f), cInner);

            SimpleRenderHelper.DrawSimpleRectOutline(sbatch, bounds, borderWidth, cBorder);
        }
		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);

		}
Beispiel #29
0
 protected void DrawPlaceholder(IBatchRenderer sbatch, FRectangle bounds, float leftOffset, float rightOffset)
 {
     FontRenderHelper.DrawTextVerticallyCentered(
         sbatch,
         Font,
         FontSize,
         Placeholder,
         ColorPlaceholder,
         new FPoint(bounds.X + leftOffset, bounds.Y + bounds.Height / 2));
 }
Beispiel #30
0
        public static void DrawPortal(IBatchRenderer sbatch, FRectangle[] renderRects, Color color, float normal)
        {
            sbatch.DrawStretched(Textures.TexPortalDropEnd1, renderRects[3], Color.White, normal);
            sbatch.DrawStretched(Textures.TexPortalDropMid, renderRects[4], Color.White, normal);
            sbatch.DrawStretched(Textures.TexPortalDropEnd2, renderRects[5], Color.White, normal);

            sbatch.DrawStretched(Textures.TexGradient, renderRects[2], color, normal - FloatMath.RAD_POS_090);
            sbatch.DrawStretched(Textures.TexPixel, renderRects[0], FlatColors.Clouds, normal - FloatMath.RAD_POS_090);
            sbatch.DrawStretched(Textures.TexPixel, renderRects[1], color, normal - FloatMath.RAD_POS_090);
        }
Beispiel #31
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);
                    }
                }
            }
        }
		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
		}
Beispiel #33
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            DrawNetwork(sbatch);

#if DEBUG
            if (DebugSettings.Get("DebugLaserNetwork"))
            {
                DrawNetworkDebug(sbatch);
            }
#endif
        }
Beispiel #34
0
		public void Draw(IBatchRenderer sbatch)
		{
			OnDraw(sbatch);

#if DEBUG
			if (DebugSettings.Get("DebugEntityBoundaries"))
			{
				using (sbatch.BeginDebugDraw()) DrawDebugBorders(sbatch);
			}
#endif
		}
Beispiel #35
0
 protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
 {
     if (IsPointerDownOnElement)
     {
         HUDRenderHelper.DrawBackground(sbatch, bounds, BackgroundPressed);
     }
     else
     {
         HUDRenderHelper.DrawBackground(sbatch, bounds, BackgroundNormal);
     }
 }
Beispiel #36
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);
     }
 }
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var iconcenter = bounds.Center;

            for (int i = 0; i < 4; i++)
            {
                var pos = _tetroCenters[i].AsScaled(bounds.Width / 4).WithOrigin(iconcenter).RotateAround(iconcenter, _iconrotation);

                sbatch.DrawCentered(Textures.TexPixel, pos, bounds.Width / 4, bounds.Width / 4, Foreground, _iconrotation);
            }
        }
Beispiel #38
0
        public void Setup()
        {
            _jobFactory = new Mock<IRenderingJobFactory>();
              _settingsFactory = new Mock<IRenderingSettingsFactory>();
              _optionsValidator = new Mock<IBatchRenderingOptionsValidator>();

              _sut = new BatchRenderer(_jobFactory.Object,
                               _settingsFactory.Object,
                               _optionsValidator.Object);

              _outputStream = new MemoryStream();
        }
Beispiel #39
0
        protected override void DrawDebugBorders(IBatchRenderer sbatch)
        {
            base.DrawDebugBorders(sbatch);

            DrawDebugView(sbatch);

            // ASSERTION
            if (ActiveOperations.Count(p => p is CannonBooster) != BulletBoostCount)
            {
                throw new Exception("Assertion failed TotalBoost == Boosters");
            }
        }
Beispiel #40
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
        }
Beispiel #41
0
 private void DrawCrosshair(IBatchRenderer sbatch)
 {
     if (FloatMath.IsNotZero(CrosshairSize.ActualValue))
     {
         sbatch.DrawScaled(
             Textures.TexCannonCrosshair,
             Position,
             Scale * CrosshairSize.ActualValue,
             Color.White * (CROSSHAIR_TRANSPARENCY * CrosshairSize.ActualValue),
             Rotation.TargetValue);
     }
 }
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			if (IsPointerDownOnElement)
			{
				sbatch.Draw(Textures.TexCircle, bounds, BackgroundColor.Darken());
			}
			else
			{
				sbatch.Draw(Textures.TexCircle, bounds, BackgroundColor);
			}

			sbatch.Draw(icon, bounds.AsDeflated(24, 24).AsScaled(IconScale), ForegroundColor);
		}
		protected override void DoDrawBackground(IBatchRenderer sbatch, FRectangle bounds)
		{
			sbatch.Draw(
				Textures.TexHUDButtonBase.Texture,
				Center,
				Textures.TexHUDButtonBase.Bounds,
				Highlighted ? FlatColors.Emerald : FlatColors.Flamingo,
				0f,
				Textures.TexHUDButtonBase.Center(),
				Textures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None,
				0);
		}
Beispiel #44
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);
            }
        }
		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);
			}
		}
		protected override void OnDraw(IBatchRenderer sbatch)
		{
			sbatch.Draw(
				Textures.TexBulletSplitter.Texture,
				ShapePosition,
				Textures.TexBulletSplitter.Bounds,
				Fraction.Color * ShapeAlpha,
				ShapeRotation,
				Textures.TexBullet.Center(),
				scale * Textures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None,
				0);
		}
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			var texture = GetTexture();
				
			sbatch.Draw(
				texture.Texture,
				Center,
				texture.Bounds,
				(this.GDHUD().GDOwner.GameSpeedMode == speed) ? FlatColors.MidnightBlue : FlatColors.Clouds,
				0f,
				texture.Center(),
				Textures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None,
				0);
		}
		public void Draw(IBatchRenderer sbatch)
		{
			var viewportBox = Owner.CompleteMapViewport.AsInflated(VIEWPORT_TOLERANCE, VIEWPORT_TOLERANCE);

			foreach (var entity in entities)
			{
				if (viewportBox.Contains(entity.Position, entity.DrawingBoundingBox))
				{
					entity.IsInViewport = true;
					entity.Draw(sbatch);
				}
				else
				{
					entity.IsInViewport = false;
				}
			}
		}
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			var texScale = bounds.Width / (Textures.TexHUDButtonBase.Width * Textures.DEFAULT_TEXTURE_SCALE.X);

			TextureRegion2D texIcon;

			if (FloatMath.IsZero(animationProgress))
			{
				texIcon = Textures.TexHUDButtonPause[0];
			}
			else if (FloatMath.IsOne(animationProgress))
			{
				texIcon = Textures.TexHUDButtonPause[Textures.ANIMATION_HUDBUTTONPAUSE_SIZE - 1];
			}
			else
			{
				texIcon = Textures.TexHUDButtonPause[(int)(Textures.ANIMATION_HUDBUTTONPAUSE_SIZE * animationProgress)];
			}
			
			sbatch.Draw(
				Textures.TexHUDButtonBase.Texture,
				Center,
				Textures.TexHUDButtonBase.Bounds,
				FlatColors.Asbestos,
				0f,
				Textures.TexHUDButtonBase.Center(),
				texScale * Textures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None,
				0);

			sbatch.Draw(
				texIcon.Texture,
				Center,
				texIcon.Bounds,
				FlatColors.Clouds,
				0f,
				texIcon.Center(),
				texScale * Textures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None,
				0);
		}
		public static void DrawTextCentered(IBatchRenderer sbatch, SpriteFont font, float size, string text, Color color, Vector2 position)
		{
			//TODO How expensive is this calculation each draw call ?
			//     perhaps move everything in some kind of fontrendererCache
			//     which remembers all calculated values until text/size/... changes (like with the HUD)

			var scale = GetFontScale(font, size);

			var bounds = font.MeasureString(text);

			sbatch.DrawString(
				font,
				text,
				position,
				color,
				0,
				new Vector2(bounds.X / 2f, bounds.Y / 2f - GetFontVCenterOffset(font)),
				scale,
				SpriteEffects.None,
				0);
		}
Beispiel #51
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);
				}
			}
		}
		public static void DrawRoundedBlurPanelBackgroundPart(IBatchRenderer sbatch, FRectangle bounds, float scale = 1f)
		{
			StaticTextures.ThrowIfNotInitialized();

			var cornerSize = (int) (scale * CROP_CORNER_SIZE);

			#region Blur Edges

			sbatch.Draw(
				StaticTextures.PanelBlurEdge.Texture,
				new FRectangle(
					bounds.Left + cornerSize,
					bounds.Top - cornerSize,
					bounds.Width - 2 * cornerSize,
					2 * cornerSize),
				StaticTextures.PanelBlurEdge.Bounds,
				Color.White,
				0 * FloatMath.DegreesToRadians,
				Vector2.Zero, SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelBlurEdge.Texture,
				new FRectangle(
					bounds.Right - cornerSize + (2 * cornerSize),
					bounds.Top + cornerSize,
					bounds.Height - 2 * cornerSize,
					2 * cornerSize
					),
				StaticTextures.PanelBlurEdge.Bounds,
				Color.White,
				90 * FloatMath.DegreesToRadians,
				Vector2.Zero, SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelBlurEdge.Texture,
				new FRectangle(
					bounds.Left + cornerSize + (bounds.Width - 2 * cornerSize),
					bounds.Bottom - cornerSize + (2 * cornerSize),
					bounds.Width - 2 * cornerSize,
					2 * cornerSize),
				StaticTextures.PanelBlurEdge.Bounds,
				Color.White,
				180 * FloatMath.DegreesToRadians,
				Vector2.Zero, SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelBlurEdge.Texture,
				new FRectangle(
					bounds.Left - cornerSize,
					bounds.Top + cornerSize + (bounds.Height - 2 * cornerSize),
					bounds.Height - 2 * cornerSize,
					2 * cornerSize),
				StaticTextures.PanelBlurEdge.Bounds,
				Color.White,
				270 * FloatMath.DegreesToRadians,
				Vector2.Zero, SpriteEffects.None, 0);

			#endregion

			#region Blur Corners

			sbatch.Draw(
				StaticTextures.PanelBlurCorner.Texture,
				bounds.VectorTopLeft + scale * CORNER_VECTOR_TL,
				StaticTextures.PanelBlurCorner.Bounds,
				Color.White,
				0 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelBlurCorner.Texture,
				bounds.VectorTopRight + scale * CORNER_VECTOR_TR,
				StaticTextures.PanelBlurCorner.Bounds,
				Color.White,
				90 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelBlurCorner.Texture,
				bounds.VectorBottomRight + scale * CORNER_VECTOR_BR,
				StaticTextures.PanelBlurCorner.Bounds,
				Color.White,
				180 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelBlurCorner.Texture,
				bounds.VectorBottomLeft + scale * CORNER_VECTOR_BL,
				StaticTextures.PanelBlurCorner.Bounds,
				Color.White,
				270 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			#endregion
		}
		public abstract void Draw(IBatchRenderer sbatch);
		public static void DrawRoundedBlurPanelSolidPart(IBatchRenderer sbatch, FRectangle bounds, Color color, float scale = 1f)
		{
			StaticTextures.ThrowIfNotInitialized();

			#region Fill Center

			sbatch.Draw(
				StaticTextures.SinglePixel.Texture,
				bounds.AsDeflated(CROP_CORNER_SIZE * scale, 0),
				StaticTextures.SinglePixel.Bounds,
				color);

			sbatch.Draw(
				StaticTextures.SinglePixel.Texture,
				bounds.AsDeflated(0, CROP_CORNER_SIZE * scale),
				StaticTextures.SinglePixel.Bounds,
				color);

			#endregion

			#region Corners

			sbatch.Draw(
				StaticTextures.PanelCorner.Texture,
				bounds.VectorTopLeft,
				StaticTextures.PanelCorner.Bounds,
				color,
				0 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelCorner.Texture,
				bounds.VectorTopRight,
				StaticTextures.PanelCorner.Bounds,
				color,
				90 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelCorner.Texture,
				bounds.VectorBottomRight,
				StaticTextures.PanelCorner.Bounds,
				color,
				180 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelCorner.Texture,
				bounds.VectorBottomLeft,
				StaticTextures.PanelCorner.Bounds,
				color,
				270 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			#endregion
		}
		public static void DrawOutlinesBlurRectangle(IBatchRenderer sbatch, FRectangle bounds, float borderWidth, Color cInner, Color cBorder, float blurOuterWidth, float blurInset)
		{
			StaticTextures.ThrowIfNotInitialized();

			DrawDropShadow(sbatch, bounds, blurOuterWidth, blurInset);

			SimpleRenderHelper.DrawSimpleRect(sbatch, bounds.AsDeflated(borderWidth / 2f, borderWidth / 2f), cInner);
			
			SimpleRenderHelper.DrawSimpleRectOutline(sbatch, bounds, borderWidth, cBorder);
		}
Beispiel #56
0
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			if (Color == Color.Transparent) return;

			SimpleRenderHelper.DrawSimpleRect(sbatch, bounds, Color);
		}
		protected override void OnDraw(IBatchRenderer sbatch)
		{
			// all drawing happens in PostDraw
		}
		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);
		}
		public static void DrawDropShadow(IBatchRenderer sbatch, FRectangle bounds, float sOutset, float sInset)
		{
			StaticTextures.ThrowIfNotInitialized();

			var r_tl = new FRectangle(
				bounds.Left - sOutset,
				bounds.Top - sOutset,
				sOutset + sInset,
				sOutset + sInset).Round();

			var r_tr = new FRectangle(
				bounds.Right - sInset,
				bounds.Top - sOutset,
				sOutset + sInset,
				sOutset + sInset).Round();

			var r_br = new FRectangle(
				bounds.Right - sInset,
				bounds.Bottom - sInset,
				sOutset + sInset,
				sOutset + sInset).Round();

			var r_bl = new FRectangle(
				bounds.Left - sOutset,
				bounds.Bottom - sInset,
				sOutset + sInset,
				sOutset + sInset).Round();

			var r_l = new Rectangle(r_tl.Left, r_tl.Bottom, r_tl.Width, r_bl.Top - r_tl.Bottom);

			var r_t = new Rectangle(r_tl.Right, r_tl.Top, r_tr.Left - r_tl.Right, r_tl.Height);

			var r_r = new Rectangle(r_tr.Left, r_tr.Bottom, r_tr.Width, r_br.Top - r_tr.Bottom);

			var r_b = new Rectangle(r_bl.Right, r_bl.Top, r_br.Left - r_bl.Right, r_bl.Height);
			
			// Top
			sbatch.DrawRot000(StaticTextures.PanelBlurEdge.Texture, r_t, StaticTextures.PanelBlurEdge.Bounds, Color.White, 0);

			// Right
			sbatch.DrawRot090(StaticTextures.PanelBlurEdge.Texture, r_r, StaticTextures.PanelBlurEdge.Bounds, Color.White, 0);

			// Bottom
			sbatch.DrawRot180(StaticTextures.PanelBlurEdge.Texture, r_b, StaticTextures.PanelBlurEdge.Bounds, Color.White, 0);

			// Left
			sbatch.DrawRot270(StaticTextures.PanelBlurEdge.Texture, r_l, StaticTextures.PanelBlurEdge.Bounds, Color.White, 0);
			
			// TL
			sbatch.DrawRot000(StaticTextures.PanelBlurCorner.Texture, r_tl, StaticTextures.PanelBlurCorner.Bounds, Color.White, 0);

			// TR
			sbatch.DrawRot090(StaticTextures.PanelBlurCorner.Texture, r_tr, StaticTextures.PanelBlurCorner.Bounds, Color.White, 0);

			// BR
			sbatch.DrawRot180(StaticTextures.PanelBlurCorner.Texture, r_br, StaticTextures.PanelBlurCorner.Bounds, Color.White, 0);

			// BL
			sbatch.DrawRot270(StaticTextures.PanelBlurCorner.Texture, r_bl, StaticTextures.PanelBlurCorner.Bounds, Color.White, 0);
		}
Beispiel #60
0
		protected override void OnDraw(IBatchRenderer sbatch)
		{
			#region Expander

			FlatRenderHelper.DrawOutlinesBlurRectangle(
				sbatch,
				FRectangle.CreateByCenter(Position, 0, -EXTENDER_OFFSET, WIDTH_EXTENDER, HEIGHT_EXTENDER),
				2,
				GDColors.COLOR_DIFFICULTY_0,
				COLOR_BORDER,
				8,
				10);

			FlatRenderHelper.DrawOutlinesBlurRectangle(
				sbatch,
				FRectangle.CreateByCenter(Position, EXTENDER_OFFSET, 0, HEIGHT_EXTENDER, WIDTH_EXTENDER),
				2,
				GDColors.COLOR_DIFFICULTY_1,
				COLOR_BORDER,
				8,
				10);

			FlatRenderHelper.DrawOutlinesBlurRectangle(
				sbatch, 
				FRectangle.CreateByCenter(Position, 0, EXTENDER_OFFSET, WIDTH_EXTENDER, HEIGHT_EXTENDER), 
				2, 
				GDColors.COLOR_DIFFICULTY_2, 
				COLOR_BORDER, 
				8, 
				10);

			FlatRenderHelper.DrawOutlinesBlurRectangle(
				sbatch,
				FRectangle.CreateByCenter(Position, -EXTENDER_OFFSET, 0, HEIGHT_EXTENDER, WIDTH_EXTENDER),
				2,
				COLOR_DEACTIVATED,
				COLOR_BORDER,
				8,
				10);

			#endregion
			
			#region Ground

			sbatch.Draw(
				Textures.TexCircle.Texture,
				Position,
				Textures.TexCircle.Bounds,
				FlatColors.Asbestos,
				0f,
				Textures.TexCircle.Center(),
				DIAMETER / Textures.TexCircle.Width,
				SpriteEffects.None,
				0);

			#endregion

			#region Segments

			sbatch.Draw(
				Textures.TexLevelNodeSegment.Texture,
				Position,
				Textures.TexLevelNodeSegment.Bounds,
				GDColors.COLOR_DIFFICULTY_0,
				FloatMath.RAD_000,
				Textures.TexLevelNodeSegment.Center(),
				DIAMETER / Textures.TexLevelNodeSegment.Width,
				SpriteEffects.None,
				0);

			sbatch.Draw(
				Textures.TexLevelNodeSegment.Texture,
				Position,
				Textures.TexLevelNodeSegment.Bounds,
				GDColors.COLOR_DIFFICULTY_1,
				FloatMath.RAD_POS_090,
				Textures.TexLevelNodeSegment.Center(),
				DIAMETER / Textures.TexLevelNodeSegment.Width,
				SpriteEffects.None,
				0);

			sbatch.Draw(
				Textures.TexLevelNodeSegment.Texture,
				Position,
				Textures.TexLevelNodeSegment.Bounds,
				GDColors.COLOR_DIFFICULTY_2,
				FloatMath.RAD_POS_180,
				Textures.TexLevelNodeSegment.Center(),
				DIAMETER / Textures.TexLevelNodeSegment.Width,
				SpriteEffects.None,
				0);

			sbatch.Draw(
				Textures.TexLevelNodeSegment.Texture,
				Position,
				Textures.TexLevelNodeSegment.Bounds,
				COLOR_DEACTIVATED, //GDColors.COLOR_DIFFICULTY_3,
				FloatMath.RAD_POS_270,
				Textures.TexLevelNodeSegment.Center(),
				DIAMETER / Textures.TexLevelNodeSegment.Width,
				SpriteEffects.None,
				0);

			#endregion

			#region Structure
			
			sbatch.Draw(
				Textures.TexLevelNodeStructure.Texture,
				Position,
				Textures.TexLevelNodeStructure.Bounds,
				FlatColors.MidnightBlue,
				0f,
				Textures.TexLevelNodeStructure.Center(),
				DIAMETER / Textures.TexLevelNodeStructure.Width,
				SpriteEffects.None,
				0);

			#endregion

			#region Text

			FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, FONTSIZE, "1-2", FlatColors.Clouds, Position);

			#endregion
		}