Rectangle renderers work.

This commit is contained in:
2019-02-22 01:59:51 -06:00
parent c8e8bbf2be
commit 8d5435ad6c
6 changed files with 56 additions and 76 deletions

View File

@@ -31,16 +31,13 @@ namespace Demo
{
// TODO: Add your initialization logic here
basicEffect = new BasicEffect(GraphicsDevice);
basicEffect.View = Matrix.CreateLookAt(new Vector3(graphics.PreferredBackBufferWidth/2f, graphics.PreferredBackBufferHeight/2f, 1f), Vector3.Forward, Vector3.Up);
basicEffect.World = Matrix.Identity;
basicEffect.Projection = Matrix.CreateOrthographic(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 1);
basicEffect.VertexColorEnabled = true;
vertices = new VertexPositionColor[5];
vertices[0] = new VertexPositionColor(new Vector3(5, 5, 0), Color.Red);
vertices[1] = new VertexPositionColor(new Vector3(10, 5, 0), Color.Red);
vertices = new VertexPositionColor[4];
vertices[0] = new VertexPositionColor(new Vector3(0, 0, 0), Color.Red);
vertices[1] = new VertexPositionColor(new Vector3(10, 0, 0), Color.Red);
vertices[2] = new VertexPositionColor(new Vector3(10, 10, 0), Color.Red);
vertices[3] = new VertexPositionColor(new Vector3(5, 10, 0), Color.Red);
vertices[3] = new VertexPositionColor(new Vector3(0, 10, 0), Color.Red);
base.Initialize();
}
@@ -52,6 +49,7 @@ namespace Demo
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
basicEffect.World = Matrix.CreateOrthographicOffCenter(new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height), 0, 1);
// TODO: use this.Content to load your game content here
}