Show / Hide Table of Contents

Class Entity

A positioned and animated game object.

Inheritance
object
ScreenObject
Entity
Implements
IScreenObject
IPositionable
IComponentHost
IHasID
Inherited Members
ScreenObject.ComponentsUpdate
ScreenObject.ComponentsRender
ScreenObject.ComponentsMouse
ScreenObject.ComponentsKeyboard
ScreenObject.ComponentsEmpty
ScreenObject.Render(TimeSpan)
ScreenObject.ProcessKeyboard(Keyboard)
ScreenObject.ProcessMouse(MouseScreenObjectState)
ScreenObject.LostMouse(MouseScreenObjectState)
ScreenObject.OnFocusLost()
ScreenObject.OnFocused()
ScreenObject.OnParentChanged(IScreenObject, IScreenObject)
ScreenObject.OnPositionChanging(Point, Point)
ScreenObject.OnVisibleChanged()
ScreenObject.OnEnabledChanged()
ScreenObject.GetSadComponents<TComponent>()
ScreenObject.GetSadComponent<TComponent>()
ScreenObject.HasSadComponent<TComponent>(out TComponent)
ScreenObject.OnSadComponentAdded(IComponent)
ScreenObject.OnSadComponentRemoved(IComponent)
ScreenObject.SortComponents()
ScreenObject.Components_FilterAddItem(IComponent, List<IComponent>, List<IComponent>, List<IComponent>, List<IComponent>, List<IComponent>)
ScreenObject.Components_FilterRemoveItem(IComponent, List<IComponent>, List<IComponent>, List<IComponent>, List<IComponent>, List<IComponent>)
ScreenObject.Components_Sort(List<IComponent>, List<IComponent>, List<IComponent>, List<IComponent>, List<IComponent>)
ScreenObject.OnSerializingMethod(StreamingContext)
ScreenObject.SortOrder
ScreenObject.Children
ScreenObject.Parent
ScreenObject.Position
ScreenObject.AbsolutePosition
ScreenObject.IgnoreParentPosition
ScreenObject.IsVisible
ScreenObject.IsEnabled
ScreenObject.IsFocused
ScreenObject.FocusedMode
ScreenObject.IsExclusiveMouse
ScreenObject.UseKeyboard
ScreenObject.UseMouse
ScreenObject.SadComponents
ScreenObject.ParentChanged
ScreenObject.PositionChanged
ScreenObject.PositionChanging
ScreenObject.IsVisibleChanged
ScreenObject.IsEnabledChanged
ScreenObject.FocusLost
ScreenObject.Focused
object.GetType()
object.MemberwiseClone()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: SadConsole.Entities
Assembly: SadConsole.dll
Syntax
[DataContract]
public class Entity : ScreenObject, IScreenObject, IPositionable, IComponentHost, IHasID

Constructors

Entity(AnimatedScreenObject, int)

Creates a new entity as an animated surface.

Declaration
public Entity(AnimatedScreenObject appearance, int zIndex)
Parameters
Type Name Description
AnimatedScreenObject appearance

The surface appearance to use for the entity.

int zIndex

The rendering order. Higher values are drawn on top of lower values.

Entity(ColoredGlyphBase, int)

Creates a new entity, copying the provided appearance to this entity.

Declaration
public Entity(ColoredGlyphBase appearance, int zIndex)
Parameters
Type Name Description
ColoredGlyphBase appearance

The appearance of the entity.

int zIndex

The rendering order. Lower values are under higher values.

Entity(Animated, int)

Creates a new entity as an animated surface.

Declaration
public Entity(Entity.Animated appearance, int zIndex)
Parameters
Type Name Description
Entity.Animated appearance

The surface appearance to use for the entity.

int zIndex

The rendering order. Higher values are drawn on top of lower values.

Entity(SingleCell, int)

Creates a new entity as a single cell.

Declaration
public Entity(Entity.SingleCell appearance, int zIndex)
Parameters
Type Name Description
Entity.SingleCell appearance

The single cell appearance to use for the entity.

int zIndex

The rendering order. Higher values are drawn on top of lower values.

Entity(Color, Color, int, int)

Creates a new entity, copying the provided appearance to this entity.

