Compare commits

..

No commits in common. "5732d6004712c945cdd071bf4790939468c3eacf" and "bdfe5555b8d8ec51885820fbc7e99cfdd9a11845" have entirely different histories.

4 changed files with 8 additions and 29 deletions

View File

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

View File

@ -5,18 +5,14 @@ using System.Collections.Generic;
namespace SemiColinGames {
public sealed class ShmupWorld : IWorld {
public class ShmupPlayer {
public TextureRef Texture = Textures.Yellow2;
public struct ShmupPlayer {
// Center of player sprite.
public Vector2 Position = new Vector2(32, 1080 / 8);
public Vector2 HalfSize = new Vector2(16, 10);
public Vector2 Position;
}
public readonly Point Size;
public readonly ShmupPlayer Player;
public ShmupPlayer Player;
public ShmupWorld() {
Size = new Point(1920 / 4, 1080 / 4);
Player = new ShmupPlayer();
}
@ -32,11 +28,6 @@ namespace SemiColinGames {
float speed = 150f;
Vector2 motion = Vector2.Multiply(input[0].Motion, modelTime * speed);
Player.Position = Vector2.Add(Player.Position, motion);
Player.Position.X = Math.Max(Player.Position.X, Player.HalfSize.X);
Player.Position.X = Math.Min(Player.Position.X, Size.X - Player.HalfSize.X);
Player.Position.Y = Math.Max(Player.Position.Y, Player.HalfSize.Y);
Player.Position.Y = Math.Min(Player.Position.Y, Size.Y - Player.HalfSize.Y);
}
}
}

View File

@ -70,7 +70,7 @@ namespace SemiColinGames {
scene?.Dispose();
// scene = new SneakScene(GraphicsDevice, ((SneakWorld) world).Camera);
// scene = new TreeScene(GraphicsDevice);
scene = new ShmupScene(GraphicsDevice, ((ShmupWorld) world).Size);
scene = new ShmupScene(GraphicsDevice);
GC.Collect();
GC.WaitForPendingFinalizers();

View File

@ -76,11 +76,6 @@ namespace SemiColinGames {
public static TextureRef Yellow3 = new TextureRef("sprites/dylestorm/Yellow-3");
public static TextureRef Yellow4 = new TextureRef("sprites/dylestorm/Yellow-4");
public static TextureRef Yellow5 = new TextureRef("sprites/dylestorm/Yellow-5");
public static TextureRef Projectile1 = new TextureRef("sprites/dylestorm/projectile02-1");
public static TextureRef Projectile2 = new TextureRef("sprites/dylestorm/projectile02-2");
public static TextureRef Projectile3 = new TextureRef("sprites/dylestorm/projectile02-3");
public static TextureRef Projectile4 = new TextureRef("sprites/dylestorm/projectile02-4");
public static TextureRef Projectile5 = new TextureRef("sprites/dylestorm/projectile02-5");
// Backgrounds are indexed by draw order; the first element should be drawn furthest back.
public static TextureRef[] Backgrounds = new TextureRef[] {