Esempio n. 1
0
        public void DrawRectangle(Vector2 position, Vector2 size, Vector2 center, double rotation, Color color, double depth)
        {
            Vector2 point1 = position + Vector2Utils.RotateVector2(-center, rotation);
            Vector2 point2 = point1 + Vector2Utils.RotateVector2(new Vector2(size.X, 0), rotation);
            Vector2 point3 = point1 + Vector2Utils.RotateVector2(size, rotation);
            Vector2 point4 = point1 + Vector2Utils.RotateVector2(new Vector2(0, size.Y), rotation);

            DrawLine(point1, point2, color, depth);
            DrawLine(point2, point3, color, depth);
            DrawLine(point3, point4, color, depth);
            DrawLine(point4, point1, color, depth);
        }
 public override Vector2 WorldPosition()
 {
     if (this.Parent == null)
     {
         return(new Vector2(0));
     }
     else
     {
         PhysicalObject parentObj = (PhysicalObject)this.Parent;
         if (parentObj != null)
         {
             return(Vector2Utils.RotateVector2(this.PositionRelativeToParent, parentObj.WorldDirection()) + parentObj.WorldPosition());
         }
         else
         {
             return(new Vector2(float.NaN));
         }
     }
 }
Esempio n. 3
0
        public void DrawSolidRectangle(Vector2 position, Vector2 size, Vector2 center, double rotation, Color color, double depth)
        {
            Vector2 point1 = position + Vector2Utils.RotateVector2(-center, rotation);

            spriteBatch.Draw(point, point1, null, color, (float)rotation, new Vector2(0), size, SpriteEffects.None, (float)depth);
        }