comparison src/joystick/SDL_joystick.c @ 1722:5daa04d862f1 SDL-1.3

Added a userdata parameter for event filters. Added a function to filter the existing queued events. Added explicit support for relative mouse mode to the API.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 30 Jun 2006 08:18:44 +0000
parents 4da1ee79c9af
children
comparison
equal deleted inserted replaced
1721:1cc762cafff8 1722:5daa04d862f1
446 SDL_Event event; 446 SDL_Event event;
447 event.type = SDL_JOYAXISMOTION; 447 event.type = SDL_JOYAXISMOTION;
448 event.jaxis.which = joystick->index; 448 event.jaxis.which = joystick->index;
449 event.jaxis.axis = axis; 449 event.jaxis.axis = axis;
450 event.jaxis.value = value; 450 event.jaxis.value = value;
451 if ((SDL_EventOK == NULL) || (*SDL_EventOK) (&event)) { 451 if ((SDL_EventOK == NULL)
452 || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
452 posted = 1; 453 posted = 1;
453 SDL_PushEvent(&event); 454 SDL_PushEvent(&event);
454 } 455 }
455 } 456 }
456 #endif /* !SDL_EVENTS_DISABLED */ 457 #endif /* !SDL_EVENTS_DISABLED */
472 SDL_Event event; 473 SDL_Event event;
473 event.jhat.type = SDL_JOYHATMOTION; 474 event.jhat.type = SDL_JOYHATMOTION;
474 event.jhat.which = joystick->index; 475 event.jhat.which = joystick->index;
475 event.jhat.hat = hat; 476 event.jhat.hat = hat;
476 event.jhat.value = value; 477 event.jhat.value = value;
477 if ((SDL_EventOK == NULL) || (*SDL_EventOK) (&event)) { 478 if ((SDL_EventOK == NULL)
479 || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
478 posted = 1; 480 posted = 1;
479 SDL_PushEvent(&event); 481 SDL_PushEvent(&event);
480 } 482 }
481 } 483 }
482 #endif /* !SDL_EVENTS_DISABLED */ 484 #endif /* !SDL_EVENTS_DISABLED */
501 event.jball.type = SDL_JOYBALLMOTION; 503 event.jball.type = SDL_JOYBALLMOTION;
502 event.jball.which = joystick->index; 504 event.jball.which = joystick->index;
503 event.jball.ball = ball; 505 event.jball.ball = ball;
504 event.jball.xrel = xrel; 506 event.jball.xrel = xrel;
505 event.jball.yrel = yrel; 507 event.jball.yrel = yrel;
506 if ((SDL_EventOK == NULL) || (*SDL_EventOK) (&event)) { 508 if ((SDL_EventOK == NULL)
509 || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
507 posted = 1; 510 posted = 1;
508 SDL_PushEvent(&event); 511 SDL_PushEvent(&event);
509 } 512 }
510 } 513 }
511 #endif /* !SDL_EVENTS_DISABLED */ 514 #endif /* !SDL_EVENTS_DISABLED */
540 #if !SDL_EVENTS_DISABLED 543 #if !SDL_EVENTS_DISABLED
541 if (SDL_ProcessEvents[event.type] == SDL_ENABLE) { 544 if (SDL_ProcessEvents[event.type] == SDL_ENABLE) {
542 event.jbutton.which = joystick->index; 545 event.jbutton.which = joystick->index;
543 event.jbutton.button = button; 546 event.jbutton.button = button;
544 event.jbutton.state = state; 547 event.jbutton.state = state;
545 if ((SDL_EventOK == NULL) || (*SDL_EventOK) (&event)) { 548 if ((SDL_EventOK == NULL)
549 || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
546 posted = 1; 550 posted = 1;
547 SDL_PushEvent(&event); 551 SDL_PushEvent(&event);
548 } 552 }
549 } 553 }
550 #endif /* !SDL_EVENTS_DISABLED */ 554 #endif /* !SDL_EVENTS_DISABLED */