... from pymikes email to the pygame mailing list...
here's an SDL C program to show it's broken...
Results of running the program on ubuntu listed below the code.
#include "SDL/SDL.h"
int main() {
SDL_Init(SDL_INIT_JOYSTICK|SDL_INIT_VIDEO);
SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
SDL_Joystick *joy;
joy = SDL_JoystickOpen(0);
printf("Name of joystick: %s\n", SDL_JoystickName(0));
printf("Number of hats: %d\n", SDL_JoystickNumHats(joy));
printf("Number of buttons: %d\n", SDL_JoystickNumButtons(joy));
printf("Number of balls: %d\n", SDL_JoystickNumBalls(joy));
SDL_Event event;
Uint8 hat_state;
int running = 1;
while( running ) {
SDL_JoystickUpdate();
hat_state = SDL_JoystickGetHat(0, 0);
if( hat_state == SDL_HAT_UP )
printf("Hat is pointing up");
while(SDL_PollEvent(&event)) {
switch(event.type) {
case SDL_QUIT:
running = 0;
break;
case SDL_KEYDOWN:
switch(event.key.keysym.sym) {
case SDLK_ESCAPE:
running = 0;
break;
default:
break;
}
break;
case SDL_JOYBUTTONDOWN:
switch(event.jbutton.button) {
case 1:
printf("1 was pressed\n");
break;
case 2:
printf("2 was pressed\n");
break;
}
break;
case SDL_JOYBUTTONUP:
switch(event.jbutton.button) {
case 1:
printf("1 was released\n");
break;
case 2:
printf("2 was released\n");
break;
}
break;
}
}
}
SDL_Quit();
return 1;
}
Name of joystick: Logitech Logitech Dual Action
Number of hats: 0
Number of buttons: 12
Number of balls: 0
1 was released
2 was released
1 was pressed
1 was released
2 was pressed
2 was released
--
Axes and Hats not read in PyGame/SDL 1.2
https://bugs.launchpad.net/bugs/376537
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs