modifier keys in fullscreen
BlitzMax Forums/BlitzMax Beginners Area/modifier keys in fullscreen
| ||
How do i tell if a modifier key is being held down? i need to add command+q quitting functionality on the mac version of one of my games, only i can't work out how to get it to work. keydown(modifier_command) doesn't seem to do anything... Cheers Charlie |
| ||
KEY_LSYS and KEY_RSYS are the command keys on Mac. |
| ||
Graphics 800, 600 While Not AppTerminate() And Not KeyDown(KEY_ESCAPE) PollEvent() If(CurrentEvent.id = EVENT_KEYDOWN) Local e:TEvent = PeekEvent() If (CurrentEvent.mods & MODIFIER_COMMAND) Then ?MACOS Print "Command pressed" ?Win32 Print "Control pressed" ?Linux Print "Control pressed" ? EndIf If (CurrentEvent.mods & MODIFIER_SHIFT) Then Print "Shift pressed" EndIf If (CurrentEvent.mods & MODIFIER_ALT) Then Print "Alt pressed" EndIf EndIf Wend End Last edited 2011 |
| ||
Also AppTerminate() detects Command+Q when in windowed mode. |
| ||
Excellent, thanks chaps! Cheers Charlie |
| ||
Yeah, i noticed that. Also, If KeyDown(KEY_LSYS)And KeyHit(key_q) doesn't detect anything in windowed mode, presumably the os is catching that before blitz... Cheers Charlie |