app.cpp 540 B

12345678910111213141516171819202122232425262728
  1. #include "app.h"
  2. #include "../../../std/async/native/async.h"
  3. #include <SDL.h>
  4. namespace bbApp{
  5. void postEventFilter( bbAsync::Event *event ){
  6. SDL_UserEvent uevent;
  7. uevent.type=SDL_USEREVENT;
  8. uevent.code=0;
  9. uevent.data1=event;
  10. uevent.data2=0;
  11. if( SDL_PeepEvents( (SDL_Event*)&uevent,1,SDL_ADDEVENT,SDL_FIRSTEVENT,SDL_LASTEVENT )!=1 ){
  12. //TODO: Cleanup shutdown!
  13. //printf( "SDL_PeepEvents error: %s\n",SDL_GetError() );fflush( stdout );
  14. }
  15. }
  16. void init(){
  17. bbAsync::setPostEventFilter( postEventFilter );
  18. }
  19. }