Only caps?

Started by
3 comments, last by skyfire360 23 years, 4 months ago
I''ve written a function to return a key if it is pressed: [source] int ReturnKey() { for (int i = 0; i < 127; i++) { if (!keys && pressedKeys) { pressedKeys = false; } } for (int j = 0; j < 127; j++) { if (keys[j] && !pressedKeys[j]) { pressedKeys[j] = true; return j; } } return -1; } [\source] The one problem is, it ALWAYS return uppercase values. Is there any easier way to get user input from the keyboard? I am using it in a console, and am trying to get user input. Any suggestions? Thanks -+=SkyFire360 </i>
I do real things with imaginary numbers
Advertisement
i guess you can use "getchar" or "getc". or check the status of the "shift" key if your are using DOS.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
Nope, this is using the NEHE base code. All I want is when someone hits the ''g'' key or the ''k'' key or any other key, I want the console to say "gk" or whatever. It is coming out "GK". Are there any good input routines?

-S`kyFire360
I do real things with imaginary numbers
If in the ''WndProc'' function you add ''WM_CHAR'' and do your keyboard capture there, it will be case sensitive.

Take Care,

Nyko
I think you can use VK_SHIFT to check if the shift key is pressed. It won''t work for Caps Lock, though.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.

This topic is closed to new replies.

Advertisement