[SDL] confused by SDL_KEYDOWN event!!!
Charles McGarvey
onefriedrice at brokenzipper.com
Thu Oct 11 07:38:47 PDT 2007
On Oct 11, 2007, at 8:29 AM, dh11111 wrote:
> here is my code:
> :snip:
>
> 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.
I think you want to put your Move() function in some sort of 'update'
function that's called from the game loop (or a timer) irrespective
of the event handling. As it is, it seems your object will only move
if your app is receiving keyboard events, which is not an ideal input
method.
chaz
More information about the SDL
mailing list