/NeatInput

Useful and clean .NET Standard library to monitor keyboard and mouse input on Windows.

Primary LanguageC#MIT LicenseMIT

NeatInput

forthebadge forthebadge

GitHub license Nuget GitHub last commit GitHub issues

Useful and clean .NET Standard library to monitor keyboard and mouse input on Windows.

Built with ❤︎ by Daniel Belz


Getting started

Monitoring mouse and keyboard input

To monitor mouse and keyboard input you need to attach to the OnInputReceived event handler:

private static void Main()
{
    var inputProvider = new InputProvider();
    inputProvider.InputReceived += OnInputReceived;

    Console.ReadLine();
}

private void OnInputReceived(Input input)
{
    Console.WriteLine($"Key: {input.Key} | State: {input.State}");
}

Monitoring mouse input

To monitor mouse input you need to attach to the OnMouseInputReceived event handler:

private static void Main()
{
    var inputProvider = new InputProvider();
    inputProvider.MouseInputReceived += OnMouseInputReceived;

    Console.ReadLine();
}

private void OnMouseInputReceived(MouseInput input)
{
    Console.WriteLine($"Key: {input.Key} | State: {input.State} | X: {input.X} | Y: {input.Y}");
}

Monitoring keyboard input

To monitor keyboard input you need to attach to the OnKeyboardInputReceived event handler:

private static void Main()
{
    var inputProvider = new InputProvider();
    inputProvider.KeyboardInputReceived += OnKeyboardInputReceived;

    Console.ReadLine();
}

private void OnKeyboardInputReceived(KeyboardInput input)
{
    Console.WriteLine($"Key: {input.Key} | State: {input.State}");
}

Contributing

Contributions are always welcome!
Just send me a pull request and I will look at it. If you have more changes please create a issue to discuss it first.

Donate

If you like my software, please consider supporting me with a little donation. Thank you for your support! You are great!

License

This project is licensed under the MIT License - see the LICENSE file for details