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 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 }
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 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); }
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); }
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); }
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); }
private void DrawCog(IBatchRenderer sbatch) { TextureRegion2D texBack = Textures.AnimCannonCog[Textures.ANIMATION_CANNONCOG_SIZE - 1]; TextureRegion2D texProg = Textures.AnimCannonCog[(int)(CannonHealth.ActualValue * (Textures.ANIMATION_CANNONCOG_SIZE - 1))]; sbatch.Draw( texBack.Texture, Center, texBack.Bounds, FlatColors.Clouds, cannonCogRotation + 3 * (FloatMath.PI / 2), texBack.Center(), Scale * Textures.DEFAULT_TEXTURE_SCALE, SpriteEffects.None, 0); sbatch.Draw( texProg.Texture, Center, texProg.Bounds, Fraction.Color, cannonCogRotation + 3 * (FloatMath.PI / 2), texProg.Center(), Scale * Textures.DEFAULT_TEXTURE_SCALE, SpriteEffects.None, 0); }
protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds) { var scale = Size.Width * 1f / WIDTH; FlatRenderHelper.DrawRoundedBlurPanelBackgroundPart(sbatch, bounds, ROUNDNESS_FACTOR); if (btnIndex == 0) { sbatch.Draw( Textures.TexHUDButtonPauseMenuMarkerBackground.Texture, Center + new Vector2(WIDTH/2f - HUDPauseButton.DIAMETER/2f, -(HEIGHT/2f + MARKER_HEIGHT/2f)) * scale, Textures.TexHUDButtonPauseMenuMarkerBackground.Bounds, Color.White, 0f, Textures.TexHUDButtonPauseMenuMarkerBackground.Center(), scale * Textures.DEFAULT_TEXTURE_SCALE, SpriteEffects.None, 0); sbatch.Draw( Textures.TexHUDButtonPauseMenuMarker.Texture, Center + new Vector2(WIDTH / 2f - HUDPauseButton.DIAMETER / 2f, -(HEIGHT / 2f + MARKER_HEIGHT / 2f)) * scale, Textures.TexHUDButtonPauseMenuMarker.Bounds, IsPressed ? FlatColors.Concrete : FlatColors.Silver, 0f, Textures.TexHUDButtonPauseMenuMarker.Center(), scale * Textures.DEFAULT_TEXTURE_SCALE, SpriteEffects.None, 0); } FlatRenderHelper.DrawRoundedBlurPanelSolidPart(sbatch, bounds, IsPressed ? FlatColors.Concrete : FlatColors.Silver, ROUNDNESS_FACTOR); var fontBounds = Textures.HUDFontBold.MeasureString(btnText); sbatch.DrawString( Textures.HUDFontBold, btnText, Center + new Vector2(-WIDTH/2f + 12 + fontScaleFactor * fontBounds.X/2f, 0f)*scale, FlatColors.Foreground, 0f, fontBounds/2f, scale * fontScaleFactor, SpriteEffects.None, 0f); }
protected override void OnDraw(IBatchRenderer sbatch) { sbatch.Draw( Textures.TexBullet.Texture, BulletPosition, Textures.TexBullet.Bounds, Fraction.Color * BulletAlpha, BulletRotation, Textures.TexBullet.Center(), Scale * Textures.DEFAULT_TEXTURE_SCALE * BulletExtraScale, SpriteEffects.None, 0); }
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 OnDraw(IBatchRenderer sbatch) { for (int i = 0; i < ParticleCount; i++) { var p = particlePool[i]; var progress = p.CurrentLifetime / p.MaxLifetime; var size = FloatMath.Lerp(p.SizeInitial, p.SizeFinal, progress); var alpha = FloatMath.Lerp(_config.ParticleAlphaInitial, _config.ParticleAlphaFinal, progress); var color = _config.ColorInitial; if (_config.ColorIsChanging) color = ColorMath.Blend(_config.ColorInitial, _config.ColorFinal, progress); if (size > 0) { sbatch.Draw( _config.Texture.Texture, p.Position, _config.TextureBounds, color * alpha, 0f, _config.TextureCenter, size / _config.TextureSize, SpriteEffects.None, 0); } } }
public static void DrawRoundedRect(IBatchRenderer sbatch, FRectangle bounds, Color color, bool tl, bool tr, bool bl, bool br, float cornerScale = 1) { StaticTextures.ThrowIfNotInitialized(); if (!tl && !tr && !bl && !br) { DrawSimpleRect(sbatch, bounds, color); return; } #region Fill Center sbatch.Draw( StaticTextures.SinglePixel.Texture, bounds.AsDeflated(CROP_CORNER_SIZE * cornerScale, 0).Round(), StaticTextures.SinglePixel.Bounds, color); sbatch.Draw( StaticTextures.SinglePixel.Texture, bounds.AsDeflated(0, CROP_CORNER_SIZE * cornerScale).Round(), StaticTextures.SinglePixel.Bounds, color); #endregion var cornerBounds = new FRectangle(0, 0, TEX_CORNER_SIZE * cornerScale, TEX_CORNER_SIZE * cornerScale); #region Corners if (tl) { sbatch.Draw( StaticTextures.PanelCorner.Texture, bounds.VectorTopLeft, StaticTextures.PanelCorner.Bounds, color, 0 * FloatMath.DegreesToRadians, Vector2.Zero, cornerScale * StaticTextures.DEFAULT_TEXTURE_SCALE, SpriteEffects.None, 0); } else { sbatch.Draw( StaticTextures.SinglePixel.Texture, cornerBounds.AsOffseted(bounds.VectorTopLeft), StaticTextures.SinglePixel.Bounds, color, 0 * FloatMath.DegreesToRadians, Vector2.Zero, SpriteEffects.None, 0); } if (tr) { sbatch.Draw( StaticTextures.PanelCorner.Texture, bounds.VectorTopRight, StaticTextures.PanelCorner.Bounds, color, 90 * FloatMath.DegreesToRadians, Vector2.Zero, cornerScale * StaticTextures.DEFAULT_TEXTURE_SCALE, SpriteEffects.None, 0); } else { sbatch.Draw( StaticTextures.SinglePixel.Texture, cornerBounds.AsOffseted(bounds.VectorTopRight), StaticTextures.SinglePixel.Bounds, color, 90 * FloatMath.DegreesToRadians, Vector2.Zero, SpriteEffects.None, 0); } if (br) { sbatch.Draw( StaticTextures.PanelCorner.Texture, bounds.VectorBottomRight, StaticTextures.PanelCorner.Bounds, color, 180 * FloatMath.DegreesToRadians, Vector2.Zero, cornerScale * StaticTextures.DEFAULT_TEXTURE_SCALE, SpriteEffects.None, 0); } else { sbatch.Draw( StaticTextures.SinglePixel.Texture, cornerBounds.AsOffseted(bounds.VectorBottomRight), StaticTextures.SinglePixel.Bounds, color, 180 * FloatMath.DegreesToRadians, Vector2.Zero, SpriteEffects.None, 0); } if (bl) { sbatch.Draw( StaticTextures.PanelCorner.Texture, bounds.VectorBottomLeft, StaticTextures.PanelCorner.Bounds, color, 270 * FloatMath.DegreesToRadians, Vector2.Zero, cornerScale * StaticTextures.DEFAULT_TEXTURE_SCALE, SpriteEffects.None, 0); } else { sbatch.Draw( StaticTextures.SinglePixel.Texture, cornerBounds.AsOffseted(bounds.VectorBottomLeft), StaticTextures.SinglePixel.Bounds, color, 270 * FloatMath.DegreesToRadians, Vector2.Zero, SpriteEffects.None, 0); } #endregion }
private void DrawBodyAndBarrel(IBatchRenderer sbatch) { var recoil = (1-barrelRecoil) * BARREL_RECOIL_LENGTH; var barrelCenter = Center + new Vector2(Scale * (CANNON_DIAMETER/2f - recoil), 0).Rotate(Rotation.ActualValue); sbatch.Draw( Textures.TexCannonBarrelShadow.Texture, barrelCenter, Textures.TexCannonBarrelShadow.Bounds, Color.White, Rotation.ActualValue, Textures.TexCannonBarrelShadow.Center(), Scale*Textures.DEFAULT_TEXTURE_SCALE, SpriteEffects.None, 0); sbatch.Draw( Textures.TexCannonBodyShadow.Texture, Center, Textures.TexCannonBodyShadow.Bounds, Color.White, Rotation.ActualValue, Textures.TexCannonBodyShadow.Center(), Scale*Textures.DEFAULT_TEXTURE_SCALE, SpriteEffects.None, 0); sbatch.Draw( Textures.TexCannonBarrel.Texture, barrelCenter, Textures.TexCannonBarrel.Bounds, Color.White, Rotation.ActualValue, Textures.TexCannonBarrel.Center(), Scale *Textures.DEFAULT_TEXTURE_SCALE, SpriteEffects.None, 0); sbatch.Draw( Textures.TexCannonBody.Texture, Center, Textures.TexCannonBody.Bounds, Color.White, Rotation.ActualValue, Textures.TexCannonBody.Center(), Scale*Textures.DEFAULT_TEXTURE_SCALE, SpriteEffects.None, 0); }
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 }
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 }
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 DrawSimpleRect(IBatchRenderer sbatch, FRectangle bounds, Color color) { StaticTextures.ThrowIfNotInitialized(); sbatch.Draw( StaticTextures.SinglePixel.Texture, bounds.Round(), StaticTextures.SinglePixel.Bounds, color); }
public static void DrawSimpleRectOutline(IBatchRenderer sbatch, FRectangle bounds, float bsize, Color color) { StaticTextures.ThrowIfNotInitialized(); int borderSize = FloatMath.Round(bsize); // LEFT sbatch.Draw( StaticTextures.SinglePixel.Texture, new Rectangle(FloatMath.Round(bounds.Left), FloatMath.Ceiling(bounds.Top), borderSize, FloatMath.Floor(bounds.Height)), StaticTextures.SinglePixel.Bounds, color); // TOP sbatch.Draw( StaticTextures.SinglePixel.Texture, new Rectangle(FloatMath.Ceiling(bounds.Left), FloatMath.Round(bounds.Top), FloatMath.Floor(bounds.Width), borderSize), StaticTextures.SinglePixel.Bounds, color); // RIGHT sbatch.Draw( StaticTextures.SinglePixel.Texture, new Rectangle(FloatMath.Round(bounds.Right) - borderSize, FloatMath.Ceiling(bounds.Top), borderSize, FloatMath.Floor(bounds.Height)), StaticTextures.SinglePixel.Bounds, color); // BOTTOM sbatch.Draw( StaticTextures.SinglePixel.Texture, new Rectangle(FloatMath.Ceiling(bounds.Left), FloatMath.Round(bounds.Bottom) - borderSize, FloatMath.Floor(bounds.Width), borderSize), StaticTextures.SinglePixel.Bounds, color); }
private void DrawCrosshair(IBatchRenderer sbatch) { if (FloatMath.IsNotZero(CrosshairSize.ActualValue)) { sbatch.Draw( Textures.TexCannonCrosshair.Texture, Center, Textures.TexCannonCrosshair.Bounds, Color.White * (CROSSHAIR_TRANSPARENCY * CrosshairSize.ActualValue), Rotation.TargetValue, Textures.TexCannonCrosshair.Center(), Scale * Textures.DEFAULT_TEXTURE_SCALE * CrosshairSize.ActualValue, SpriteEffects.None, 0); } }