go back to just a single RenderTarget

GitOrigin-RevId: 0b8fc3090098f84047a85804bb5eb2a15249aadd
This commit is contained in:
Colin McMillen 2020-01-09 16:20:46 -05:00
parent 9af191e801
commit f0630d1679

View File

@ -8,12 +8,7 @@ using System.Collections.Generic;
namespace SemiColinGames {
public class SneakGame : Game {
GraphicsDeviceManager graphics;
// TODO: use a History<RenderTarget2D> but implement functions that let us re-use the
// RenderTargets instead of re-creating them every frame?
const int numRenderTargets = 1;
RenderTarget2D[] renderTargets = new RenderTarget2D[numRenderTargets];
int renderTargetIdx = 0;
RenderTarget2D renderTarget;
SpriteBatch spriteBatch;
SpriteFont font;
@ -45,11 +40,9 @@ namespace SemiColinGames {
Debug.Initialize(GraphicsDevice);
for (int i = 0; i < renderTargets.Length; i++) {
renderTargets[i] = new RenderTarget2D(
GraphicsDevice, camera.Width, camera.Height, false /* mipmap */,
GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24);
}
renderTarget = new RenderTarget2D(
GraphicsDevice, camera.Width, camera.Height, false /* mipmap */,
GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24);
base.Initialize();
}
@ -109,8 +102,6 @@ namespace SemiColinGames {
fpsCounter.Update();
// Draw scene to RenderTarget.
RenderTarget2D renderTarget = renderTargets[renderTargetIdx];
renderTargetIdx = (renderTargetIdx + 1) % renderTargets.Length;
GraphicsDevice.SetRenderTarget(renderTarget);
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null);