简体   繁体   中英

What's the equivalent of XInput* functions in Linux?

I'm porting an application that uses the Xbox controller to Linux. On windows, it essentially just uses XInputGetState() to read the state of the controller, so I'm looking for a replacement for that function on Linux.

I see that wine hasn't implemented XInputGetState() , but at the same time there are a large number of games supporting the Xbox controller on Linux, so it's doable.

Does anyone know what library can be used to interact with an Xbox controller on Linux?

You can either:

  1. use the SDL library
  2. use the functions in linux/joystick.h yourself
  3. find some other library which abstracts (3) for you like this or the one linked by user3716731.

The (1-2) solutions are mainly C , but so is the XInput API, so you probably can deal with it.

I would probably go with number 1, because that approach should have the best documentation.

So I know its not pure C++ however there is a great addon for openFrameworks called ofxGamePad that is compatible with linux. I have had success using it with linux for a gamepad.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM