Class GridView1DIndexBase<T>
Exactly like GridViewBase<T>, except for the one indexer left to the user to implement is the one which takes a 1D array, and the position-based indexers are implemented off that.
Implements
Inherited Members
Namespace: SadRogue.Primitives.GridViews
Assembly: TheSadRogue.Primitives.dll
Syntax
public abstract class GridView1DIndexBase<T> : IGridView<T>
Type Parameters
| Name | Description |
|---|---|
| T | The type of value being stored. |
Remarks
This can be more convenient than GridViewBase<T> for use cases where 1D indices are easiest to work with, and is technically more efficient for cases such as wrapping a 1D array, where the backing data structure takes an index (although this should typically be considered a micro-optimization).
Constructors
View SourceGridView1DIndexBase()
Declaration
protected GridView1DIndexBase()
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 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 abstract 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 |