• Advertisement

Archived

This topic is now archived and is closed to further replies.

Keyboard input

This topic is 5029 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

hi im a newbie to this forum and im wondering if someone can help me im creating a 2D RPG egnine for my uni deissertation and i need to get input from the keyboard what i do now is in the WinProc message func. in the Key_up switch statement i use wParam which holds the Ascii code of the key pressed i then pass this to a Asicc to char function wich converts it to the right char my prolem is this only work on CAPITAL letters even if caps lock is on or off, and other keys like '' : ; ? / dont work if anyone knows of a better way to do this reply please Thanxs

Share this post


Link to post
Share on other sites
Advertisement
Well, if this is part of a 2D RPG engine, what graphics API are you using? If you happen to already be using DirectX for graphics anyway, then I''d suggest DirectInput (the input part of DirectX). If your using something other than DirectX for graphics, it may also have its own input handling (I''m fairly sure SDL does for example, although I''ve never tried it myself) you could learn and implement, but if not, I''m sure someone can help you to do it another way.

Gamedev''s DirectInput articles

Share this post


Link to post
Share on other sites
yeah im using Open GL
i think ill try the WM_CHAR windows message and see if that works.
thanx!

Share this post


Link to post
Share on other sites
Hmm... I wonder if he''s working on a similar project to me...
Incidentally, you can use GetKeyState(VK_CAPITAL) to check for capslock or use GetKeyState(VK_SHIFT) to check for shift. This would allow you to read the input and check whether it should be uppercase or lowercase.

Worship the holy trinity that is Blitz, Babes and Beers!

Share this post


Link to post
Share on other sites
thankz guys i works perfectly
just using WM_CHAR in the messge loop of my WinMain func
wicked!!
gonna post another Question in the OpenGL section
maybe u guys can help me there?

Share this post


Link to post
Share on other sites

  • Advertisement