Reading Keyboard Upon SDL App Launch

I am trying to get the state of the keyboard as a SDL application
starts up. The problem is any keys held down before the application
starts up do not throw any events, so I cannot detect what keys are held
down as the app starts. I initialize SDL first, of course, and then
before setting the graphics mode I am reading from the keyboard state to
try and change graphical options and game options depending on the key(s)
you hold down upon startup. Anyone attempted or done this? =)

  • Andrew
 I am trying to get the state of the keyboard as a SDL application 

starts up. The problem is any keys held down before the application
starts up do not throw any events, so I cannot detect what keys are held
down as the app starts. I initialize SDL first, of course, and then
before setting the graphics mode I am reading from the keyboard state to
try and change graphical options and game options depending on the key(s)
you hold down upon startup. Anyone attempted or done this? =)

This is done on purpose so key events from key ups don’t mess with apps
on startup. You’ll have to use a platform specific API to get the current
key state if you want it.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment