Added mobile application events, with implementations for iOS and Android
This commit is contained in:
parent
2ff60371f5
commit
2ac8624930
9 changed files with 182 additions and 44 deletions
|
@ -111,6 +111,7 @@ SDL_StopEventLoop(void)
|
|||
SDL_event_watchers = tmp->next;
|
||||
SDL_free(tmp);
|
||||
}
|
||||
SDL_EventOK = NULL;
|
||||
}
|
||||
|
||||
/* This function (and associated calls) may be called more than once */
|
||||
|
@ -133,8 +134,7 @@ SDL_StartEventLoop(void)
|
|||
}
|
||||
#endif /* !SDL_THREADS_DISABLED */
|
||||
|
||||
/* No filter to start with, process most event types */
|
||||
SDL_EventOK = NULL;
|
||||
/* Process most event types */
|
||||
SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
|
||||
SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);
|
||||
SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE);
|
||||
|
@ -365,7 +365,9 @@ int
|
|||
SDL_PushEvent(SDL_Event * event)
|
||||
{
|
||||
SDL_EventWatcher *curr;
|
||||
|
||||
event->common.timestamp = SDL_GetTicks();
|
||||
|
||||
if (SDL_EventOK && !SDL_EventOK(SDL_EventOKParam, event)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -516,8 +518,20 @@ SDL_RegisterEvents(int numevents)
|
|||
return event_base;
|
||||
}
|
||||
|
||||
/* This is a generic event handler.
|
||||
*/
|
||||
int
|
||||
SDL_SendAppEvent(SDL_EventType eventType)
|
||||
{
|
||||
int posted;
|
||||
|
||||
posted = 0;
|
||||
if (SDL_GetEventState(eventType) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.type = eventType;
|
||||
posted = (SDL_PushEvent(&event) > 0);
|
||||
}
|
||||
return (posted);
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SendSysWMEvent(SDL_SysWMmsg * message)
|
||||
{
|
||||
|
|
|
@ -36,6 +36,7 @@ extern int SDL_StartEventLoop(void);
|
|||
extern void SDL_StopEventLoop(void);
|
||||
extern void SDL_QuitInterrupt(void);
|
||||
|
||||
extern int SDL_SendAppEvent(SDL_EventType eventType);
|
||||
extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message);
|
||||
|
||||
extern int SDL_QuitInit(void);
|
||||
|
|
|
@ -114,15 +114,7 @@ SDL_QuitQuit(void)
|
|||
int
|
||||
SDL_SendQuit(void)
|
||||
{
|
||||
int posted;
|
||||
|
||||
posted = 0;
|
||||
if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.type = SDL_QUIT;
|
||||
posted = (SDL_PushEvent(&event) > 0);
|
||||
}
|
||||
return (posted);
|
||||
return SDL_SendAppEvent(SDL_QUIT);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue