Ryujinx/src/Ryujinx.Input/KeyboardStateSnapshot.cs
TSRBerry 2989c163a8
editorconfig: Set default encoding to UTF-8 (#5793)
* editorconfig: Add default charset

* Change file encoding from UTF-8-BOM to UTF-8
2023-12-04 14:17:13 +01:00

30 lines
851 B
C#

using System.Runtime.CompilerServices;
namespace Ryujinx.Input
{
/// <summary>
/// A snapshot of a <see cref="IKeyboard"/>.
/// </summary>
public class KeyboardStateSnapshot
{
private readonly bool[] _keysState;
/// <summary>
/// Create a new <see cref="KeyboardStateSnapshot"/>.
/// </summary>
/// <param name="keysState">The keys state</param>
public KeyboardStateSnapshot(bool[] keysState)
{
_keysState = keysState;
}
/// <summary>
/// Check if a given key is pressed.
/// </summary>
/// <param name="key">The key</param>
/// <returns>True if the given key is pressed</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool IsPressed(Key key) => _keysState[(int)key];
}
}