• Advertisement

Archived

This topic is now archived and is closed to further replies.

Arrow Keys+scan code= !@$%

This topic is 5935 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Gander at this first: #define RtArrw 0x4d #define LftArrw 0x4b #define UpArrw 0x48 #define DnArrw 0x50 ... //Movement switch(getch()){ case LftArrw:{...} case UpArrw:{...} case RtArrw:{...} case DnArrw:{...} }; Now when I do this, the arrow keys dont work, but I J L & M do. I''d really really really like to know whats going on, and how to get them to work for my RPG.

Share this post


Link to post
Share on other sites
Advertisement
I remember learning this in Pascal at college!
Like the above post says you have to read the keypress twice because arrow key, function key etc use extended scan code...the first code will just be a zero so you have to call getch() straight after the first one to actually get the scan code.

In Pascal (like you ever wanted to know!) it''s:

var ch : char;

begin
ch:=readkey;
ch:=readkey;

case ch of...
...
end;

end;

I just felt like putting that in!

Steve

---------------------
Light of my life
Fire of my loins.
My sin, my soul
LOLITA
---------------------

Share this post


Link to post
Share on other sites

  • Advertisement