Cursors and getkey

BlitzPlus Forums/BlitzPlus Programming/Cursors and getkey

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Why not use a bitmask method? Small Example below.
[Code]Const CLeft=%1
Const CRight=%10
Const CUp=%100
Const CDown=%1000

Scw=ClientWidth(Desktop())
Sch=ClientHeight(Desktop())
Win=CreateWindow("Testing",(Scw-220)/2,(Sch-70)/2,220,70,Desktop(),25)
CreateLabel "Cursor Key Test, Hold a cursor key down...",4,8,ClientWidth(Win),16,Win

Repeat
Ev=WaitEvent()
Repeat
Txt$=""
If CursorsDown() And CLeft Txt$=" Left "
If CursorsDown() And CRight Txt$=" Right "
If CursorsDown() And CUp Txt$=Txt$+"Up"
If CursorsDown() And CDown Txt$=Txt$+"Down"
If HTxt$<>Txt$ SetStatusText Win,Txt
HTxt$=Txt$
Until Not CursorsDown()
SetStatusText Win,""
FlushEvents
Until KeyHit(1) Or Ev=$803

Function CursorsDown%()

Local Mask%=0
If KeyDown(203)
Mask=CLeft
ElseIf KeyDown(205)
Mask=CRight
EndIf
If KeyDown(200)
Mask=Mask Or CUp
ElseIf KeyDown(208)
Mask%=Mask% Or CDown
EndIf
Return Mask%

End Function[/code]