Skip to content

A portable way of accessing HID devices cross-platform

License

Notifications You must be signed in to change notification settings

Bhakiyaraj/OpenInput

 
 

Repository files navigation

OpenInput NuGet Version

A portable way of accessing HID devices cross-platform

This project is still in development!

Supported Platforms

Supported Devices

  • Mouse
  • Keyboard
  • TouchDevice
  • GamePad

Getting Started

OpenInput is designed for loc libraries, which makes it easy for numerous reasons when implementation and handling crossplatform code.

In this example I am going to show how to use Nine.Injection which is a lightwight loc library.

First you have to map the devices you wish to use.

// You can read more on how to map object on Nine.Injection's page.
var container = new Container();
container
    .Map<IMouse>(new RawInput.Mouse(this.Handle))
    .Map<IKeyboard>(new RawInput.Keyboard(this.Handle))
    .Map<IGamePad>(new RawInput.GamePad(this.Handle));

Now when you have mapped the devices you can start using them.

var keyboardState = container.Get<IKeyboard>().GetCurrentState();
if (keyboardState.IsKeyDown(Keys.Space))
{
    /// Executed if Space is down.
}

About

A portable way of accessing HID devices cross-platform

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%