Sign in to follow this  

Help on SDL Input (Visual C++ 6)

This topic is 3311 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'm new here and new too on programming. I'm using SDL, and I need a technical help. If I were to detect, say TAB key, what command should follow this line? if (event.type=SDL_KEYDOWN) "event" is an object of SDL_Event here, and that line is in a loop already. That line detects any keys, but I want only TAB key that's detected. I looked over SDL_Keysym.h and found that TAB is given as integer 9. What should I do? Thx

Share this post


Link to post
Share on other sites
it should be == and not = as you've written in your example.

and you shall not use vs 6.0 anymore.. download the free vc++ .net 2008 instead, it's much better and close to 10 years newer (how old's 6.0 really.. :))

Share this post


Link to post
Share on other sites
Quote:
Original post by andrern2000
Hello, I'm new here and new too on programming.
I'm using SDL, and I need a technical help.

If I were to detect, say TAB key, what command should follow this line?
if (event.type=SDL_KEYDOWN)

"event" is an object of SDL_Event here, and that line is in a loop already. That line detects any keys, but I want only TAB key that's detected. I looked over SDL_Keysym.h and found that TAB is given as integer 9. What should I do?
Thx

No, 'SDLK_TAB' has the value 9, but that's not relevant. You want 'SDLK_TAB' - the constants are there to be more memorable than the numeric values.

ie. if (event.key. keysym.sym == SDLK_TAB)

Share this post


Link to post
Share on other sites
Quote:
Original post by andrern2000
@davepermen: Really? Can you give me the web url? Google returned various results but they're all confusing.

You can download Visual C++ Express here. Be aware that VC++ 6.0 isn't very standards compliant (which is the reason why you shouldn't use it), so don't be surprised if you have to fix some of your code to compile with a modern compiler.

Share this post


Link to post
Share on other sites

This topic is 3311 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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