Keyboard input
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
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
Gamedev''s DirectInput articles
For movement keys use either WM_KEYDOWN/WM_KEYUP or DirectInput, for real input (all letters, capital, small) use WM_CHAR.
yeah im using Open GL
i think ill try the WM_CHAR windows message and see if that works.
thanx!
i think ill try the WM_CHAR windows message and see if that works.
thanx!
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!
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!
Yeah, but basically why reinvent the wheel. Plus he doesn''t need to take in account different keyboard layouts. Let windows do the work.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement