Trigger implementation for Keyboard events, just can be invoked. Use KeyMovementTrigger for
direct movement, e.g. with cursor keys and KeyZoomTrigger for PageUp/Down zooming triggers.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Entities Entity
DeltaEngine.Commands Trigger
DeltaEngine.Commands InputTrigger
DeltaEngine.Input KeyTrigger
DeltaEngine.Input KeyMovementTrigger
DeltaEngine.Input KeyZoomTrigger
Namespace: DeltaEngine.Input
Assembly: DeltaEngine.Input (in DeltaEngine.Input.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The KeyTrigger type exposes the following members.
Constructors
Name | Description | |
---|---|---|
KeyTrigger(Dictionary String, String ) | Initializes a new instance of the KeyTrigger class | |
KeyTrigger(Key, State) | Initializes a new instance of the KeyTrigger class |
Methods
Name | Description | |
---|---|---|
Add T | (Inherited from Entity.) | |
AddTag | (Inherited from Entity.) | |
ClearTags | (Inherited from Entity.) | |
Contains T | (Inherited from Entity.) | |
ContainsBehavior T | (Inherited from Entity.) | |
ContainsTag | (Inherited from Entity.) | |
Deactivate | (Inherited from Entity.) | |
Dispose | (Inherited from Entity.) | |
Get T |
Gets a specific component, derived classes can return faster cached values (e.g. Entity2D)
View code on GitHub (Inherited from Entity.) | |
GetActiveBehaviors | (Inherited from Entity.) | |
GetComponentsForSaving | (Inherited from Entity.) | |
GetOrDefault T | (Inherited from Entity.) | |
GetTags | (Inherited from Entity.) | |
Invoke | (Inherited from Trigger.) | |
Remove T | (Inherited from Entity.) | |
RemoveTag | (Inherited from Entity.) | |
Set | (Inherited from Entity.) | |
SetComponents | (Inherited from Entity.) | |
Start T | (Inherited from Entity.) | |
StartInputDevice | (Overrides InputTrigger StartInputDevice .) | |
Stop T | (Inherited from Entity.) | |
ToString | (Inherited from Entity.) | |
Update | (Inherited from Trigger.) |
Fields
Name | Description | |
---|---|---|
components | (Inherited from Entity.) | |
Invoked | (Inherited from Trigger.) |
Properties
Name | Description | |
---|---|---|
IsActive | (Inherited from Entity.) | |
IsPauseable | (Inherited from Trigger.) | |
Key | ||
NumberOfComponents | (Inherited from Entity.) | |
State | ||
UpdatePriority | (Inherited from Entity.) | |
WasInvokedThisTick | (Inherited from Trigger.) |
Remarks
Examples
[Test] public void PressEscapeToCloseWindow() { new FontText(Font.Default, "Press ESC to close the window", Rectangle.One); new Command(() => Resolve<Window>().CloseAfterFrame()).Add(new KeyTrigger(Key.Escape, State.Pressed)); }
[Test] public void PressEscapeToCloseWindowViaRegisteredCommands() { new FontText(Font.Default, "Press ESC to close the window", Rectangle.One); Command.Register("Exit", new KeyTrigger(Key.Escape, State.Pressed)); new Command("Exit", () => Resolve<Window>().CloseAfterFrame()); }
[Test] public void PressCursorKeysToShowCircles() { var centers = new[] { new Vector2D(0.5f, 0.4f), new Vector2D(0.5f, 0.6f), new Vector2D(0.3f, 0.6f), new Vector2D(0.7f, 0.6f) }; var size = new Size(0.1f, 0.1f); CreateFontTexts(centers, size); AddCirclesAndInputCommands(centers, size); }
See Also