using DotSDL.Interop.Core;
namespace DotSDL.Graphics {
///
/// Represents a rectangle in 2D space.
///
public class Rectangle {
private readonly Point _position;
private readonly Point _size;
///
/// The base structure that this class wraps around.
///
internal Rect.SdlRect SdlRect => new Rect.SdlRect {
X = _position.X, Y = _position.Y, W = _size.X, H = _size.Y
};
///
/// A representing the position of the .
///
public Point Position {
get => _position;
set {
_position.X = value.X;
_position.Y = value.Y;
}
}
///
/// A representing the size of the .
///
public Point Size {
get => _size;
set {
_size.X = value.X;
_size.Y = value.Y;
}
}
///
/// Creates a new .
///
/// A representing the position of the new .
/// A representing the size of the new .
public Rectangle(Point position, Point size) : this(position.X, position.Y, size.X, size.Y) { }
///
/// Creates a new .
///
/// The X position of the new .
/// The Y position of the new .
/// The width of the new .
/// The height of the new .
public Rectangle(int x, int y, int width, int height) {
_position = new Point(x, y);
_size = new Point(width, height);
}
}
}