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).

6 Years
Discussion Span
Last Post by Fbody

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.

Edited by Fbody: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.