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
Implements
Inherited Members
Namespace: SadRogue.Primitives.GridViews
Assembly: TheSadRogue.Primitives.dll
Syntax
public abstract class GridViewBase<T> : IGridView<T>
Type Parameters
| Name | Description |
|---|---|
| T |
Constructors
View SourceGridViewBase()
Declaration
protected GridViewBase()
Properties
View SourceCount
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
Height
The height of the grid being represented.
Declaration
public abstract int Height { get; }
Property Value
| Type | Description |
|---|---|
| int |
this[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. |
this[int]
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 |
|---|---|---|
| int | 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 this[Point] by using FromIndex(int, int) to calculate the 2D position represented by that 1D index, and passing that position to the this[Point] indexer to determine the value associated with the position.
this[int, int]
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 |
|---|---|---|
| int | x | X-value of location. |
| int | y | Y-value of location. |
Property Value
| Type | Description |
|---|---|
| T | The "value" associated with that location. |
Remarks
Typically, this can be implemented via this[Point].
Width
The width of the grid being represented.
Declaration
public abstract int Width { get; }
Property Value
| Type | Description |
|---|---|
| int |