Answer the question
In order to leave comments, you need to log in
PascalABC - Simple keyboard drawing, questions?
Hello
, there is a task to make a simple drawing on the keys.
The question is this: when you press the buttons, there is a delay, i.e. - I press "right", "right", "right", "down", "down", and the picture goes "right", "right", "right", "right", "down". How to fix?
And another question - how to make a visible cursor that does not leave a trace in the form of a picture? Thanks in advance
uses graphabc,crt;
var x0,y0:integer;
c:char;
const WH = 600;
WW = 600;
begin
SetBrushColor(clBlack);
SetPenStyle(psSolid);
x0:=0;
y0:=0;
while (1=1) do
begin
c:=readkey;
case c of
#75: begin //left
x0:=x0+10;
rectangle(x0,y0,x0-10,y0+10);
end;
#77: begin //right
x0:=x0-10;
rectangle(x0,y0,x0+10,y0-10);
end;
#72: begin //up
y0:=y0-10;
rectangle(x0,y0,x0-10,y0+10);
end;
#80: begin //down
y0:=y0+10;
rectangle(x0,y0,x0+10,y0-10);
end;
end;
end;
end.
Answer the question
In order to leave comments, you need to log in
one)
when you press the buttons, there is a delay, i.e. - I press "right", "right", "right", "down", "down", and the picture goes "right", "right", "right", "right", "down". How to fix?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question