Interface IComponent
A component that can be added to a IScreenObject.
Namespace: SadConsole.Components
Assembly: SadConsole.dll
Syntax
public interface IComponent
Properties
IsKeyboard
When true, indicates that this component calls the ProcessKeyboard(IScreenObject, Keyboard, out bool) method.
Declaration
bool IsKeyboard { get; }
Property Value
Type | Description |
---|---|
bool |
IsMouse
When true, indicates that this component calls the ProcessMouse(IScreenObject, MouseScreenObjectState, out bool) method.
Declaration
bool IsMouse { get; }
Property Value
Type | Description |
---|---|
bool |
IsRender
When true, indicates that this component calls the Render(IScreenObject, TimeSpan) method.
Declaration
bool IsRender { get; }
Property Value
Type | Description |
---|---|
bool |
IsUpdate
When true, indicates that this component calls the Update(IScreenObject, TimeSpan) method.
Declaration
bool IsUpdate { get; }
Property Value
Type | Description |
---|---|
bool |
SortOrder
Indicates priority to other components.
Declaration
uint SortOrder { get; }
Property Value
Type | Description |
---|---|
uint |
Methods
OnAdded(IScreenObject)
Called when the component is added to a host.
Declaration
void OnAdded(IScreenObject host)
Parameters
Type | Name | Description |
---|---|---|
IScreenObject | host | The host that added the component. |
OnHostUpdated(IScreenObject)
Called when various states in the host change.
Declaration
void OnHostUpdated(IScreenObject host)
Parameters
Type | Name | Description |
---|---|---|
IScreenObject | host | The host that uses this component. |
OnRemoved(IScreenObject)
Called when the component is removed from the host.
Declaration
void OnRemoved(IScreenObject host)
Parameters
Type | Name | Description |
---|---|---|
IScreenObject | host | The host that removed the component. |
ProcessKeyboard(IScreenObject, Keyboard, out bool)
Called by a host when the keyboard is being processed.
Declaration
void ProcessKeyboard(IScreenObject host, Keyboard keyboard, out bool handled)
Parameters
Type | Name | Description |
---|---|---|
IScreenObject | host | The host that added this component. |
Keyboard | keyboard | The keyboard state. |
bool | handled | When set to true informs the host caller that we handled the mouse and to stop others from handling. |
ProcessMouse(IScreenObject, MouseScreenObjectState, out bool)
Called by a host when the mouse is being processed.
Declaration
void ProcessMouse(IScreenObject host, MouseScreenObjectState state, out bool handled)
Parameters
Type | Name | Description |
---|---|---|
IScreenObject | host | The host console. |
MouseScreenObjectState | state | The mouse state. |
bool | handled | When set to true informs the host caller that we handled the mouse and to stop others from handling. |
Render(IScreenObject, TimeSpan)
Called by a host on the render frame.
Declaration
void Render(IScreenObject host, TimeSpan delta)
Parameters
Type | Name | Description |
---|---|---|
IScreenObject | host | The host calling the component. |
TimeSpan | delta | The time that has elapsed from the last call to this component. |
Update(IScreenObject, TimeSpan)
Called by a host on the update frame.
Declaration
void Update(IScreenObject host, TimeSpan delta)
Parameters
Type | Name | Description |
---|---|---|
IScreenObject | host | The host calling the component. |
TimeSpan | delta | The time that has elapsed from the last call to this component. |