![]() |
Capslock | ![]() |
Mars_999
![]() |
![]() |
Hello,
Is there anyway to query if the Capslock key id on? Thanks, Dave _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||
|
![]() |
Capslock | ![]() |
David Olofson
Guest
![]() |
![]() |
On Saturday 03 April 2010, at 21.12.06, "Mars_999"
wrote:
Check for KMOD_CAPS in the mod field of the SDL_keysym? There is also a keycode for the actual key: SDLK_CAPSLOCK. I suppose tracking the state of that should work, but I'm not sure if you get the state of the *key* or the keyboard/system capslock state... I would assume and hope for the former. :-) -- //David Olofson - Developer, Artist, Open Source Advocate .--- Games, examples, libraries, scripting, sound, music, graphics ---. | http://olofson.net http://kobodeluxe.com http://audiality.org | | http://eel.olofson.net http://zeespace.net http://reologica.se | '---------------------------------------------------------------------' _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||
|
![]() |
Capslock | ![]() |
Mars_999
![]() |
![]() |
Yeah I am worried that if the user has the Caps lock on and he hits it
that will flip my bool value of the status of the caps lock key. I would rather just test to see if the key is in fact activated.... I looked at SDL_GetModState() and checked the return value. I am getting 4096 and 12288? Isn't Caps lock = 8912 Thanks On 4/3/2010 2:42 PM, David Olofson wrote:
SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||||
|
![]() |
Capslock | ![]() |
Mars_999
![]() |
![]() |
Nevermind I got it!
a bit of Bit math ;) int temp = SDL_GetModState(); temp = temp & KMOD_CAPS; if(temp == KMOD_CAPS) std::cout << "CAP ON"; Thanks On 4/3/2010 3:51 PM, Mars_999 wrote:
SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||||||
|
![]() |
Capslock | ![]() |
David Olofson
Guest
![]() |
![]() |
On Saturday 03 April 2010, at 22.51.45, "Mars_999"
wrote:
You shouldn't just flip the bool, but rather check what the event says about the new state. However, there is still a risk of losing some events and getting ouf of sync when you're in a windowed environment. I'm not sure if SDL_WM_GrabInput() can *totally* prevent that on all platforms either...
That would be 2^13 = 8192, and 12280 = 8192 + 4096, that is, bits 12 and 13 set. :-) -- //David Olofson - Developer, Artist, Open Source Advocate .--- Games, examples, libraries, scripting, sound, music, graphics ---. | http://olofson.net http://kobodeluxe.com http://audiality.org | | http://eel.olofson.net http://zeespace.net http://reologica.se | '---------------------------------------------------------------------' _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||||
|