Skip to content

LayeredSurface Class

Manages a set of surface layers.

C#
[DataContract]
public class LayeredSurface : UpdateComponent, IComponent, IList<ICellSurface>, ICollection<ICellSurface>, IEnumerable<ICellSurface>, IEnumerable, ICellSurfaceResize

Inheritance objectUpdateComponent

Implements IComponent, IList<ICellSurface>, ICollection<ICellSurface>, IEnumerable<ICellSurface>, IEnumerable, ICellSurfaceResize

C#
public LayeredSurface()

The parent screen hosting this component.

C#
protected IScreenSurface? _screen

A cached copy of the View of the hosting screen surface.

C#
protected Rectangle _screenCachedView

The layers.

C#
[DataMember(Name = "Layers")]
protected List<ICellSurface> _layers

Internal use only

C#
public IRenderStep? RenderStep

Indicates that the entity renderer has been added to a parent object.

C#
protected bool IsAttached { get; set; }

The visible portion of the surface layers.

C#
public Rectangle View { get; set; }

The default color to clear the rendering surface. This is used instead of the individual layer’s default background.

C#
public Color DefaultBackground { get; set; }

The numbers of layers.

C#
public int Count { get; }

Always returns false.

C#
public bool IsReadOnly { get; }

Gets or sets a layer by index.

C#
public ICellSurface this[int index] { get; set; }

Adds a layer to this component.

C#
public void Add(ICellSurface layer)

layer ICellSurface
The layer to add.

Adds a collection if layers to this component.

C#
public void AddRange(IEnumerable<ICellSurface> layers)

layers IEnumerable<ICellSurface>
The layers to add.

Replaces a layer with a new instance.

C#
public void Replace(ICellSurface oldLayer, ICellSurface newLayer)

oldLayer ICellSurface
The layer to remove.

newLayer ICellSurface
The layer to add.

ArgumentException

Thrown when the old layer doesn't exist in this collection.

- or -

Thrown when the new layer already exists in this collection.

- or -

Thrown when the new layer isn't the same size as the other layers.

Removes a layer from this component.

C#
public bool Remove(ICellSurface layer)

layer ICellSurface
The layer to remove.

bool

Returns the index of the specified layer.

C#
public int IndexOf(ICellSurface layer)

layer ICellSurface
The layer to search for.

int
The index of the layer.

Inserts the layer at the specified index.

C#
public void Insert(int index, ICellSurface layer)

index int
The index to insert at.

layer ICellSurface
The layer to insert.

Removes a layer at the specified index.

C#
public void RemoveAt(int index)

index int
The index of the layer to remove.

Removes all layers.

C#
public void Clear()

Removes all layers and adds the initialLayer parameter as the first layer.

C#
public void Clear(ICellSurface initialLayer)

initialLayer ICellSurface
The new first layer.

C#
public bool Contains(ICellSurface layer)

layer ICellSurface

bool

C#
public void CopyTo(ICellSurface[] array, int arrayIndex)

array ICellSurface[]

arrayIndex int

C#
public IEnumerator<ICellSurface> GetEnumerator()

IEnumerator<ICellSurface>

Adds a new layer. The layer is based on the first layer’s width and height.

C#
public CellSurface Create()

CellSurface

Exception

Resizes each layer to the specified width and height.

C#
public void Resize(int viewWidth, int viewHeight, int totalWidth, int totalHeight, bool clear)

viewWidth int
The viewable width of the surface.

viewHeight int
The viewable height of the surface.

totalWidth int
The maximum width of the surface.

totalHeight int
The maximum height of the surface.

clear bool
When true, resets every cell to the DefaultForeground, DefaultBackground and glyph 0.

Resizes the surface and view to the specified width and height.

C#
public void Resize(int width, int height, bool clear)

width int
The width of the surface and view.

height int
The height of the surface and view.

clear bool
When true, resets every cell to the DefaultForeground, DefaultBackground and glyph 0.

Called when the component is added to a host.

C#
public override void OnAdded(IScreenObject host)

host IScreenObject
The host that added the component.

Called when the component is removed from the host.

C#
public override void OnRemoved(IScreenObject host)

host IScreenObject
The host that removed the component.

Called by a host on the update frame.

C#
public override void Update(IScreenObject host, TimeSpan delta)

host IScreenObject
The host calling the component.

delta TimeSpan
The time that has elapsed since this method was last called.