Example #1
0
void
EventLoop::Dispatch(SDL_Event &event)
{
  if (event.type == EVENT_USER && event.user.data1 != NULL) {
    Window *window = (Window *)event.user.data1;
    window->OnUser(event.user.code);
  } else if (event.type == EVENT_CALLBACK) {
    Callback callback = (Callback)event.user.data1;
    callback(event.user.data2);
  } else if (event.type == EVENT_NOTIFY && event.user.data1 != NULL) {
    Notify *notify = (Notify *)event.user.data1;
    notify->RunNotification();
  } else
    top_window.on_event(event);
}
Example #2
0
void
EventLoop::Dispatch(const Event &event)
{
  if (event.type == Event::USER) {
    Window *window = (Window *)event.ptr;
    window->OnUser(event.param);
  } else if (event.type == Event::TIMER) {
    AndroidTimer *timer = (AndroidTimer *)event.ptr;
    timer->run();
  } else if (event.type == Event::CALLBACK) {
    event.callback(event.ptr);
  } else if (event.type == Event::NOTIFY) {
    Notify *notify = (Notify *)event.ptr;
    notify->RunNotification();
  } else if (event.type != Event::NOP)
    top_window.OnEvent(event);
}