Press any key to continue... is a common requirement in early programming. Currently you need to write e.g.:
let k be inputString("Press Enter to continue")
which is awkward because:
The identifier k is never used
It has to be Enterbecause it is an input statement - any other key would need to be followed by Enter
So with this method you just write e.g.
print "Press any key to continue...`
call waitForAnyKey()
Additionally
2) rename the two getKeystroke... methods to getKey...
3) Change getKey and getKeyWithModifier from extension methods on GraphicsBase to freestanding system methods. (This means they will need to put the focus on the graphics element before looking at the buffer.
Press any key to continue...
is a common requirement in early programming. Currently you need to write e.g.:let k be inputString("Press Enter to continue")
which is awkward because:
k
is never usedEnter
because it is aninput
statement - any other key would need to be followed byEnter
So with this method you just write e.g.
Additionally
2) rename the two
getKeystroke...
methods togetKey...
3) Change
getKey
andgetKeyWithModifier
from extension methods onGraphicsBase
to freestanding system methods. (This means they will need to put the focus on thegraphics
element before looking at the buffer.4) Ensure that the following works:
i.e. the first one does not use up the key.