From d2119c1ad98f5abbd7ea849efcb74dcbb712fe88 Mon Sep 17 00:00:00 2001 From: pagefault <> Date: Wed, 25 Apr 2001 04:08:32 +0000 Subject: [PATCH] Added trackball support (hpsolo) --- zsnes/src/linux/sdllink.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/zsnes/src/linux/sdllink.c b/zsnes/src/linux/sdllink.c index 5ad6d139..f1c702d5 100644 --- a/zsnes/src/linux/sdllink.c +++ b/zsnes/src/linux/sdllink.c @@ -195,7 +195,35 @@ int Main_Proc(void) case SDL_MOUSEBUTTONUP: MouseButton = MouseButton & ~event.button.button; 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: CurrentJoy = event.jaxis.which; for (j=0; j<3; j++) {