Ok I'm working on a DirectX project for an augmentation class and have a quick question.

I'm needing to recognize a key being pressed (for example "s) which triggers action (x).

I then need to press "s" again to then revert back to the original state.

Currently I have an entry in the switch (msg) to trigger action "x" when the spacebar is pressed. But now I need it to reset it back to normal when I press the spacebar again (currently I have it set to the shift key).

I don't know DX, so I can't help with that. I'm sure AD will be along soon with some sort of insight.

I know you'll have to detect and respond to OnKeyPress, OnKeyUp, or OnKeyDown type events (actual names are probably different, but you get the idea) and write the appropriate functions. You will have to detect which key was pressed using akey code then react based on its value. I don't know if the linked chart will help you or not. The chart is for Delphi, not C++. More searching should turn up something though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.