void INL_Update() { MAEvent event; while (maGetEvent(&event)) { switch(event.type) { case EVENT_TYPE_POINTER_PRESSED: keyboard_handler(sc_Space, 1); break; case EVENT_TYPE_POINTER_RELEASED: keyboard_handler(sc_Space, 0); break; case EVENT_TYPE_KEY_PRESSED: if(event.key == MAK_1) { FrameBuffer_setOrientation(gOrientation++); VW_UpdateScreen(); break; } keyboard_handler(XKeysymToScancode(event.key), 1); break; case EVENT_TYPE_KEY_RELEASED: keyboard_handler(XKeysymToScancode(event.key), 0); break; case EVENT_TYPE_CLOSE: Quit(NULL); break; case EVENT_TYPE_AUDIOBUFFER_FILL: AudioBufferFill(); break; default: break; } } //VW_UpdateScreen(); }
void INL_Update() { SDL_Event event; boolean DebouncedKeyboard[NumCodes]; memcpy(DebouncedKeyboard, InternalKeyboard, sizeof(DebouncedKeyboard)); /* poll joysticks */ SDL_JoystickUpdate(); if (SDL_PollEvent(&event)) { do { switch(event.type) { case SDL_KEYDOWN: keyboard_handler(XKeysymToScancode(event.key.keysym.sym), 1); break; case SDL_KEYUP: keyboard_handler(XKeysymToScancode(event.key.keysym.sym), 0); break; case SDL_QUIT: /* TODO do something here */ break; default: break; } } while (SDL_PollEvent(&event)); } if (InternalKeyboard[sc_Alt] && (!DebouncedKeyboard[sc_Return] && InternalKeyboard[sc_Return])) { SDL_GrabMode gm; SDL_WM_ToggleFullScreen(surface); gm = SDL_WM_GrabInput(SDL_GRAB_QUERY); if (gm == SDL_GRAB_OFF && !(surface->flags & SDL_FULLSCREEN)) SDL_ShowCursor(1); else SDL_ShowCursor(0); } if (InternalKeyboard[sc_Control] && (!DebouncedKeyboard[sc_G] && InternalKeyboard[sc_G])) { SDL_GrabMode gm; gm = SDL_WM_GrabInput(SDL_GRAB_QUERY); SDL_WM_GrabInput((gm == SDL_GRAB_ON) ? SDL_GRAB_OFF : SDL_GRAB_ON); gm = SDL_WM_GrabInput(SDL_GRAB_QUERY); if (gm == SDL_GRAB_OFF && !(surface->flags & SDL_FULLSCREEN)) SDL_ShowCursor(1); else SDL_ShowCursor(0); } /* ctrl-z for iconify window? */ }