KernelAPI reference
Class CapabilityRegistry
Namespace: MicroEngine.Kernel
Assembly: MicroEngine.Kernel.dll
Guide: Modules and the frame schedule
Optional features something in the engine offers (a display that can change its mode, a touch screen, platform diagnostics), declared by whoever provides them and queried by type. A feature that is absent is simply not declared: callers ask with TryGet``1 instead of casting a platform or device to find out.
public sealed class CapabilityRegistryInheritance
Remarks
Read and written on the game’s thread; not thread-safe.
Constructors
CapabilityRegistry()
public CapabilityRegistry()Properties
Count
The number of declared capabilities.
public int Count { get; }Property Value
Methods
Add<T>(T)
Declares capability as the capability of type T.
public void Add<T>(T capability) where T : classParameters
capability T
Type Parameters
T
Exceptions
capability is null.
A capability of type T is already declared; use Replace``1.
Has<T>()
Whether a capability is declared as T.
public bool Has<T>() where T : classReturns
Type Parameters
T
Remove<T>()
Withdraws the capability declared as T; false when there was none.
public bool Remove<T>() where T : classReturns
Type Parameters
T
Replace<T>(T)
Declares capability as the capability of type T, in place of the one declared before, if any.
public void Replace<T>(T capability) where T : classParameters
capability T
Type Parameters
T
Exceptions
capability is null.
TryGet<T>(out T?)
The capability declared as T, if there is one.
public bool TryGet<T>(out T? capability) where T : classParameters
capability T?
Returns
Type Parameters
T