Code Monkey home page Code Monkey logo

nil's Introduction

Nice Input Library

NIL is a gaming input library written in C++.
It is somewhat battle-tested, but currently implemented for Windows only.

Platform

Current version tested on Windows 10 and newer.
Previous generation (before 2019) was tested against Windows Vista.
Should work fine on Windows 8, possibly on Windows 7, with few modifications if any.

Building

  1. Open nil.sln
  2. Press Build

By default NIL builds as a statically linked library under Visual Studio 2022.
Clang-CL should also work fine, probably others, as long as some C++20 features are supported.
NIL has No dependencies, except for the Windows SDK & Driver Kit.

Features

  • Full multi-keyboard and multi-mice support. Every connected input device has a unique ID.
  • Plug-and-Play device runtime connection & disconnection detection.
  • Singlethreaded, buffered and listener-based.
  • Uses Raw Input for mice & keyboards, XInput for XBOX and emulated controllers, and DirectInput for old-school gamepads.
  • No force feedback support. Too cumbersome to implement in a smartly abstracted way. If you're feeling up to the task, however, pull requests are welcome.

Pitfalls

See the PITFALLS.md file for information on some potential implementation pitfalls.

License

NIL is licensed under the MIT license.
For full license text, see the LICENSE file.

Logitech SDKs under the external folder are property of Logitech.
See the Logitech SDK documentation files for licensing specifics.

nil's People

Contributors

noorus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nil's Issues

Make XInput optional

Currently throws an exception if XInput load or init fails.
Can't really see it happening, but there's no reason to not be flexible about it since the module "system" is dynamic anyway.

HidD_GetAttributes fails on Windows 10 under VMware

Not sure if the reason is a specific (emulated) device, Windows 10 in general or something that VMware does, but failing to fetch attributes for a single device probably should not cause the entire library to fail. Such a device should simply be skipped over.

Support for pen input

Currently a Wacom tablet is not detected as an input device at all, yet simple point and click games might be played with a pen.
As it is similar to touch input, maybe take that into account at the same time.

Multiple devices with same VID/PID

Hi!

I'm having an issue when connecting 2 DInput gamepads of the same model simultaniously. Depending on what order I connect them, sometimes only one of them will work. And in that case the working one will be initiated 2 times. So in your test application this means pressing button 0 on joypad #1 causes this output:

Controller button 0 pressed (USB 2A8K GamePad)
Controller button 0 pressed (USB 2A8K GamePad)
Controller button 0 released (USB 2A8K GamePad)
Controller button 0 released (USB 2A8K GamePad)

But pressing the same button on joypad #2 doesn't render any output at all.

This problem traces back to the way DInput genrates GUID's. There seems to be a bug when connecting several gamepads of the same model, so that depending on the order of connection sometimes DInput will actually change GUID of certain controllers. I've tried really hard to find a workaround for this but havn't come up with something. Do you have any ideas? :-)

Maybe switch to supporting only a single listener per device/instance

Constant multi-listener support might be somewhat taxing both for the implementer and for the callbacks. Actually utilising multiple listeners per device seems like a rather exceptional use case, which the end-application could then implement themselves.
To be investigates or at least thought about.

Direct HID support for mouse & keyboard

After completing the HID manager, implement direct mouse & keyboard support by HID communication. This way the precision and speed limitations of going through the OS & DirectInput layer are easily surpassed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.