Show / Hide Table of Contents

Class GridViewBase<T>

A convenient base class to inherit from when implementing IGridView<T> that minimizes the number of items you must implement by implementing indexers in terms of a single indexer taking a Point.

Inheritance
Object
GridViewBase<T>
LambdaGridView<T>
TranslationGridView<T1, T2>
UnboundedViewport<T>
Viewport<T>
Implements
IGridView<T>
Namespace: SadRogue.Primitives.GridViews
Assembly: TheSadRogue.Primitives.dll
Syntax
public abstract class GridViewBase<T> : Object, IGridView<T>
Type Parameters
Name Description
T

Constructors

GridViewBase()

Declaration
protected GridViewBase()

Properties

Count

Number of tiles in the grid; equal to Width * Height.

Declaration
public int Count { get; }
Property Value
Type Description
Int32

Height

The height of the grid being represented.

Declaration
public abstract int Height { get; }
Property Value
Type Description
Int32

Item[Point]

Given a position, returns the "value" associated with that location.

Declaration
public abstract T this[Point pos] { get; }
Parameters
Type Name Description
Point pos

Location to retrieve the value for.

Property Value
Type Description
T

The "value" associated with the provided location.

Item[Int32]

Given an 1-dimensional index, returns the value associated with the corresponding position in the map view.

Declaration
public T this[int index1D] { get; }
Parameters
Type Name Description
Int32 index1D

1D index of location to retrieve the "value" for.

Property Value
Type Description
T

The "value" associated with the given location.

Remarks

Typically, this may be implemented in terms of Item[Point] by using FromIndex(Int32, Int32) to calculate the 2D position represented by that 1D index, and passing that position to the Item[Point] indexer to determine the value associated with the position.

Item[Int32, Int32]

Given an X and Y value, returns the "value" associated with that location.

Declaration
public T this[int x, int y] { get; }
Parameters
Type Name Description
Int32 x

X-value of location.

Int32 y

Y-value of location.

Property Value
Type Description
T

The "value" associated with that location.

Remarks

Typically, this can be implemented via Item[Point].

Width

The width of the grid being represented.

Declaration
public abstract int Width { get; }
Property Value
Type Description
Int32

Implements

IGridView<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