DirectInput Caps Lock Question

Started by
5 comments, last by The Frugal Gourmet 20 years, 9 months ago
Is there a way to check the "state" of Caps Lock (active, lit vs. inactive, unlit). Or, does DirectInput merely check whether it is currently pressed or not?
Co-creator of Star Bandits -- a graphical Science Fiction multiplayer online game, in the style of "Trade Wars'.
Advertisement
From my travels I found it easiest just to keep track if caps lock is "active" or not. It shouldn''t be a problem if you''re using buffered input. If you''re not...let''s just hope you don''t miss a key-press

~Rob
"The difference between insanity and genius is measured only by success."~Bruce Feirstein
quote:Original post by SGreth
From my travels I found it easiest just to keep track if caps lock is "active" or not. It shouldn''t be a problem if you''re using buffered input. If you''re not...let''s just hope you don''t miss a key-press

~Rob



And how do you determine if it is "active"? As far as I know, I can only check for presses.

Co-creator of Star Bandits -- a graphical Science Fiction multiplayer online game, in the style of "Trade Wars'.
For now, my code just assumes that the caps lock is off and then each time it is hit I toggle a boolean in my code (indicating if capslock is on or off). I thought (once upon a time...) that I saw an example in the DX SDK where they actually toggle''d the state of capslock in code. I''m not sure where to find that example though...

~Rob
"The difference between insanity and genius is measured only by success."~Bruce Feirstein
quote:Original post by SGreth
For now, my code just assumes that the caps lock is off and then each time it is hit I toggle a boolean in my code (indicating if capslock is on or off). I thought (once upon a time...) that I saw an example in the DX SDK where they actually toggle''d the state of capslock in code. I''m not sure where to find that example though...

~Rob


Ok, thanks. That''s what I was doing. Just wondering if there was a better way.

My big fear is that someone is going to enter the game with Caps Lock on and then experience the bizarre backwards state of Caps Lock working in reverse.
Co-creator of Star Bandits -- a graphical Science Fiction multiplayer online game, in the style of "Trade Wars'.
GetKeyboardState will return the current state of the Caps Lock, Num Lock, and Scroll Lock toggle keys.
.
quote:Original post by Mastaba
GetKeyboardState will return the current state of the Caps Lock, Num Lock, and Scroll Lock toggle keys.


As "active" or "inactive"? I was under the impression it returns whether they are pressed or not.


Co-creator of Star Bandits -- a graphical Science Fiction multiplayer online game, in the style of "Trade Wars'.

This topic is closed to new replies.

Advertisement