esc botton and save game

can someone tell me how to do an esc ej. if the esc botten is pressed then exit i know when puting esc on your program will exit the program! also can anyone tell me how you can save such as wile in a game you press F5 and it saves, i know someone asked this i think cant remmeber tryed lookin coulednt find!

Comments

  • : can someone tell me how to do an esc ej. if the esc botten is pressed then exit i know when puting esc on your program will exit the program! also can anyone tell me how you can save such as wile in a game you press F5 and it saves, i know someone asked this i think cant remmeber tryed lookin coulednt find!
    :
    Both keys can be read using the ReadKey() function. The escape key has a value of #27, while the function keys consist of two chars: #0 and another. Here is a small program, which allows you to read a single keypress and return its value:
    [code]
    var
    ch: char;
    begin
    ch := readkey;
    if ch = #0 then begin
    ch := readkey;
    writeln('Extended key: ', ord(ch));
    end else
    writeln('Simple key: ', ord(ch));
    end;
    [/code]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion