"Smart" border color

This commit is contained in:
Alessandro Proto 2023-02-25 09:55:26 +01:00
parent 085e2c2947
commit e6c70d43a0
2 changed files with 3 additions and 1 deletions

View file

@ -53,6 +53,7 @@ public class Capy64 : Game, IGame
public Eventing.EventEmitter EventEmitter { get; private set; } public Eventing.EventEmitter EventEmitter { get; private set; }
public DiscordIntegration Discord { get; set; } public DiscordIntegration Discord { get; set; }
public Color BorderColor { get; set; } = Color.Black;
public Borders Borders = new() public Borders Borders = new()
{ {
Top = 0, Top = 0,
@ -220,7 +221,7 @@ public class Capy64 : Game, IGame
protected override void Draw(GameTime gameTime) protected override void Draw(GameTime gameTime)
{ {
SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp); SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp);
GraphicsDevice.Clear(new Color(0x11, 0x11, 0x11)); GraphicsDevice.Clear(BorderColor);
SpriteBatch.DrawRectangle(renderTarget.Bounds.Location.ToVector2() + new Vector2(Borders.Left, Borders.Top), SpriteBatch.DrawRectangle(renderTarget.Bounds.Location.ToVector2() + new Vector2(Borders.Left, Borders.Top),
new Size2(renderTarget.Bounds.Width * Scale, renderTarget.Bounds.Height * Scale), Color.Black, Math.Min(renderTarget.Bounds.Width, renderTarget.Bounds.Height), 0); new Size2(renderTarget.Bounds.Width * Scale, renderTarget.Bounds.Height * Scale), Color.Black, Math.Min(renderTarget.Bounds.Width, renderTarget.Bounds.Height), 0);

View file

@ -184,6 +184,7 @@ public class Drawing : IDisposable
public void Clear(Color? color = default) public void Clear(Color? color = default)
{ {
Color finalColor = color ?? Color.Black; Color finalColor = color ?? Color.Black;
Capy64.Instance.BorderColor = finalColor;
_graphicsDevice.Clear(finalColor); _graphicsDevice.Clear(finalColor);
} }