Question, Please Help

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

> I see that the get_key() function allows for the program to get the next
> key pressed without waiting. How do I assign that key's identity (a
> numeric value I'm guessing) to a variable so that I can manipulate it?
>
> while get_key() = -1 do
> bla bla bla
> end while
>
> But how do I take whatever key was pressed and use it?
>
> -Phil

Try the following code:
integer key
key = get_key()
while key = -1 do
    key = get_key()
end while
printf(1, "The code of the key pressed was: %d", key)

I hope I didn't make any mistakes since I haven't tested it!

Bye,

Martin Schut

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

Search



Quick Links

User menu

Not signed in.

Misc Menu