almost
2011-07-15 19:00:47
I need to know how to figure out when a key is pressed and what key it was.
This checks all the main keys very quickly but I end up with an integer.
For example, pressing "a" returns 97 and pressing "b" returns 98.
I need it to return a string.
If I'm not mistaken there is a function for turning a key code into a string?
I need for it to return the string "a" when the a key is pressed.
I want to avoid doing something like this though
What I need is
for i:= 0 to 300 do
if (IsKeyDown(Chr(i))) then
WriteLn(IntToStr(i));This checks all the main keys very quickly but I end up with an integer.
For example, pressing "a" returns 97 and pressing "b" returns 98.
I need it to return a string.
If I'm not mistaken there is a function for turning a key code into a string?
I need for it to return the string "a" when the a key is pressed.
I want to avoid doing something like this though
case i of
97: Result:= 'a';
98: Result:= 'b';I would have to write a result for every key possible and it's not very efficient.What I need is
for i:= 0 to 300 do
if (IsKeyDown(Chr(i))) then
begin
Result:= ChrToString(i);
Exit;
end;