Scene Add Method (Entity2D)Delta Engine Documentation

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

public virtual void Add(
	Entity2D control
)
Remarks

Tests: DeltaEngine.Scenes.Tests.SceneTests
Examples

14 unit tests call DeltaEngine.Scenes.Scene.Add(DeltaEngine.Rendering2D.Entity2D)
[Test, CloseAfterFirstFrame]
public void AddingControlAddsToListOfControls()
{
    Assert.AreEqual(0, scene.Controls.Count);
    var control = new EmptyControl();
    scene.Add(control);
    Assert.AreEqual(1, scene.Controls.Count);
    Assert.AreEqual(control, scene.Controls[0]);
}
[Test, CloseAfterFirstFrame]
public void AddingListOfControl()
{
    Assert.AreEqual(0, scene.Controls.Count);
    var controls = new List<EmptyControl> { new EmptyControl(), new EmptyControl() };
    scene.Add(controls);
    Assert.AreEqual(2, scene.Controls.Count);
}
[Test, CloseAfterFirstFrame]
public void AddingControlTwiceOnlyAddsItOnce()
{
    var control = new EmptyControl();
    scene.Add(control);
    scene.Add(control);
    Assert.AreEqual(1, scene.Controls.Count);
}
See Also