Show / Hide Table of Contents

Class BoundedRectangle

This class defines a 2D rectangular area, whose area is automatically "locked" to being inside a rectangular bounding box as it is changed. A typical use might be keeping track of a camera's view area.

Inheritance
Object
BoundedRectangle
Implements
IMatchable<BoundedRectangle>
Namespace: SadRogue.Primitives
Assembly: TheSadRogue.Primitives.dll
Syntax
public class BoundedRectangle : Object, IMatchable<BoundedRectangle>

Constructors

BoundedRectangle(Rectangle, Rectangle)

Constructor.

Declaration
public BoundedRectangle(Rectangle area, Rectangle boundingBox)
Parameters
Type Name Description
Rectangle area

Initial area for the rectangle.

Rectangle boundingBox

Initial bounding box by which to bound the rectangle.

Properties

Area

The rectangle that is guaranteed to be contained completely within BoundingBox. Use SetArea(Rectangle) to set the area.

Declaration
public ref readonly Rectangle Area { get; }
Property Value
Type Description
Rectangle

BoundingBox

The rectangle which Area is automatically bounded to be within. Use the SetBoundingBox(Rectangle) property to set the bounding box.

Declaration
public ref readonly Rectangle BoundingBox { get; }
Property Value
Type Description
Rectangle

Methods

Matches(BoundedRectangle)

True if the given BoundedRectangle has the same Bounds and Area as the current one.

Declaration
public bool Matches(BoundedRectangle other)
Parameters
Type Name Description
BoundedRectangle other

BoundedRectangle to compare.

Returns
Type Description
Boolean

True if the two BoundedRectangles are the same, false if not.

SetArea(Rectangle)

Forces the area given to conform to the BoundingBox specified and sets it to Area.

Declaration
public void SetArea(Rectangle newArea)
Parameters
Type Name Description
Rectangle newArea

The new area to bound and set.

SetBoundingBox(Rectangle)

Sets the bounding box to the specified value, and forces the current area to fit within the bounding box as needed.

Declaration
public void SetBoundingBox(Rectangle newBoundingBox)
Parameters
Type Name Description
Rectangle newBoundingBox

The new bounding box to apply.

Implements

IMatchable<T>

Extension Methods

PropertyChangedEventHelpers.SafelySetProperty<TObject, TProperty>(TObject, ref TProperty, TProperty, EventHandler<ValueChangedEventArgs<TProperty>>)
PropertyChangedEventHelpers.SafelySetProperty<TObject, TProperty>(TObject, ref TProperty, TProperty, EventHandler<ValueChangedEventArgs<TProperty>>, EventHandler<ValueChangedEventArgs<TProperty>>)
In This Article
Back to top Generated by DocFX