The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_PumpEvents with more SDL_KEYDOWN events
Kowalsky95


Joined: 28 Jun 2015
Posts: 1
I bumped to one problem with SDL_PumpEvents function. I got this part of code.
Code:
while (true)         
   {
      SDL_PumpEvents();
      memset(&events,0,255 * sizeof(SDL_Event)); //just because of debug
      int NumOfEvents = SDL_PeepEvents(events,INT_MAX,SDL_GETEVENT,SDL_FIRSTEVENT,SDL_LASTEVENT);
      
      rendering();

      SDL_Delay(1000);
   }


Problem is, that when I press more times key, during program waiting. After SDL_PumpEvents is called, I received only one SDL_KEYDOWN event by SDL_PeepEvents. But when I put SDL_PumpEvents into loop, i received more than that one event. When is program in delay and I press ASDF, in this manner I receive one SDL_KEYDOWN event each loop, but when I use this type
Code:
for(int a=0;a<100;a++)
     SDL_PumpEvents();

I receive every event in first frame. Is it bug or is it purposely?
Thanks for answers and sorry for my English
Patrik Valkovic