Jump to content
  • Advertisement
Sign in to follow this  
andrern2000

Help on SDL Input (Visual C++ 6)

This topic is 3674 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
Advertisement
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
Thanks Kylotan.

SDLK_TAB.
I've got that one working now. :)

@davepermen: Really? Can you give me the web url? Google returned various results but they're all confusing.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!