Sign in to follow this  

SDL - Always catching SDLK_SPACE but never F4 or ALT?

Recommended Posts

Ok, what's wrong with SDL? For some reason it always catches SDLK_SPACE and even a combo with SDLK_SPACE and SDLK_q... But when I try ANYTHING with SDLK_LALT(or RALT) it doesn't work... Look how I'm doing it:
if (mainApp.GetKey(SDLK_LALT) && mainApp.GetKey(SDLK_F4))
    return false;

// Where GetKey is this:
Uint8 CApp_Input::GetKey(Uint8 aKey)
    return (SDL_GetKeyState(NULL)[aKey]);

Again, it works with SDLK_q or SDLK_SPACE... What can be wrong? Oh, and yeah, mainApp is an instance of CApp, which inherits from CApp_Event, CApp_Input, and other stuff.. This is SDL in C++. Thanks to all!
aKey has to be an int, not a Uint8. [Edited by - agi_shi on November 26, 2005 9:30:49 AM]

Share this post

Link to post
Share on other sites
I haven't personally used it, but you might try SDL_GetModStat() for ALT. This is from the documentation:

typedef enum {
KMOD_NONE = 0x0000,
KMOD_LSHIFT= 0x0001,
KMOD_RSHIFT= 0x0002,
KMOD_LCTRL = 0x0040,
KMOD_RCTRL = 0x0080,
KMOD_LALT = 0x0100,
KMOD_RALT = 0x0200,
KMOD_LMETA = 0x0400,
KMOD_RMETA = 0x0800,
KMOD_NUM = 0x1000,
KMOD_CAPS = 0x2000,
KMOD_MODE = 0x4000,
} SDLMod;

SDL also defines the following symbols for convenience:


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this