Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Arrow Keys in FB?
#1
Say, why doesn't the following commands seem to work in FB??

Code:
press$ = INKEY$
IF press$ = CHR$(0) + "H" THEN
IF press$ = CHR$(0) + "P" THEN
..ect..

I've even tried using the ASCII for H, P, M, & K,.. but I always get a error or doesn't work.. Any help?? :???:
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply
#2
use chr$(255), not chr$(0). i think this is because chr$(0) is used as a end character for strings in linux.
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Reply
#3
It's because the NULL term char is used with C (not Linux), and the FB runtime library mostly just calls C runtime routines for string manipulation.
Reply
#4
Right,. I'll try that. :wink: , Thanks...
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply
#5
Yep, that's all it needed, thanks. Big Grin :wink:
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply
#6
if you use multikey in you code the following code is your arrow keys as copied from gfxlib

Code:
IF MULTIKEY(&h4B) AND x > 0 THEN x = x - 1
    IF MULTIKEY(&h4D) AND x < 639 THEN x = x + 1
    IF MULTIKEY(&h48) AND y > 0 THEN y = y - 1
    IF MULTIKEY(&h50) AND y < 479 THEN y = y + 1

you can obviously change the end result to what you need but this is what your looking for
o live is to die, to die is to expel, to expel is to exist is to live without knowing to be
Reply
#7
Hay, thats cool,.. does it do as it seems, more than 1 keypress at a time is regestered? so no jamming? Smile
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply
#8
nope no jamming the codes look specifically for the arrow keys only but on multiple keypress the routine so to speak is quicker than the key press so it can register and translate each code before becoming "jammed"
o live is to die, to die is to expel, to expel is to exist is to live without knowing to be
Reply
#9
Big Grin , Thats sweet!!, I'll have to remamber that next time!! :wink:
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)