separate letterboxColor from backgroundColor.

This commit is contained in:
Colin McMillen 2020-11-19 17:54:45 -05:00
parent 3c08579ed9
commit 057292c138

View File

@ -8,7 +8,8 @@ namespace SemiColinGames {
const float DESIRED_ASPECT_RATIO = 1920.0f / 1080.0f; const float DESIRED_ASPECT_RATIO = 1920.0f / 1080.0f;
private readonly Color backgroundColor = Color.DarkBlue; private readonly Color letterboxColor = Color.DarkSlateBlue;
private readonly Color backgroundColor = Color.Black;
private readonly GraphicsDevice graphics; private readonly GraphicsDevice graphics;
private readonly RenderTarget2D sceneTarget; private readonly RenderTarget2D sceneTarget;
@ -35,8 +36,6 @@ namespace SemiColinGames {
public void Draw(bool isRunningSlowly, IWorld iworld, bool paused) { public void Draw(bool isRunningSlowly, IWorld iworld, bool paused) {
ShmupWorld world = (ShmupWorld) iworld; ShmupWorld world = (ShmupWorld) iworld;
graphics.SetRenderTarget(null);
graphics.Clear(Color.Black);
// Draw scene to sceneTarget. // Draw scene to sceneTarget.
graphics.SetRenderTarget(sceneTarget); graphics.SetRenderTarget(sceneTarget);
@ -64,6 +63,7 @@ namespace SemiColinGames {
// Get ready to draw sceneTarget to screen. // Get ready to draw sceneTarget to screen.
graphics.SetRenderTarget(null); graphics.SetRenderTarget(null);
graphics.Clear(letterboxColor);
// Letterbox the scene if needed. // Letterbox the scene if needed.
float aspectRatio = 1.0f * graphics.Viewport.Width / graphics.Viewport.Height; float aspectRatio = 1.0f * graphics.Viewport.Width / graphics.Viewport.Height;