Mac OS X : Shutting down using Command-Q

Hi all,
I hope there are some very knowledgeable Mac OS X and SDL developers
here who can tell me how they ensure in their game loop that Command-Q
exits their game on Mac OS X. At the moment I’m just using ESC, but some
mac users are complaining.
A small snippet of C/C++ or similar code would be great.

Thanks,

Dominique.

A small snippet of C/C++ or similar code would be great.
wherever you handle keyboard input for escape, just check to make sure
that one of the meta modifiers is down, as well as the letter “q”.

something like:

if ( (KMOD_LMETA & keysym->mod) && keysym->sym == SDLK_q)
{
//clean up code
}

There is a corresponding KMOD_RMETA if you want to check for that too,
then you will have if [ (Right || Left) AND (q) ]

Hope that helps!

John

Thanks John,
This is great!

Dominique.On Sat, 17 Apr 2010 17:25:13 -0500, “John M.” wrote:

wherever you handle keyboard input for escape, just check to make sure
that one of the meta modifiers is down, as well as the letter “q”.

something like:

if ( (KMOD_LMETA & keysym->mod) && keysym->sym == SDLK_q)
{
//clean up code
}

There is a corresponding KMOD_RMETA if you want to check for that too,
then you will have if [ (Right || Left) AND (q) ]

Hope that helps!