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

@@ -107,42 +107,13 @@ namespace CameraTest
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
rr.Begin(true);
rr.Draw(25, 25, 70, 70, Color.Purple);
/*
* float rotation = 0;
double width = 20;
double height = 20;
int x = 50;
int y = 50;
double topRightAngleFromOrig = Math.Atan(height / width);
pb.Begin(PrimitiveType.LineList);
rr.End();
Vector2 bottomLeft = new Vector2(x, y);
Vector2 bottomRight = new Vector2(x + (float)(Math.Cos(rotation) * width), y + (float)(Math.Sin(rotation) * width));
float origDiagonalHypotenuse = (float)Math.Sqrt(width * width + height * height);
Vector2 topRight = new Vector2(x + (float)Math.Cos(topRightAngleFromOrig + rotation) * origDiagonalHypotenuse, y + (float)Math.Sin(topRightAngleFromOrig + rotation) * origDiagonalHypotenuse);
Vector2 topLeft = new Vector2(x - (float)(Math.Cos((Math.PI / 2f) - rotation) * height), y + (float)(Math.Sin((Math.PI / 2f) - rotation) * height));
verts[0] = bottomLeft;
verts[1] = bottomRight;
verts[2] = topRight;
verts[3] = topLeft;
vertposcol[0] = new VertexPositionColor(new Vector3(verts[0], 0), Color.White);
vertposcol[1] = new VertexPositionColor(new Vector3(verts[1], 0), Color.White);
vertposcol[2] = new VertexPositionColor(new Vector3(verts[2], 0), Color.White);
vertposcol[3] = new VertexPositionColor(new Vector3(verts[3], 0), Color.White);
EffectTechnique effectTechnique = be.Techniques[0];
EffectPassCollection effectPassCollection = effectTechnique.Passes;
foreach (EffectPass pass in effectPassCollection)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineStrip, vertposcol, 0, 4);
}
pb.End();
*/
rr.Begin(false);
rr.Draw(75, 75, 70, 70, Color.Green);
rr.End();
base.Draw(gameTime);
}
}