|
|
print #main.gfx, "when characterInput [keypressed]" 'otherstuff wait 'check if shift key or up_arrow pressed [keypressed] key$ = left$(Inkey$,2): a$ = right$(key$,1) if len(key$) = 2 then if a$ = chr$(_VK_SHIFT) then keycount = 0 if a$ = chr$(_VK_UP) then goto [up_pressed] end if 'other stuff wait [up_pressed] calldll #user32,"GetKeyState", _VK_SHIFT as long, r as long if (r and 32768) then keycount = keycount + 1 'other stuff wait
|
open "Test" for graphics as #main print #main, "when characterInput [keypressed]" 'otherstuff wait 'check if shift + up_arrow pressed [keypressed] if Inkey$ = chr$(4) + chr$(38) then keycount = keycount + 1 print keycount end if wait
open "Test" for graphics as #main #main "when characterInput [keypressed]" #main "setfocus" 'otherstuff wait 'check if shift + up_arrow pressed [keypressed] if Inkey$ = chr$(4) + chr$(38) then keycount = keycount + 1 else if Inkey$ <> chr$(4)+chr$(16) then keycount = 0 end if end if print keycount wait
|
|
|
REM Keypress Key Release Demo By Sarmed Nafi' REM Keys and Shift + Key REM Keys F2 F3 Up Down Left Right Shift + Left Shift + Right REM Works with LBB better than LB timer 1, [loop] [loop] scan if (keyState(_VK_F2 )=1) AND (F2=0) then ' >> >> F2 F2=1 PRINT "F2 pressed" : PRINT else if (keyState(_VK_F2 )=0) AND (F2=1) then 'Reset F2=0 PRINT "F2 released" : PRINT else if (keyState(_VK_F3 )=1) AND (F3=0) then ' >> >> F3 F3=1 PRINT "F3 pressed" : PRINT else if (keyState(_VK_F3 )=0) AND (F3=1) then 'Reset F3=0 PRINT "F3 released" : PRINT else if (keyState(_VK_UP )=1) AND (up=0) AND (Fhndl=hDate) then ' >> >> UP up=1 PRINT "Up Arrow pressed" : PRINT else if (keyState(_VK_UP )=0) AND (up=1) then 'Reset up=0 PRINT "Up Arrow released" : PRINT else if (keyState(_VK_DOWN )=1) AND (dwn=0) AND (Fhndl=hDate) then ' >> >> Dwn dwn=1 PRINT "Down Arrow pressed" : PRINT else if (keyState(_VK_DOWN )=0) AND (dwn=1) then 'Reset dwn=0 PRINT "Down Arrow released" : PRINT else if (keyState(_VK_RIGHT )=1) AND (Rt=0) AND (keyState(_VK_SHIFT )=0) then ' >> >> Right Rt=1 PRINT "Right Arrow pressed" : PRINT else if (keyState(_VK_RIGHT )=0) AND (Rt=1) AND (keyState(_VK_SHIFT )=0) then 'Reset Rt=0 PRINT "Right Arrow released" : PRINT else if (keyState(_VK_RIGHT )=1) AND (shRt=0) AND (keyState(_VK_SHIFT )=1) then ' >> >> Shift + Right shRt=1 PRINT "Shift + Right Arrow pressed" : PRINT else if (keyState(_VK_RIGHT )=0) AND (shRt=1) AND (keyState(_VK_SHIFT )=1) then 'Reset shRt=0 PRINT "Shift + Right Arrow released" : PRINT else if (keyState(_VK_LEFT )=1) AND (lft=0) AND (keyState(_VK_SHIFT )=0) AND Grd=0 then ' >> >> Left lft=1 PRINT "Left Arrow pressed" : PRINT else if (keyState(_VK_LEFT )=0) AND (lft=1) AND (keyState(_VK_SHIFT )=0) then 'Reset lft=0 PRINT "Left Arrow released" : PRINT else if (keyState(_VK_LEFT )=1) AND (shlft=0) AND (keyState(_VK_SHIFT )=1) AND Grd=0 then ' >> >> Shift + Left shlft=1 PRINT "Shift + Left Arrow pressed" : PRINT else if (keyState(_VK_LEFT )=0) AND (shlft=1) AND (keyState(_VK_SHIFT )=1) then 'Reset shlft=0 PRINT "Shift + Left Arrow released" : PRINT end if end if end if end if end if end if end if end if end if end if end if end if end if end if end if end if WAIT '------ function keyState(keycode) calldll #user32, "GetAsyncKeyState", keycode AS Ulong, state AS short if state<0 then keyState = 1 else keyState = 0 end if end function '------
|
|