SDL keystate glitch

In my game I’m using ALT-ENTER to toggle between fullscreen and windowed
modes (by calling SDL_SetVideoMode).

Originally, I was checking for the enter key in a keydown event, but I
found that the modeswitch caused SDL to get confused about keystates -
thinking keys were down when they were really up and vice versa. My game
just went into a mode-switching frenzy :slight_smile:

I changed my app to use a keyup event instead, which pretty much fixes
the problem because the user is less likely to be holding keys down.

Not sure if I’d really classify it as a bug - it’s a classic game
problem - but I thought I’d better report it here.

I’m using Xfree86 3.something under Linux. Haven’t tried it under
windows (or mac or beos or …), but I’d imagine there might well be
similar problems if it is switching on the fly between using windows
messages and directinput.

Ben.–
Ben Campbell (Antipodean Straggler)
Programmer, Creature Labs
ben.campbell at creaturelabs.com
www.creaturelabs.com