Command ClassDelta Engine Documentation
Input Commands are loaded via the InputCommands.xml file, see InputCommands.cs for details. You can also create your own commands, which will be executed whenever any trigger is invoked. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Entities Entity
    DeltaEngine.Commands Command

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

public class Command : Entity, Updateable

The Command type exposes the following members.

Constructors

  NameDescription
Public methodCommand(Action)
Initializes a new instance of the Command class
Public methodCommand(Action Single )
Initializes a new instance of the Command class
Public methodCommand(Action Vector2D )
Initializes a new instance of the Command class
Public methodCommand(Action Vector2D, Vector2D, Boolean )
Initializes a new instance of the Command class
Public methodCommand(String, Action)
Initializes a new instance of the Command class
Public methodCommand(String, Action Vector2D )
Initializes a new instance of the Command class
Public methodCommand(String, Action Single )
Initializes a new instance of the Command class
Public methodCommand(String, Action Vector2D, Vector2D, Boolean )
Initializes a new instance of the Command class
Top
Methods

  NameDescription
Public methodAdd(Trigger)
Public methodAdd T (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 (Inherited from Entity.)
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 methodGetTriggers
Public methodStatic memberRegister
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.)
Public methodUpdate
Top
Fields

  NameDescription
Public fieldStatic memberBack
Go back one screen, normally unbound except if scene allows it. Right click or back button. View code on GitHub
Public fieldStatic memberClick
Protected fieldcomponents (Inherited from Entity.)
Public fieldStatic memberDoubleClick
Public fieldStatic memberDrag
Public fieldStatic memberDualDrag
Public fieldStatic memberExit
Exits whole application (or scene) if supported. Mostly handled by the platform (Alt+F4). View code on GitHub
Public fieldStatic memberFlick
Public fieldStatic memberHold
Public fieldStatic memberMiddleClick
Public fieldStatic memberMoveDirectly
Allows to move left, right, up or down using ASDW or the cursor keys or an onscreen stick. View code on GitHub
Public fieldStatic memberMoveDown
Public fieldStatic memberMoveLeft
Public fieldStatic memberMoveRight
Public fieldStatic memberMoveUp
Public fieldStatic memberPinch
Public fieldStatic memberRightClick
Public fieldStatic memberRotateAround
Public fieldStatic memberRotateDirectly
Rotate in 3D space, normally bound to the mouse, game pad thumb stick or onscreen stick. View code on GitHub
Public fieldStatic memberZoom
Top
Properties

  NameDescription
Public propertyIsActive (Inherited from Entity.)
Public propertyIsPauseable (Overrides Entity IsPauseable.)
Public propertyNumberOfComponents (Inherited from Entity.)
Public propertyUpdatePriority (Inherited from Entity.)
Top
Remarks

Tests: DeltaEngine.Tests.Commands.CommandTests
Examples

13 unit tests call DeltaEngine.Commands.Command
[Test]
public void CreateCommandWithManualTrigger()
{
    customTrigger = new MockTrigger();
    new Command(() => pos += Time.Delta).Add(customTrigger);
    InvokingTriggerWithoutRunningEntitiesDoesNotCauseAction();
    InvokingTriggerOnceWithMultipleRunsOnlyCausesOneAction();
}
[Test]
public void CommandIsNotPausable()
{
    Assert.IsFalse(new Command(() => { }).IsPauseable);
}
[Test]
public void UnableToRegisterCommandWithoutNameOrTriggers()
{
    Assert.Throws<ArgumentNullException>(() => Command.Register("", null));
    Assert.Throws<Command.UnableToRegisterCommandWithoutTriggers>(
        () => Command.Register("a", null));
}
See Also