Exemplo n.º 1
0
 public Rectangle GetRectangleInBoundary(Rectangle boundary)
 {
     Vector2 realCenter = GetCenterInBoundary(boundary);
     float realWidth = boundary.Width * Width;
     float realHeight = boundary.Height * Height * ((float)boundary.Width / (float)boundary.Height);
     FloatRectangle realRectangle = new FloatRectangle(realCenter.X - realWidth / 2f, realCenter.Y - realHeight / 2f, realWidth, realHeight);
     return realRectangle.ToRectangle();
 }
Exemplo n.º 2
0
 public MoveableRectangle(FloatRectangle startRectangle)
 {
     current = startRectangle;
 }
Exemplo n.º 3
0
 public void SetRectangle(Rectangle rectangle)
 {
     current = new FloatRectangle(rectangle);
 }
Exemplo n.º 4
0
 public static FloatRectangle CreateRectangle(float x1, float y1, float x2, float y2)
 {
     FloatRectangle output = new FloatRectangle();
     output.x = Math.Min(x1, x2);
     output.y = Math.Min(y1, y2);
     output.width = Math.Abs(x2 - x1);
     output.height = Math.Abs(y2 - y1);
     return output;
 }