Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Announcements
  4. QJoysticks - A simple way to use joysticks with your project
Forum Updated to NodeBB v4.3 + New Features

QJoysticks - A simple way to use joysticks with your project

Scheduled Pinned Locked Moved Unsolved Announcements
joystickssdlqmllibrary
6 Posts 5 Posters 10.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • alex_spataruA Offline
    alex_spataruA Offline
    alex_spataru
    wrote on last edited by
    #1

    Hello,

    Recently, I needed to use joystick input for one of my projects. After I finished, I thought that creating a library to handle joystick input could be beneficial for the Qt community.

    The library uses SDL to obtain joystick input from real devices, but it also implements a way to use the computer's keyboard as a joystick, with no additional code or hacks.

    As a side note, the QMake config files allow you to use this library with no additional fiddling under OS X and Windows. Under Linux, you may need to install libsdl2-dev in order to be able to compile and link the library.

    Finally, you are welcome to try it and (if you want) contribute to the project.

    Project repository: https://github.com/alex-spataru/QJoysticks

    Regards,
    --Alex Spataru

    1 Reply Last reply
    3
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Thanks for sharing your work !

      Since you are working on game related inputs, you might also be interested by the qtgamepad module.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • Wissam KafaW Offline
        Wissam KafaW Offline
        Wissam Kafa
        wrote on last edited by
        #3

        hi @alex_spataru , you have done a great job, i'm interested in integrating your project to my qt projects, i need to read position and other data from a joystick and display them in my qt gui, but i didn't know how to do that using your code, could youd please guide me though this process.
        thanx

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Lachrymology
          wrote on last edited by
          #4

          Hi Alex, the new QGamePad introduced in Qt5.7 up to Qt5.10 isn't detecting the most common XBox 360 Controller (Win7 to Win10). I stumbled over SDL which seems to have a working interface for controllers and then Google showed me your post. QJoysticks is working prefectly!

          Thank you very much for your invested time - it's golden.

          Mike

          PS: I only needed to add

          #undef main //before int main() to avoid interferences with SDL and Qt
          
          1 Reply Last reply
          1
          • M Offline
            M Offline
            masoomehsn
            wrote on last edited by
            #5

            hi,i'm new in qt and i want to run this example with qt creator,but i get these errors:

            1.error: skipping incompatible QJoysticks-master\QJoysticks-master\lib\SDL\bin\windows\mingw/SDL2.dll when searching for -lSDL2

            2.error: skipping incompatible QJoysticks-master\QJoysticks-master\lib\SDL\bin\windows\mingw/SDL2.dll when searching for -lSDL2

            3.error: collect2.exe: error: ld returned 1 exit status

            I do not know how to solve these

            SGaistS 1 Reply Last reply
            0
            • M masoomehsn

              hi,i'm new in qt and i want to run this example with qt creator,but i get these errors:

              1.error: skipping incompatible QJoysticks-master\QJoysticks-master\lib\SDL\bin\windows\mingw/SDL2.dll when searching for -lSDL2

              2.error: skipping incompatible QJoysticks-master\QJoysticks-master\lib\SDL\bin\windows\mingw/SDL2.dll when searching for -lSDL2

              3.error: collect2.exe: error: ld returned 1 exit status

              I do not know how to solve these

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @masoomehsn hi and welcome to devnet,

              Which version of Qt are you using ?
              With which compiler ?
              How did you get the QJoysticks .dll ?
              Which architecture are they ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved