Scene Clear Method 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 Clear()
Remarks

Tests: DeltaEngine.Scenes.Tests.SceneTests
Examples

2 unit tests call DeltaEngine.Scenes.Scene.Clear
[Test, CloseAfterFirstFrame]
public void ClearingControlsDeactivatesThem()
{
    var label = new Sprite(material, Rectangle.One) { IsActive = true };
    var control = new EmptyControl { IsActive = true };
    scene.Add(label);
    scene.Add(control);
    scene.Clear();
    Assert.AreEqual(0, scene.Controls.Count);
    Assert.IsFalse(label.IsActive);
    Assert.IsFalse(control.IsActive);
}
[Test, CloseAfterFirstFrame]
public void DisposingSceneClearsIt()
{
    var loadedScene = ContentLoader.Load<Scene>("SceneWithAButton");
    var button = loadedScene.Controls[0] as Button;
    loadedScene.Dispose();
    Assert.AreEqual(0, loadedScene.Controls.Count);
    Assert.IsFalse(button.IsActive);
}
See Also