Show / Hide Table of Contents

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.

Inheritance
object
GridView1DIndexBase<T>
Implements
IGridView<T>
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
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 Source

GridView1DIndexBase()

Declaration
protected GridView1DIndexBase()

Properties

View Source

Count

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

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

Height

The height of the grid being represented.

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

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.

View Source

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.

View Source

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].

View Source

Width

The width of the grid being represented.

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

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>>?)
GridViewExtensions.Bounds<T>(IGridView<T>)
GridViewExtensions.Contains<T>(IGridView<T>, Point)
GridViewExtensions.Contains<T>(IGridView<T>, int, int)
GridViewExtensions.ExtendToString<T>(IGridView<T>, int, string, string, Func<T, string>?, string, string, string, string)
GridViewExtensions.ExtendToString<T>(IGridView<T>, string, string, Func<T, string>?, string, string, string, string)
GridViewExtensions.Positions<T>(IGridView<T>)
  • View Source
In this article
Back to top Generated by DocFX