Added trackball support (hpsolo)

This commit is contained in:
pagefault
2001-04-25 04:08:32 +00:00
parent 961d69c307
commit d2119c1ad9

View File

@@ -195,7 +195,35 @@ int Main_Proc(void)
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
MouseButton = MouseButton & ~event.button.button; MouseButton = MouseButton & ~event.button.button;
break; break;
/*
joystick trackball code untested; change the test values
if the motion is too sensitive (or not sensitive enough);
only the first trackball is supported for now. we could get
really general here, but this may break the format of 'pressed'
*/
case SDL_JOYBALLMOTION:
CurrentJoy = event.jball.which;
if (event.jball.jball == 0) {
if (event.jball.xrel < -100) {
pressed[0x100 + CurrentJoy*32 + 6] = 0;
pressed[0x100 + CurrentJoy*32 + 7] = 1;
}
if (event.jball.xrel > 100) {
pressed[0x100 + CurrentJoy*32 + 6] = 1;
pressed[0x100 + CurrentJoy*32 + 7] = 0;
}
if (event.jball.yrel < -100) {
pressed[0x100 + CurrentJoy*32 + 8] = 0;
pressed[0x100 + CurrentJoy*32 + 9] = 1;
}
if (event.jball.yrel > 100) {
pressed[0x100 + CurrentJoy*32 + 8] = 1;
pressed[0x100 + CurrentJoy*32 + 9] = 0;
}
}
break;
case SDL_JOYAXISMOTION: case SDL_JOYAXISMOTION:
CurrentJoy = event.jaxis.which; CurrentJoy = event.jaxis.which;
for (j=0; j<3; j++) { for (j=0; j<3; j++) {