Table of Contents

Class Layer

Namespace
LibGFX.Core
Assembly
LibGFX.dll

Represents a layer in the scene

public class Layer : IIdentifier, ISerialization
Inheritance
Layer
Implements
Inherited Members

Constructors

Layer()

Initializes a new instance of the Layer class. Used for deserialization purposes.

public Layer()

Layer(string)

Creates a new layer

public Layer(string name)

Parameters

name string

Properties

Elements

The elements of the layer

public List<GameElement> Elements { get; set; }

Property Value

List<GameElement>

Enabled

Determines if the layer is enabled

public bool Enabled { get; set; }

Property Value

bool

ID

Gets the unique identifier for this instance.

public Guid ID { get; }

Property Value

Guid

Name

The name of the layer

public string Name { get; set; }

Property Value

string

Visible

Determines if the layer is visible

public bool Visible { get; set; }

Property Value

bool

Methods

Deserialize(JObject, SerializationContext, Func<JObject, bool>)

Deserializes the current object and its child elements from a JSON representation using the specified

public void Deserialize(JObject obj, SerializationContext serializationContext, Func<JObject, bool> callback = null)

Parameters

obj JObject
serializationContext SerializationContext
callback Func<JObject, bool>

Exceptions

Exception

Dispose(BaseScene, IRenderDevice)

Disposes the layer

public void Dispose(BaseScene scene, IRenderDevice renderer)

Parameters

scene BaseScene
renderer IRenderDevice

FindElement(Guid)

Finds an element by ID

public GameElement? FindElement(Guid id)

Parameters

id Guid

Returns

GameElement

FindElementByID(string)

Finds an element by ID as a string representation of the GUID

public GameElement? FindElementByID(string id)

Parameters

id string

Returns

GameElement

FindElement<T>(string)

Finds an element by name

public T? FindElement<T>(string name) where T : GameElement

Parameters

name string

Returns

T

Type Parameters

T

FindElements(Func<GameElement, bool>)

Finds all elements that match a specific predicate

public ICollection<GameElement> FindElements(Func<GameElement, bool> predicate)

Parameters

predicate Func<GameElement, bool>

Returns

ICollection<GameElement>

FindElementsWithBehavior<T>()

Finds all elements with a specific behavior type

public ICollection<GameElement> FindElementsWithBehavior<T>() where T : IGameBehavior

Returns

ICollection<GameElement>

Type Parameters

T

FindElementsWithTag(string)

Finds all elements with a specific tag

public ICollection<GameElement> FindElementsWithTag(string tag)

Parameters

tag string

Returns

ICollection<GameElement>

GetElements<T>()

Finds all elements of a specific type

public ICollection<GameElement> GetElements<T>() where T : GameElement

Returns

ICollection<GameElement>

Type Parameters

T

Init(BaseScene, Viewport, IRenderDevice)

Initializes the layer

public void Init(BaseScene scene, Viewport viewport, IRenderDevice renderer)

Parameters

scene BaseScene
viewport Viewport
renderer IRenderDevice

RenderLayer(BaseScene, Viewport, IRenderDevice, Camera)

Renders the layer

public void RenderLayer(BaseScene scene, Viewport viewport, IRenderDevice renderer, Camera camera)

Parameters

scene BaseScene
viewport Viewport
renderer IRenderDevice
camera Camera

RenderShadows(BaseScene, Viewport, IRenderDevice)

Renders the shadows of the layer

public void RenderShadows(BaseScene scene, Viewport viewport, IRenderDevice renderer)

Parameters

scene BaseScene
viewport Viewport
renderer IRenderDevice

Serialize(JsonWriter, SerializationContext, Action<JsonWriter>)

Serializes the current object and its child elements into a JSON representation using the specified serialization context.

public void Serialize(JsonWriter writer, SerializationContext serializationContext, Action<JsonWriter> callback = null)

Parameters

writer JsonWriter
serializationContext SerializationContext

The context that provides configuration and state information for the serialization process.

callback Action<JsonWriter>

TryRemoveElement(GameElement)

Tries to add an element to the layer

public bool TryRemoveElement(GameElement element)

Parameters

element GameElement

Returns

bool

Update(BaseScene, float)

Updates the layer

public void Update(BaseScene scene, float dt)

Parameters

scene BaseScene
dt float