Keyboard Trapper

new topic     » topic index » view thread      » older message » newer message

When programming a game in dos, (ex.exe) I found that when you call 
get_key() it will only return the last key pressed. That is all well and 
good for simple things.
    However, in say a driving game the user will want to hold the 
accelerator on whilst going round a corner (ie need two keys at once 
reported).
    The perfect solution would be a function that returned a string 
containing all keys being held down at that time, and something that would 
detect the shift, ctrl etc keys (maybe have special codes for them). I.e.

code
...
s = get_key_string() --s is now a sequence
if find(UP, s) then
accel()
elsif find(DOWN, s) then
  brake()
elsif find(LEFT, s) then
  turn(-1)
elsif find(RIGHT, s) then
  turn(1)
end if
...
/code

Now does any such function exist? or anything like it?
I also need a function like that for a virtual perkins brailler that I am 
working on.
=====================================================
.______<-------------------\__
/ _____<--------------------__|===
||_    <-------------------/
\__| Mr Trick

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu