Entity2D ClassDelta Engine Documentation
Basis of all 2D entity objects to render like lines, sprites etc. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Entities Entity
    DeltaEngine.Entities DrawableEntity
      DeltaEngine.Rendering2D Entity2D
        Asteroids Projectile
        CarGame2D Track
        DeltaEngine.Rendering2D.Fonts FontText
        DeltaEngine.Rendering2D.Fonts VectorText
        DeltaEngine.Rendering2D.Graphs GradientGraph
        DeltaEngine.Rendering2D HierarchyEntity2D
        DeltaEngine.Rendering2D.Shapes GradientFilledRect
        DeltaEngine.Rendering2D.Shapes Grid2D
        DeltaEngine.Rendering2D.Shapes Line2D
        DeltaEngine.Rendering2D.Shapes Polygon2D
        DeltaEngine.Rendering2D.Spine SpineSkeleton
        GameOfLife GameManager
        GameOfLife GameOfLife
        SideScroller Game
        Snake Snake

Namespace: DeltaEngine.Rendering2D
Assembly: DeltaEngine.Rendering2D (in DeltaEngine.Rendering2D.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class Entity2D : DrawableEntity

The Entity2D type exposes the following members.

Constructors

  NameDescription
Protected methodEntity2D 
Initializes a new instance of the Entity2D class
Public methodEntity2D(Rectangle)
Initializes a new instance of the Entity2D class
Top
Methods

  NameDescription
Public methodAdd T  (Overrides DrawableEntity Add T (T).)
Public methodAddTag (Inherited from Entity.)
Public methodClearTags (Inherited from Entity.)
Public methodContains T  (Overrides Entity Contains T  .)
Public methodContainsBehavior T  (Inherited from Entity.)
Public methodContainsTag (Inherited from Entity.)
Protected methodDeactivate (Inherited from Entity.)
Public methodDispose (Inherited from Entity.)
Public methodGet T  (Overrides DrawableEntity Get T  .)
Protected methodGetActiveBehaviors (Inherited from Entity.)
Public methodGetComponentsForEditing
Protected methodGetComponentsForSaving (Overrides Entity GetComponentsForSaving .)
Protected methodGetDrawBehaviors (Inherited from DrawableEntity.)
Public methodGetInterpolatedArray T  (Inherited from DrawableEntity.)
Public methodGetInterpolatedList T  (Inherited from DrawableEntity.)
Public methodGetOrDefault T  (Inherited from Entity.)
Public methodGetTags (Inherited from Entity.)
Protected methodNextUpdateStarted (Overrides DrawableEntity NextUpdateStarted .)
Public methodOnDraw T  (Inherited from DrawableEntity.)
Protected methodOnPositionChanged
Protected methodOnRotationChanged
Public methodRemove T  (Inherited from Entity.)
Public methodRemoveTag (Inherited from Entity.)
Public methodRotatedDrawAreaContains
Public methodSet (Overrides DrawableEntity Set(Object).)
Public methodSetComponents (Inherited from Entity.)
Public methodSetWithoutInterpolation T  (Overrides DrawableEntity SetWithoutInterpolation T (T).)
Public methodStart T  (Inherited from Entity.)
Public methodStop T  (Inherited from Entity.)
Public methodToggleVisibility (Inherited from DrawableEntity.)
Public methodToString (Inherited from Entity.)
Top
Extension Methods

  NameDescription
Public Extension MethodAffixToPhysics (Defined by Entity2DPhysicsExtensions.)
Public Extension MethodStartBouncingOffScreenEdges (Defined by Entity2DExtensions.)
Public Extension MethodStartFalling (Defined by Entity2DExtensions.)
Public Extension MethodStartMoving (Defined by Entity2DExtensions.)
Public Extension MethodStartRotating (Defined by Entity2DExtensions.)
Top
Fields

  NameDescription
Protected fieldcomponents (Inherited from Entity.)
Public fieldStatic memberDefaultColor
Protected fieldlastTickLerpComponents
Each element can either be a Lerp, a Lerp List or an array of Lerp objects. View code on GitHub
(Inherited from DrawableEntity.)
Top
Properties

  NameDescription
Public propertyAlpha
Public propertyCenter
Public propertyColor
Public propertyDidFootprintChange
Public propertyDrawArea
Public propertyIsActive (Inherited from DrawableEntity.)
Public propertyIsPauseable (Inherited from Entity.)
Public propertyIsVisible (Inherited from DrawableEntity.)
Public propertyLastColor
Public propertyLastDrawArea
Public propertyNumberOfComponents (Inherited from Entity.)
Public propertyRenderLayer (Inherited from DrawableEntity.)
Public propertyRotation
Public propertyRotationCenter
Public propertySize
Public propertyTopLeft
Public propertyUpdatePriority (Inherited from Entity.)
Top
Remarks

Tests: DeltaEngine.Rendering2D.Tests.Entity2DTests
Examples

17 unit tests call DeltaEngine.Rendering2D.Entity2D
[Test]
public void CreateEntity2D()
{
    var entity = new Entity2D(DoubleSizedRectangle) { Color = Color.Green, Rotation = 15 };
    Assert.AreEqual(DoubleSizedRectangle, entity.DrawArea);
    Assert.AreEqual(Color.Green, entity.Color);
    Assert.AreEqual(15, entity.Rotation);
    Assert.AreEqual(DrawableEntity.DefaultRenderLayer, entity.RenderLayer);
    Assert.AreEqual(Vector2D.One, entity.Center);
    Assert.AreEqual(new Size(2, 2), entity.Size);
}
[Test]
public void AddNewComponent()
{
    var entity = new Entity2D(Rectangle.Zero);
    Assert.AreEqual(Rectangle.Zero, entity.DrawArea);
    Assert.AreEqual(Color.White, entity.Color);
    Assert.AreEqual(0, entity.NumberOfComponents);
    entity.Add(Size.Zero);
    Assert.AreEqual(1, entity.NumberOfComponents);
}
[Test]
public void SetDrawAreaProperties()
{
    var entity = new Entity2D(Rectangle.One)
    {
        Color = Color.Blue,
        Center = Vector2D.One,
        Size = new Size(2)
    };
    Assert.AreEqual(DoubleSizedRectangle, entity.DrawArea);
    entity.DrawArea = new Rectangle(-1, -1, 2, 2);
    Assert.AreEqual(Vector2D.Zero, entity.Center);
    entity.TopLeft = Vector2D.Zero;
    Assert.AreEqual(Vector2D.Zero, entity.TopLeft);
    Assert.AreEqual(DoubleSizedRectangle, entity.DrawArea);
}
See Also