Renders the background, ball, level and score; Also handles starting new levels
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Content ContentData
DeltaEngine.Scenes Scene
Breakout Game
Namespace: Breakout
Assembly: Breakout (in Breakout.exe) Version: 1.1.1.0 (1.1.1)
Syntax
The Game type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | Game | Initializes a new instance of the Game class |
Methods
Name | Description | |
---|---|---|
![]() | Add(Entity2D) | (Inherited from Scene.) |
![]() | Add(IEnumerable Entity2D ) | (Inherited from Scene.) |
![]() | AddControlToScene | (Inherited from Scene.) |
![]() | Clear | (Inherited from Scene.) |
![]() | CreateDefault | (Inherited from ContentData.) |
![]() | Dispose | (Inherited from ContentData.) |
![]() | DisposeData | (Inherited from Scene.) |
![]() | Hide | (Inherited from Scene.) |
![]() | InternalCreateDefault | (Inherited from ContentData.) |
![]() | LoadData | (Inherited from Scene.) |
![]() | LoadFromFile | (Inherited from Scene.) |
![]() | Remove | (Inherited from Scene.) |
![]() | SetQuadraticBackground(String) | (Inherited from Scene.) |
![]() | SetQuadraticBackground(Material) | (Inherited from Scene.) |
![]() | SetViewportBackground(String) | (Inherited from Scene.) |
![]() | SetViewportBackground(Material) | (Inherited from Scene.) |
![]() | Show | (Inherited from Scene.) |
![]() | ToBackground | (Inherited from Scene.) |
![]() | ToForeground | (Inherited from Scene.) |
![]() | ToString | (Inherited from ContentData.) |
Fields
Name | Description | |
---|---|---|
![]() | background | (Inherited from Scene.) |
![]() | ContentChanged | (Inherited from ContentData.) |
Properties
Name | Description | |
---|---|---|
![]() | AllowCreationIfContentNotFound | (Inherited from ContentData.) |
![]() | Controls | (Inherited from Scene.) |
![]() | DrawArea | (Inherited from Scene.) |
![]() | IsDisposed | (Inherited from ContentData.) |
![]() | MetaData | (Inherited from ContentData.) |
![]() | Name | (Inherited from ContentData.) |
![]() | Score |
Remarks
Examples
[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