0
Skip to Content
Home
RapidPixel SDK
Consulting
Constant Robotics
Constant Robotics
Home
RapidPixel SDK
Consulting
Constant Robotics
Constant Robotics
Home
RapidPixel SDK
Consulting
Home Joystick C++ lib. Simple cross-platform library to work with joysticks
joystick_thumbai.png Image 1 of 2
joystick_thumbai.png
joystick_thumbai.png Image 2 of 2
joystick_thumbai.png
joystick_thumbai.png
joystick_thumbai.png

Joystick C++ lib. Simple cross-platform library to work with joysticks

€200.00

Joystick v2.0.5 is a C++ library which assists developers in seamlessly interfacing with various types of joysticks, all without relying on third-party dependencies.

We sell source code of this library as is, without future updates and technical support according to perpetual non-exclusive license. You pay once and can use this library in your software and hardware products without limits. Please read the license agreement before purchasing: LICENSE. You can buy technical support service for this product.

Add To Cart

Joystick v2.0.5 is a C++ library which assists developers in seamlessly interfacing with various types of joysticks, all without relying on third-party dependencies.

We sell source code of this library as is, without future updates and technical support according to perpetual non-exclusive license. You pay once and can use this library in your software and hardware products without limits. Please read the license agreement before purchasing: LICENSE. You can buy technical support service for this product.

Technical support service technical_support_thumbai.png (Copy) technical_support_thumbai.png (Copy)
Technical support service
from €700.00
Options:

Joystick v2.0.5 is a C++ library which assists developers in seamlessly interfacing with various types of joysticks, all without relying on third-party dependencies.

We sell source code of this library as is, without future updates and technical support according to perpetual non-exclusive license. You pay once and can use this library in your software and hardware products without limits. Please read the license agreement before purchasing: LICENSE. You can buy technical support service for this product.

Purchase options

You can buy the software by bank transfer. Bank transfer available only for companies. To buy software by bank transfer please send us request to info@constantrobotics.com. Also, you can buy technical support service for this product.

Overview

Joystick is a C++ library which assists developers in interfacing with various types of joysticks, all without relying on third-party dependencies. The library is compatible with Linux (uses Linux native joysticks interface) and Windows (uses WinAPI). The library doesn't have third party dependencies. The library is a CMake project and utilizes C++17 standard.

Downloads

Programmer’s manual: DOWNLOAD

Simple interface

namespace cr 
{
namespace utils 
{
/// Joystick class.
class Joystick
{
public:

    /// Get Joystick class version.
    static std::string getVersion();

    /// Class constructor.
    Joystick();

    /// Class destructor.
    ~Joystick();

    /// Find available joysticks.
    std::vector<JoystickInfo> findJoysticks();

    /// Open joystick.
    bool openJoystick(int id);

    /// Close joystick.
    void closeJoystick();

    /// Check status of a button.
    bool getButtonState(int buttonId);

    /// Get hat value.
    int getHatValue();

    /// Get axis value.
    int getAxisValue(int axisId);
};
}
}

Simple example

#include <iostream>
#include <thread>
#include <chrono>
#include "Joystick.h"

int main(void)
{
    // Create joystick controller.
    cr::utils::Joystick joyStickController;

    // Read number of connected joysticks.
    std::vector<cr::utils::JoystickInfo> joysticks;
    joysticks = joyStickController.findJoysticks();

    // Open first joystick
    joyStickController.openJoystick(joysticks.at(0).id);

    // Print joystick infos.
    std::cout << "Joystick name : " << joysticks.at(0).name << std::endl;
    std::cout << "Number of button : " << joysticks.at(0).numButtons << std::endl;
    std::cout << "Number of axes : " << joysticks.at(0).numAxes << std::endl;

    // Read all avaliable buttons one by one 
    while (true) 
    {
        for (int i = 0; i < joysticks.at(0).numButtons; ++i)
        {
            if (joyStickController.getButtonState(i) == true)
                std::cout << "Button : " << i << " pressed" << std::endl;
        }
        
        std::this_thread::sleep_for(std::chrono::milliseconds(100));
    }
    return 0;
}

You Might Also Like

NtpUdpChannel C++ lib. Point-to-point communication based on UDP for low bandwidth channels
NtpUdpChannel C++ lib. Point-to-point communication based on UDP for low bandwidth channels
€10.00
UdpDataChannel C++ lib. Point-to-point reliable communication between applications using UDP
UdpDataChannel C++ lib. Point-to-point reliable communication between applications using UDP
€30.00

ABOUT US

ConstantRobotics conducts scientific research in video processing, control protocols, and data exchange. Our diverse team of engineers develops software libraries and applications to simplify complex problems. Customers can test our libraries on their own data before making a purchase. Detailed documentation is available on our website. Our main focus is creating real-time algorithms that run on any platform.

CONTACTS

ConstantRobotics Sp. z o.o. Warsaw, Poland, VAT ID: PL5252930273, info@constantrobotics.com

LICENSES FOR SOFTWARE

Our software libraries are distributed under perpetual licenses. We don't restrict distribution of software libraries as a part of your hardware and software products. Our library prices are the same for all our clients and are based on the following principle: you can create a counterpart of our algorithms with the same or better characteristics, but the cost of your own research will be significantly higher than buying ready-made libraries. By purchasing our libraries you get a solution with proven performance. Two licenses are available for our products: a perpetual license for the compiled version of the library and a perpetual license for the source code. You pay once at the time of purchase. Download licenses:

  • LICENSE FOR SOURCE CODE OF SOFTWARE

  • LICENSE FOR COMPILED VERSION OF SOFTWARE

SEND US MESSAGE

Thank you! We will connect you soon.


© 2025 ConstantRobotics

Privacy Policy | Terms & Conditions | Archive