Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
reading simultaneous keys pressed
#5
btw, i started trying these snippets: (and found how to get keyboard values directly from 'in' command)

this works, but i'm not very fan of this complexity of values, which makes me struggling when using similar stuff with games with redefinable keys (like those from Dinamic and so on)
Code:
10 print at 0,0;" "
20 print (255-(in 65278)) band 31;"   "
21 print (255-(in 65022)) band 31;"   "
22 print (255-(in 64510)) band 31;"   "
23 print (255-(in 63486)) band 31;"   "
24 print (255-(in 61438)) band 31;"   "
25 print (255-(in 57342)) band 31;"   "
26 print (255-(in 49150)) band 31;"   "
27 print (255-(in 32766)) band 31;"   "
30 goto 10

i wanted to do this (but the code doesn't works...)
Code:
function getkey(kv as ubyte) as ubyte
  dim v1,v2,v4 as ubyte
  dim v3 as uinteger
  v1=kv band 31
  v2=(kv band 224)/32
  v3=254+256*(255-2^v2)
  v4=((in v3) band v1)=0
  return v4
  end function
main:
print at 0,0;" "
print getkey(3)
goto main

and when i tried to figure out what were going wrong, this code hangs (like 'usr 0')
Code:
dim v3 as uinteger
dim i,v5 as ubyte
main:
for i=0 to 7
  print at 0,i;i;"-";
  v3=254+256*(255-2^i):print v3;" ";
  v5=31-((in v3) band 31):print v5;" ";
  next i
goto main
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)