SJoystickEvent::NUMBER_OF_AXIS too small

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
porcus
Posts: 149
Joined: Sun May 27, 2007 6:24 pm
Location: Germany

SJoystickEvent::NUMBER_OF_AXIS too small

Post by porcus »

Hi,

the enum in SJoystickEvent currently assumes, that a Joystick will never have more than 6 Axes.
I have for example an Inertial Measuring Unit which has 7 Axes (3 for accelerometer and 4 for gyroscope).
So I had to change IEventReceiver.h a little bit: (I added some more Axes than necessary, propably someone else needs more)

Code: Select all

enum
        {
            NUMBER_OF_BUTTONS = 32,
 
            AXIS_X = 0, // e.g. analog stick 1 left to right
            AXIS_Y,     // e.g. analog stick 1 top to bottom
            AXIS_Z,     // e.g. throttle, or analog 2 stick 2 left to right
            AXIS_R,     // e.g. rudder, or analog 2 stick 2 top to bottom
            AXIS_U,
            AXIS_V,
            AXIS_6,
            AXIS_7,
            AXIS_8,
            AXIS_9,
            AXIS_10,
            AXIS_11,
            AXIS_12,
            AXIS_13,
            AXIS_14,
            AXIS_15,
            NUMBER_OF_AXES
        };
I'm currently working on Linux and there were no changes necessary to CIrrDeviceLinux, but this won't work on windows due to some switches checking only for 6 axes in pollJoysticks() in CIrrDeviceWin32.
Could somebody take a look at this please (also for other devices)?
I'm currently very busy, but when I port my project to windows I would at least do the windows fix.
(Btw: Has anybody tried Joysticks on android yet?)
Post Reply