Game ClassDelta Engine Documentation
Renders the background, ball, level and score; Also handles starting new levels View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Content ContentData
    DeltaEngine.Scenes Scene
      Breakout Game

Namespace: Breakout
Assembly: Breakout (in Breakout.exe) Version: 1.1.1.0 (1.1.1)
Syntax

public class Game : Scene

The Game type exposes the following members.

Constructors

  NameDescription
Public methodGame
Initializes a new instance of the Game class
Top
Methods

  NameDescription
Public methodAdd(Entity2D) (Inherited from Scene.)
Public methodAdd(IEnumerable Entity2D ) (Inherited from Scene.)
Public methodAddControlToScene (Inherited from Scene.)
Public methodClear (Inherited from Scene.)
Protected methodCreateDefault (Inherited from ContentData.)
Public methodDispose (Inherited from ContentData.)
Protected methodDisposeData (Inherited from Scene.)
Public methodHide (Inherited from Scene.)
Public methodInternalCreateDefault (Inherited from ContentData.)
Protected methodLoadData (Inherited from Scene.)
Public methodLoadFromFile (Inherited from Scene.)
Public methodRemove (Inherited from Scene.)
Public methodSetQuadraticBackground(String) (Inherited from Scene.)
Public methodSetQuadraticBackground(Material) (Inherited from Scene.)
Public methodSetViewportBackground(String) (Inherited from Scene.)
Public methodSetViewportBackground(Material) (Inherited from Scene.)
Public methodShow (Inherited from Scene.)
Public methodToBackground (Inherited from Scene.)
Public methodToForeground (Inherited from Scene.)
Public methodToString (Inherited from ContentData.)
Top
Fields

  NameDescription
Protected fieldbackground (Inherited from Scene.)
Protected fieldContentChanged (Inherited from ContentData.)
Top
Properties

  NameDescription
Protected propertyAllowCreationIfContentNotFound (Inherited from ContentData.)
Public propertyControls (Inherited from Scene.)
Public propertyDrawArea (Inherited from Scene.)
Public propertyIsDisposed (Inherited from ContentData.)
Public propertyMetaData (Inherited from ContentData.)
Public propertyName (Inherited from ContentData.)
Public propertyScore
Top
Remarks

Tests: Breakout.Tests.GameTests
Examples

3 unit tests call Breakout.Game
[Test]
public void Draw()
{
    Resolve<Paddle>();
    Resolve<RelativeScreenSpace>();
    new Game(Resolve<Window>());
}
[Test, CloseAfterFirstFrame]
public void RemoveBallIfGameIsOver()
{
    var score = Resolve<Score>();
    bool isGameOver = false;
    score.GameOver += () => isGameOver = true;
    score.LifeLost();
    score.LifeLost();
    score.LifeLost();
    Assert.IsTrue(isGameOver);
}
[Test, CloseAfterFirstFrame]
public void KillingAllBricksShouldAdvanceToNextLevel()
{
    bool isGameOver = false;
    var level = Resolve<Level>();
    var score = Resolve<Score>();
    Score remScore = score;
    remScore.GameOver += () => isGameOver = true;
    Assert.AreEqual(1, score.Level);
    DisposeAllBricks(level);
    Assert.AreEqual(0, level.BricksLeft);
    Assert.AreEqual(1, remScore.Level);
    Assert.IsFalse(isGameOver);
}
See Also