Game ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Entities Entity
    CreepyTowers Game

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

public sealed class Game : Entity

The Game type exposes the following members.

Constructors

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

  NameDescription
Public methodAdd T  (Inherited from Entity.)
Public methodAddTag (Inherited from Entity.)
Public methodClearTags (Inherited from Entity.)
Public methodContains T  (Inherited from Entity.)
Public methodContainsBehavior T  (Inherited from Entity.)
Public methodContainsTag (Inherited from Entity.)
Protected methodDeactivate (Inherited from Entity.)
Public methodDispose (Overrides Entity Dispose .)
Public methodStatic memberExitGame
Public methodGet T 
Gets a specific component, derived classes can return faster cached values (e.g. Entity2D) View code on GitHub
(Inherited from Entity.)
Protected methodGetActiveBehaviors (Inherited from Entity.)
Protected methodGetComponentsForSaving (Inherited from Entity.)
Public methodGetOrDefault T  (Inherited from Entity.)
Public methodGetTags (Inherited from Entity.)
Public methodMessageCreditsUpdated
Public methodMessageInsufficientMoney
Public methodRemove T  (Inherited from Entity.)
Public methodRemoveTag (Inherited from Entity.)
Public methodSet (Inherited from Entity.)
Public methodSetComponents (Inherited from Entity.)
Public methodStart T  (Inherited from Entity.)
Public methodStop T  (Inherited from Entity.)
Public methodToString (Inherited from Entity.)
Top
Fields

  NameDescription
Protected fieldcomponents (Inherited from Entity.)
Top
Properties

  NameDescription
Public propertyStatic memberAppWindow
Public propertyIsActive (Inherited from Entity.)
Public propertyIsPauseable (Inherited from Entity.)
Public propertyNumberOfComponents (Inherited from Entity.)
Public propertyStatic memberSoundDevice
Public propertyUpdatePriority (Inherited from Entity.)
Top
Events

  NameDescription
Public eventCreditsUpdated
Public eventInsufficientCredits
Top
Remarks

Tests: CreepyTowers.Tests.GameCameraTests
Examples

13 unit tests call CreepyTowers.Game
[Test]
public void RenderCubeUsingGameCamera()
{
    var cubeMesh = new BoxMesh(Vector3D.One, Color.DarkGreen);
    new Model(new ModelData(cubeMesh), new Vector3D(0.0f, 0.0f, 0.0f));
    new Line3D(2 * Vector3D.UnitX, -3 * Vector3D.UnitY, Color.Red);
}
[Test, CloseAfterFirstFrame]
public void MouseDragWillDragCamera()
{
    if(!IsMockResolver)
        return; //ncrunch: no coverage
    MockMouse mouse = (MockMouse)Resolve<Mouse>();
    var originalPosition = gameCamera.Position;
    bool dragInvoked = false;
    new Command("ViewPanning", () => dragInvoked = true);
    mouse.SetNativePosition(ScreenSpace.Current.Viewport.TopLeft + new Vector2D(0.1f, 0.1f));
    mouse.SetButtonState(MouseButton.Middle, State.Pressing);
    AdvanceTimeAndUpdateEntities();
    mouse.SetNativePosition(ScreenSpace.Current.Viewport.TopRight + new Vector2D(-0.1f, 0.1f));
    mouse.SetButtonState(MouseButton.Middle, State.Pressed);
    AdvanceTimeAndUpdateEntities();
    Assert.IsTrue(dragInvoked);
    Assert.AreNotEqual(originalPosition, gameCamera.Position);
    Assert.AreEqual(135.0f, (gameCamera.Position - originalPosition).Angle(Vector3D.UnitY));
}
[Test, CloseAfterFirstFrame]
public void MouseZoomWillZoomCamera()
{
    if (!IsMockResolver)
        return; //ncrunch: no coverage
    MockMouse mouse = (MockMouse)Resolve<Mouse>();
    var originalZoom = gameCamera.ZoomLevel;
    mouse.ScrollUp();
    AdvanceTimeAndUpdateEntities();
    Assert.AreNotEqual(originalZoom, gameCamera.ZoomLevel);
}
See Also