|
|
@ -8,17 +8,17 @@ namespace SemiColinGames { |
|
|
|
|
|
|
|
const float DESIRED_ASPECT_RATIO = 1920.0f / 1080.0f; |
|
|
|
|
|
|
|
private readonly Color backgroundColor = Color.DarkBlue; |
|
|
|
private readonly Color backgroundColor = Color.Black; |
|
|
|
|
|
|
|
private readonly GraphicsDevice graphics; |
|
|
|
private readonly RenderTarget2D sceneTarget; |
|
|
|
private readonly SpriteBatch spriteBatch; |
|
|
|
|
|
|
|
public ShmupScene(GraphicsDevice graphics) { |
|
|
|
public ShmupScene(GraphicsDevice graphics, Point worldSize) { |
|
|
|
this.graphics = graphics; |
|
|
|
|
|
|
|
sceneTarget = new RenderTarget2D( |
|
|
|
graphics, 1920 / 4, 1080 / 4, false /* mipmap */, |
|
|
|
graphics, worldSize.X, worldSize.Y, false /* mipmap */, |
|
|
|
graphics.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); |
|
|
|
spriteBatch = new SpriteBatch(graphics); |
|
|
|
} |
|
|
@ -28,6 +28,8 @@ namespace SemiColinGames { |
|
|
|
} |
|
|
|
|
|
|
|
public void Dispose() { |
|
|
|
sceneTarget.Dispose(); |
|
|
|
spriteBatch.Dispose(); |
|
|
|
GC.SuppressFinalize(this); |
|
|
|
} |
|
|
|
|
|
|
@ -43,7 +45,12 @@ namespace SemiColinGames { |
|
|
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, |
|
|
|
SamplerState.PointClamp, DepthStencilState.Default, |
|
|
|
RasterizerState.CullNone); |
|
|
|
spriteBatch.Draw(Textures.Yellow2.Get, Vector2.Floor(world.Player.Position), Color.White); |
|
|
|
|
|
|
|
// Draw player.
|
|
|
|
Texture2D playerTexture = world.Player.Texture.Get; |
|
|
|
Vector2 spriteCenter = new Vector2(playerTexture.Width / 2, playerTexture.Height / 2); |
|
|
|
Vector2 drawPos = Vector2.Floor(Vector2.Subtract(world.Player.Position, spriteCenter)); |
|
|
|
spriteBatch.Draw(playerTexture, drawPos, Color.White); |
|
|
|
spriteBatch.End(); |
|
|
|
|
|
|
|
// Get ready to draw sceneTarget to screen.
|
|
|
|