Giter Site home page Giter Site logo

Is a Joystick supported? about gainput HOT 5 CLOSED

jkuhlmann avatar jkuhlmann commented on August 24, 2024
Is a Joystick supported?

from gainput.

Comments (5)

alexg-k avatar alexg-k commented on August 24, 2024

I am still interested in my question, though I want to notice that I solved my problem by binding a part of another library in my project. I integrated SFML\Window\Joystick.hpp that only uses these static functions to work without initialization:

// Is joystick #0 connected?
bool connected = sf::Joystick::isConnected(0);
// How many buttons does joystick #0 support?
unsigned int buttons = sf::Joystick::getButtonCount(0);
// Does joystick #0 define a X axis?
bool hasX = sf::Joystick::hasAxis(0, sf::Joystick::X);
// Is button #2 pressed on joystick #0?
bool pressed = sf::Joystick::isButtonPressed(0, 2);
// What's the current position of the Y axis on joystick #0?
float position = sf::Joystick::getAxisPosition(0, sf::Joystick::Y);

I don't want to be ungrateful. I am sure your library is on a good way. This may be interesting for other users who are looking for input libraries.

from gainput.

jkuhlmann avatar jkuhlmann commented on August 24, 2024

Sorry for the slow response time. I hope you are still interested in some insight into this.

I guess you are on Windows?

Conceptually, joysticks are considered gamepads. They should work on most platforms. On Windows, however, Gainput currently only uses XINPUT for acquiring gamepad data. XINPUT is Microsoft's only current library for this and it only really supports Xbox gamepads. So, as long as your joystick does not show up as an Xbox gamepad, you are out of luck for now.

I'm getting the impression that it might make sense to add support for the deprecated DirectInput API or maybe the joystick API.

from gainput.

alexg-k avatar alexg-k commented on August 24, 2024

Thx got it! Yes, this would extend your library nicely. It is hard to find a lightweight, easy, purely HID oriented library without all the graphics, sound modules etc.!

from gainput.

sytelus avatar sytelus commented on August 24, 2024

I'm also very interested in using gainput for AIrSim project. We basically connect remote controls used for drones to PC via USB. They show up as joystick and we want to access this input. I just tried out gainput to access this and as mentioned in this thread, it doesn't recognize joysticks at all.

I think current way to do this is using Raw Input APIs (instead of DirectInput APIs). There just doesn't seem to be good cross platform library that allows access to joysticks without lot of fuss. It would be very nice to have this capability in gainput!

from gainput.

kerm1t avatar kerm1t commented on August 24, 2024

Hi, just tried to read USB Joypad input with current sources (3/2/2019) but no response in Gainput test projects.

from gainput.

Related Issues (20)

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.