Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
reading simultaneous keys pressed
#2
Use the multikeys function in the library which returns non zero (True) if ANY of the given keys is pressed.
Code:
#include <keys.bas>

DO
IF MultiKeys(KEYSPACE | KEYENTER) THEN
    PRINT "Space or Enter pressed"
END IF
LOOP : REM Repeat forever since no condition specified
Predefined key constants are in the KEY.BAS file. Read there.

Notice you can use | as in C or bOR to test for multiple values simultaneously.
So the above test checks for ENTER or SPACE pressed.
The function is much faster than INKEY$ and can check multiple keys pressing (limited by the ZX hardware)
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)