Skip to main content
GameDev.net gamedev.net
🔒 Locked

DirectInput Caps Lock Question

Started by The Frugal Gourmet Jul 8, 2003 at 2:20 PM 5 replies 3.3k views
Original Post
The Frugal Gourmet
The Frugal Gourmet
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'.
SGreth
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
"The difference between insanity and genius is measured only by success."~Bruce Feirstein
The Frugal Gourmet
The Frugal Gourmet
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'.
SGreth
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
"The difference between insanity and genius is measured only by success."~Bruce Feirstein
The Frugal Gourmet
The Frugal Gourmet
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'.
Mastaba
Mastaba
GetKeyboardState will return the current state of the Caps Lock, Num Lock, and Scroll Lock toggle keys.
The Frugal Gourmet
The Frugal Gourmet
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'.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.