Represents a rectangle created using floating point coordinates.
コード例 #1
0
        public GameFont(SpriteFont font, String text, Vector2 position, Color tintColor)
            : base(position, tintColor)
        {
            if (font == null)
            {
                throw new ArgumentNullException("font");
            }
            if (text == null)
            {
                //Null string = assume empty string, should I throw ArgumentNullException instead?
                text = String.Empty;
            }

            _font = font;
            _text = new StringBuilder(text);
            _hitBox = new RectangleF(position.X - _origin.X, position.Y - _origin.Y, Size.X, Size.Y);
        }
コード例 #2
0
 /// <summary>Determines whether the specified Object is equal to the RectangleF.</summary>
 /// <param name="other">The Object to compare with the current RectangleF.</param>
 public bool Equals(RectangleF other)
 {
     if (this.X != other.X || this.Y != other.Y || this.Width != other.Width)
     {
         return false;
     }
     return this.Height == other.Height;
 }
コード例 #3
0
 /// <summary>Determines whether a specified Rectangle intersects with this RectangleF.</summary>
 /// <param name="value">The RectangleF to evaluate.</param>
 public bool Intersects(RectangleF value)
 {
     if (value.X >= this.X + this.Width || this.X >= value.X + value.Width || value.Y >= this.Y + this.Height)
     {
         return false;
     }
     return this.Y < value.Y + value.Height;
 }
コード例 #4
0
 /// <summary>Determines whether this RectangleF entirely contains a specified RectangleF.</summary>
 /// <param name="value">The RectangleF to evaluate.</param>
 public bool Contains(RectangleF value)
 {
     if (this.X > value.X || value.X + value.Width > this.X + this.Width || this.Y > value.Y)
     {
         return false;
     }
     return value.Y + value.Height <= this.Y + this.Height;
 }