Advertisement

Telling wether Shift is down in Messages

Started by June 10, 2000 03:41 PM
6 comments, last by Esap1 24 years, 6 months ago
Im decided just to use Windows messages for the Input in my console, and Im using Direct Input for the movement of the player and such. I have a Question though. How can I tell wether shift is being held down. all I get in wParam is VK_A, VK_B, VK_C, so it all comes out capital, what tells me if shift is down, and What about if it is a Letter, or something else(So I dont print up on the console, the number for the Arrows or something like that). Thanks a lot everyone, my Engines really comming along
I don''t know much about C++ (I''m sick of typing that) but in VB there is a shift parameter. It is seperate from the KeyCode parameter.

Just wondering. Could I see your engine? I saw it in its early stages and it still said "triwin" or something. In other words, it was from a dx sample. That''s not the point though.

------------------------
Captured Reality.
Advertisement
GetKeyState(VK_SHIFT) will have the high bit set if shift was down. GetKeyState(VK_CAPITAL) will have the lowest bit set if Caps Lock was on.


Edited by - Armitage on June 10, 2000 5:07:08 PM
A polar bear is a rectangular bear after a coordinate transform.
thanks Armitage,

nes8bit: My old DirectX "Engine" was "derived" from the DX example trivwin(I think Trivial Windows App), and I never got around to changin the Windows code. The sad thing is have for now stopped work on that and I amd working on my OpenGl App. Which amazingly, has used about half of the same code(Of course not all the Direct3D Init Crap), But its using almost the exact same DirectInput Class and others as in my DirectX program. I will be letting a demo of my OpenGL Engine soon, It should have various Commands that can be accesed through the WONDERFUL Console I wrote,(it took me over 3 weeks), and MAYBE BSP support.

Could Someone tell me straight out the Bennifet of BSP trees. No Z-buffer right(well for the BSP''ed part). Big deal. How is that a big performance Jump with todays 3D Acclerators. later, Yall
Damn board messed my spaces
Well is the far left bit the High Bit, and far Right bit the Low Bit?


And If I wanted the high bit could I go:
byte>>7;
and the low bit
byte = byte<7;
byte>7;

Any easier ways?

Edited by - Esap1 on June 10, 2000 6:56:45 PM

Try GetKeyState(VK_SHIFT) & 0x8000 (will yield "one" if on)
and GetKeyState(VK_CAPITAL) & 1 (ditto)

A polar bear is a rectangular bear after a coordinate transform.
Advertisement
I believe you should use

GetAsyncKeyState instead of GetKeyState..

..
GetKeyState should tell you the status of the shift-key at the time the keyboard message was sent (VK_A etc). GetAsyncKeyState gives you a real-time poll, and the shift key could have been released before you check it.
A polar bear is a rectangular bear after a coordinate transform.

This topic is closed to new replies.

Advertisement