Author Topic: GetKey Question  (Read 661 times)

Cosmo

  • Guest
GetKey Question
« on: 08. February 2014, 00:11:20 »
Hi Markus,

If getkey is not pressed, what is the return value ?
It isn't zero!

e.g
Code: [Select]
local press=0
repeat
   k=getkey()
   if k==32 and press==0 then
      color(255,255,255)
      drawtext (10,10,"HELLO")
      press=1
   end
   sync()
   if k==0 then  press=0; end
until k==27
closewindow()       

Cybermonkey

  • Administrator
  • Hero Member
  • *****
  • Posts: 573
    • View Profile
    • Home of EGSL
Re: GetKey Question
« Reply #1 on: 08. February 2014, 12:15:55 »
Maybe a random value? Don't know for sure, that can differ from OS to OS. You can get the value yourself with:
Code: [Select]
repeat
cls()
drawtext (0,0,getkey())
etc ...
Best regards,
Cybermonkey

Cosmo

  • Guest
Re: GetKey Question
« Reply #2 on: 08. February 2014, 14:04:24 »
Thanks Markus.