gcsx_event.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* GCSx
  2. ** EVENT.H
  3. **
  4. ** Our custom event queue to allow preempting SDL's event queue
  5. */
  6. /*****************************************************************************
  7. ** Copyright (C) 2003-2006 Janson
  8. **
  9. ** This program is free software; you can redistribute it and/or modify
  10. ** it under the terms of the GNU General Public License as published by
  11. ** the Free Software Foundation; either version 2 of the License, or
  12. ** (at your option) any later version.
  13. **
  14. ** This program is distributed in the hope that it will be useful,
  15. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ** GNU General Public License for more details.
  18. **
  19. ** You should have received a copy of the GNU General Public License
  20. ** along with this program; if not, write to the Free Software
  21. ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
  22. *****************************************************************************/
  23. #ifndef __GCSx_EVENT_H_
  24. #define __GCSx_EVENT_H_
  25. // Add event to queue; will occur before any SDL events
  26. void insertEvent(const SDL_Event* customEvent);
  27. // Add event to beginning of queue; intended for SDL_CLOSE events
  28. void preemptEvent(const SDL_Event* customEvent);
  29. /* SDL_OBJECTCHANGE events no longer use the queue
  30. **
  31. // Search for matching event to combine, add to beginning of queue if not found
  32. // Intended for SDL_OBJECTCHANGE events
  33. void combinatoryEvent(const SDL_Event* customEvent);
  34. **
  35. */
  36. // Returns true if any events are waiting in OUR queue only
  37. int eventsWaiting();
  38. // Returns the next event from our queue or SDL's queue
  39. // Returns 1 if event was found, 0 if none waiting
  40. int grabEvent(SDL_Event* store);
  41. // Removes all events from our queue that reference the
  42. // given window
  43. void cleanEvents(const void* window);
  44. // Clears internal event queues, freeing SDL_OBJECTCHANGE objects
  45. // Basically CLOSE, FOCUS, and OBJCHANGE
  46. // Call when you reset the desktop/quit (memory cleanup)
  47. // Use desktop->initEventCleanup() to clear user-initiated events
  48. void clearEvents();
  49. // Push an unused event (or a copy of mouse events) to game queue
  50. // or retrieve the next game queue event
  51. // Used only in desktop overlay mode- otherwise game just
  52. // calls grabEvent
  53. void storeEventGame(const SDL_Event* event);
  54. int grabEventGame(SDL_Event* store);
  55. #endif