[SDL] Keyboard events problem
Ryan C. Gordon
icculus at clutteredmind.org
Sun Aug 5 18:45:02 PDT 2001
> SDL_Event event;
(I'm not sure if this is meant to be pseudocode, so I'm listing some
things that might not be problems...)
You need to call SDL_SetVideoMode(), or you won't get events.
> if (SDL_PollEvent($event) != NULL)
SDL_PollEvent() returns an integer, so it should be "!= 0"...
You need to check for event.type and make sure it's either SDL_KEYDOWN or
SDL_KEYUP; otherwise, event.key.keysym is bogus.
Secondly, &event.key.keysym is the address of the symbol. You don't want
the '&' char, otherwise it WILL always be a constant value.
More information about the SDL