LayeredSurface Class
Definition
Section titled “Definition”Manages a set of surface layers.
[DataContract]public class LayeredSurface : UpdateComponent, IComponent, IList<ICellSurface>, ICollection<ICellSurface>, IEnumerable<ICellSurface>, IEnumerable, ICellSurfaceResizeInheritance object → UpdateComponent
Implements IComponent, IList<ICellSurface>, ICollection<ICellSurface>, IEnumerable<ICellSurface>, IEnumerable, ICellSurfaceResize
Constructors
Section titled “Constructors”LayeredSurface()
Section titled “LayeredSurface()”public LayeredSurface()Fields
Section titled “Fields”_screen
Section titled “_screen”The parent screen hosting this component.
protected IScreenSurface? _screen_screenCachedView
Section titled “_screenCachedView”A cached copy of the View of the hosting screen surface.
protected Rectangle _screenCachedView_layers
Section titled “_layers”The layers.
[DataMember(Name = "Layers")]protected List<ICellSurface> _layersRenderStep
Section titled “RenderStep”Internal use only
public IRenderStep? RenderStepProperties
Section titled “Properties”IsAttached
Section titled “IsAttached”Indicates that the entity renderer has been added to a parent object.
protected bool IsAttached { get; set; }The visible portion of the surface layers.
public Rectangle View { get; set; }DefaultBackground
Section titled “DefaultBackground”The default color to clear the rendering surface. This is used instead of the individual layer’s default background.
public Color DefaultBackground { get; set; }The numbers of layers.
public int Count { get; }IsReadOnly
Section titled “IsReadOnly”Always returns false.
public bool IsReadOnly { get; }this[int]
Section titled “this[int]”Gets or sets a layer by index.
public ICellSurface this[int index] { get; set; }Methods
Section titled “Methods”Add(ICellSurface)
Section titled “Add(ICellSurface)”Adds a layer to this component.
public void Add(ICellSurface layer)Parameters
Section titled “Parameters”layer ICellSurface
The layer to add.
AddRange(IEnumerable<ICellSurface>)
Section titled “AddRange(IEnumerable<ICellSurface>)”Adds a collection if layers to this component.
public void AddRange(IEnumerable<ICellSurface> layers)Parameters
Section titled “Parameters”layers IEnumerable<ICellSurface>
The layers to add.
Replace(ICellSurface, ICellSurface)
Section titled “Replace(ICellSurface, ICellSurface)”Replaces a layer with a new instance.
public void Replace(ICellSurface oldLayer, ICellSurface newLayer)Parameters
Section titled “Parameters”oldLayer ICellSurface
The layer to remove.
newLayer ICellSurface
The layer to add.
Exceptions
Section titled “Exceptions”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.
Remove(ICellSurface)
Section titled “Remove(ICellSurface)”Removes a layer from this component.
public bool Remove(ICellSurface layer)Parameters
Section titled “Parameters”layer ICellSurface
The layer to remove.
Returns
Section titled “Returns”IndexOf(ICellSurface)
Section titled “IndexOf(ICellSurface)”Returns the index of the specified layer.
public int IndexOf(ICellSurface layer)Parameters
Section titled “Parameters”layer ICellSurface
The layer to search for.
Returns
Section titled “Returns”int
The index of the layer.
Insert(int, ICellSurface)
Section titled “Insert(int, ICellSurface)”Inserts the layer at the specified index.
public void Insert(int index, ICellSurface layer)Parameters
Section titled “Parameters”index int
The index to insert at.
layer ICellSurface
The layer to insert.
RemoveAt(int)
Section titled “RemoveAt(int)”Removes a layer at the specified index.
public void RemoveAt(int index)Parameters
Section titled “Parameters”index int
The index of the layer to remove.
Clear()
Section titled “Clear()”Removes all layers.
public void Clear()Clear(ICellSurface)
Section titled “Clear(ICellSurface)”Removes all layers and adds the initialLayer parameter as the first layer.
public void Clear(ICellSurface initialLayer)Parameters
Section titled “Parameters”initialLayer ICellSurface
The new first layer.
Contains(ICellSurface)
Section titled “Contains(ICellSurface)”public bool Contains(ICellSurface layer)Parameters
Section titled “Parameters”layer ICellSurface
Returns
Section titled “Returns”CopyTo(ICellSurface[], int)
Section titled “CopyTo(ICellSurface[], int)”public void CopyTo(ICellSurface[] array, int arrayIndex)Parameters
Section titled “Parameters”array ICellSurface[]
arrayIndex int
GetEnumerator()
Section titled “GetEnumerator()”public IEnumerator<ICellSurface> GetEnumerator()Returns
Section titled “Returns”Create()
Section titled “Create()”Adds a new layer. The layer is based on the first layer’s width and height.
public CellSurface Create()Returns
Section titled “Returns”Exceptions
Section titled “Exceptions”Resize(int, int, int, int, bool)
Section titled “Resize(int, int, int, int, bool)”Resizes each layer to the specified width and height.
public void Resize(int viewWidth, int viewHeight, int totalWidth, int totalHeight, bool clear)Parameters
Section titled “Parameters”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.
Resize(int, int, bool)
Section titled “Resize(int, int, bool)”Resizes the surface and view to the specified width and height.
public void Resize(int width, int height, bool clear)Parameters
Section titled “Parameters”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.
OnAdded(IScreenObject)
Section titled “OnAdded(IScreenObject)”Called when the component is added to a host.
public override void OnAdded(IScreenObject host)Parameters
Section titled “Parameters”host IScreenObject
The host that added the component.
OnRemoved(IScreenObject)
Section titled “OnRemoved(IScreenObject)”Called when the component is removed from the host.
public override void OnRemoved(IScreenObject host)Parameters
Section titled “Parameters”host IScreenObject
The host that removed the component.
Update(IScreenObject, TimeSpan)
Section titled “Update(IScreenObject, TimeSpan)”Called by a host on the update frame.
public override void Update(IScreenObject host, TimeSpan delta)Parameters
Section titled “Parameters”host IScreenObject
The host calling the component.
delta TimeSpan
The time that has elapsed since this method was last called.