I would suggest using the PIPE (or) bitwise operator to set all the axes you want in the constructor with just one argument, having tons of bools makes it unintuitive.
It would be cleaner. I can make a PR if you think this is nicer than now.
I know you need an Axis count, so I would not use the value, I'd just assign each axis 1, 2, 4, 8, 16, 32... as a constant and then you can generate the value count like this:
#define MAX_AXIS 8
#define JOYSTICK_RY_AXIS 1
#define JOYSTICK_RZ_AXIS 2
#define JOYSTICK_ANOTHER_AXIS 4
// .....
int currentAxis = JOYSTICK_RY_AXIS | JOYSTICK_RZ_AXIS; // this would come by constructor
int axisCount = 0;
for(int i = 0; i < MAX_AXIS; i++)
if(currentAxis & (int)pow(2, i))
axisCount++;
I would suggest using the PIPE (or) bitwise operator to set all the axes you want in the constructor with just one argument, having tons of bools makes it unintuitive.
You could make something like
In the end you end up doing this in:
It would be cleaner. I can make a PR if you think this is nicer than now. I know you need an Axis count, so I would not use the value, I'd just assign each axis 1, 2, 4, 8, 16, 32... as a constant and then you can generate the value count like this: