Extensions to make it easier to work with Input states used for keys, buttons and gestures.
View code on GitHub System Object DeltaEngine.Input StateExtensionsNamespace: DeltaEngine.InputAssembly: DeltaEngine.Input (in DeltaEngine.Input.dll) Version: 1.1.1.0 (1.1.1)
public static class StateExtensions
public static class StateExtensions
<ExtensionAttribute>
Public NotInheritable Class StateExtensions
<ExtensionAttribute>
Public NotInheritable Class StateExtensions
[ExtensionAttribute]
public ref class StateExtensions abstract sealed
[ExtensionAttribute]
public ref class StateExtensions abstract sealed
[<AbstractClassAttribute>]
[<SealedAttribute>]
type StateExtensions = class end
[<AbstractClassAttribute>]
[<SealedAttribute>]
type StateExtensions = class end
The StateExtensions type exposes the following members.
TopTests:
DeltaEngine.Input.Tests.StateExtensionsTests1 unit tests call DeltaEngine.Input.StateExtensions
[Test]
public void TestUpdateStates()
{
var state = State.Released;
state = state.UpdateOnNativePressing(true);
Assert.AreEqual(State.Pressing, state);
state = state.UpdateOnNativePressing(true);
Assert.AreEqual(State.Pressed, state);
state = state.UpdateOnNativePressing(false);
Assert.AreEqual(State.Releasing, state);
state = state.UpdateOnNativePressing(false);
Assert.AreEqual(State.Released, state);
}
[Test]
public void TestUpdateStates()
{
var state = State.Released;
state = state.UpdateOnNativePressing(true);
Assert.AreEqual(State.Pressing, state);
state = state.UpdateOnNativePressing(true);
Assert.AreEqual(State.Pressed, state);
state = state.UpdateOnNativePressing(false);
Assert.AreEqual(State.Releasing, state);
state = state.UpdateOnNativePressing(false);
Assert.AreEqual(State.Released, state);
}