[SDL] confused by SDL_KEYDOWN event!!!

dh11111 dh11111 at 126.com
Thu Oct 11 12:18:34 PDT 2007


Good job! your suggestion has do a lot good to my application.thank you very much.Pehaps the SDL doc doesn't descript this good lib perfectly !
在2007-10-12,"Jonathan Dearborn" <grimfang4 at hotmail.com> 写道:
Hey,
 
My suggestion would be to use SDL_PollEvent() in a while loop so that you catch and handle every event that hops on the queue.  You're probably ignoring all events but one each frame.
 
void Tank::HandleInput( SDL_Event &event,bool &run)
{
 while(SDL_PollEvent(&event))  {        ...  }
 }  Jonny D  
  Date: Thu, 11 Oct 2007 22:29:32 +0800
From:dh11111 at 126.com
To:sdl at lists.libsdl.org
Subject: [SDL] confused by SDL_KEYDOWN event!!!
here is my code:
 void Tank::HandleInput( SDL_Event &event,bool &run)
{ SDL_PollEvent(&event); ...
}  problem is that when i keep pressing a key such as "a", the tank in my game keeps moving left,but if i move the mouse during the tank's moving,the tank stops moving.In the doc it seems that there are  some differences between  SDL_KEYDOWN  and SDL_MouseMotionEvent,but in my application ,it seems there no differences between them! what's the difference between these two event type? it seems a little confused.PS: My OS is Windows xp,SDL version is 1.2.12,IDE is VS 2005 PRO. 
 Get news, entertainment and everything you care about at Live.com.Check it out!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20071012/70d2efb4/attachment.htm 


More information about the SDL mailing list