I wanted a function that would combine Waitkey and Waitmouse.
After looking at the source code, I put this together and to my complete astonishment it seems to work.
Is this a good place to post this?
What about making it a regular part of BlitzMax?
' Function that waits for a key press or mouse click
' Mouse keys are returned as 255 + mouse key code
Function WaitKey_Or_Mouse()
Local n%
FlushKeys ; FlushMouse
Repeat
WaitSystem
For n=1 To 255
If KeyHit(n) Return n
Next
For n=1 To 3
If MouseHit(n) Return n + 255
Next
Forever
End Function
After looking at the source code, I put this together and to my complete astonishment it seems to work.
Is this a good place to post this?
What about making it a regular part of BlitzMax?
' Function that waits for a key press or mouse click
' Mouse keys are returned as 255 + mouse key code
Function WaitKey_Or_Mouse()
Local n%
FlushKeys ; FlushMouse
Repeat
WaitSystem
For n=1 To 255
If KeyHit(n) Return n
Next
For n=1 To 3
If MouseHit(n) Return n + 255
Next
Forever
End Function