Declaration
public Entity(Color foreground, Color background, int glyph, int zIndex)
Parameters
Type Name Description
Color foreground

The foreground color of the entity.

Color background

The background color of the entity.

int glyph

The glyph color of the entity.

int zIndex

The rendering order. Lower values are under higher values.

Properties

AppearanceSingle

The appearance of the entity when IsSingleCell is true.

Declaration
public Entity.SingleCell? AppearanceSingle { get; set; }
Property Value
Type Description
Entity.SingleCell

AppearanceSurface

The appearance of the entity when IsSingleCell is false.

Declaration
public Entity.Animated? AppearanceSurface { get; set; }
Property Value
Type Description
Entity.Animated

IsDirty

Indicates this entity's visual appearance has changed.

Declaration
public bool IsDirty { get; set; }
Property Value
Type Description
bool

IsSingleCell

When true, indicates that this entity is a single cell entity; otherwise false and it's an animated surface entity.

Declaration
public bool IsSingleCell { get; set; }
Property Value
Type Description
bool

Name

A friendly name of the game object.

Declaration
[DataMember]
public string Name { get; set; }
Property Value
Type Description
string

UsePixelPositioning

Treats the Position of the entity as if it is pixels and not cells.

Declaration
public bool UsePixelPositioning { get; set; }
Property Value
Type Description
bool

ZIndex

The drawing layer this entity is drawn at

Declaration
[DataMember]
public int ZIndex { get; set; }
Property Value
Type Description
int

Methods

Load(string)

Loads a Entity from a file.

Declaration
public static Entity Load(string file)
Parameters
Type Name Description
string file

The source file.

Returns
Type Description
Entity

The entity.

OnIsDirtyChanged()

Raises the IsDirtyChanged event.

Declaration
protected virtual void OnIsDirtyChanged()

OnPositionChanged(Point, Point)

Raises the PositionChanged event.

Declaration
protected override void OnPositionChanged(Point oldPosition, Point newPosition)
Parameters
Type Name Description
Point oldPosition

The previous position.

Point newPosition

The new position.

Overrides
ScreenObject.OnPositionChanged(Point, Point)

Save(string)

Saves the Entity to a file.

Declaration
public void Save(string file)
Parameters
Type Name Description
string file

The destination file.

ToString()

Returns the name of the entity prefixed with "Entity - ".

Declaration
public override string ToString()
Returns
Type Description
string

The name.

Overrides
ScreenObject.ToString()

Update(TimeSpan)

If an effect is applied to the cell, updates the effect.

Declaration
public override void Update(TimeSpan delta)
Parameters
Type Name Description
TimeSpan delta
Overrides
ScreenObject.Update(TimeSpan)

UpdateAbsolutePosition()

Sets a value for AbsolutePosition based on the Position of this instance and the Parent instance.

Declaration
public override void UpdateAbsolutePosition()
Overrides
ScreenObject.UpdateAbsolutePosition()

Events

IsDirtyChanged

Raised when the IsDirty property changes value.

Declaration
public event EventHandler? IsDirtyChanged
Event Type
Type Description
EventHandler

Implements

IScreenObject
IPositionable
IComponentHost
IHasID

Extension Methods

Keyboard.RemoveKeyboardHook(IScreenObject, Func<IScreenObject, Keyboard, bool>)
Keyboard.RemoveKeyboardHooks(IScreenObject)
Keyboard.WithKeyboard(IScreenObject, Func<IScreenObject, Keyboard, bool>)
Mouse.RemoveMouseHook(IScreenObject, Func<IScreenObject, MouseScreenObjectState, bool>)
Mouse.RemoveMouseHooks(IScreenObject)
Mouse.WithMouse(IScreenObject, Func<IScreenObject, MouseScreenObjectState, bool>)
Update.RemoveUpdateHook(IScreenObject, Action<IScreenObject, TimeSpan>)
Update.RemoveUpdateHooks(IScreenObject)
Update.WithUpdate(IScreenObject, Action<IScreenObject, TimeSpan>)
ExtensionsSystem.GetDebuggerDisplayValue(object)
In this article

Back to top

Back to top Generated by DocFX