Re: А вот моя ПП на MIDpascal
Примерно так:
program HelloWorld;
var a , b , c , d , m : integer;
var x , y , x2 , y2 : real;
var go , again : command;
var xx , yy , xx2 , yy2 , s : string;
begin
showform;
a := FormAddTextField('скорость x1', '', 2, TF_NUMERIC);
b := FormAddTextField('скорость y1', '', 2, TF_NUMERIC);
c := FormAddTextField('скорость x2', '', 2, TF_NUMERIC);
d := FormAddTextField('скорость y2', '', 2, TF_NUMERIC);
m := FormAddTextField('кадр/сек', '', 2, TF_NUMERIC);
go := CreateCommand('Go!',CM_OK,1);
repeat
ShowForm;
AddCommand(go);
repeat until GetClickedCommand = go;
s := FormGetText(m);
xx:= FormGetText(a);
yy:= FormGetText(b);
xx2:= FormGetText(c);
yy2:= FormGetText(d);
ShowCanvas;
setcolor(255,255,255);
Fillrect(0,0,getwidth,getheight);
setcolor(0,0,0);
x := StringToInteger(xx);
y := StringToInteger(yy);
x2 := StringToInteger(xx2);
y2 := StringToInteger(yy2);
repeat
if x > GetWidth then x := 0 ;
if y > GetHeight then y := 0 ;
if x2 > GetWidth then x2 := 0 ;
if y2 > GetHeight then y2 := 0 ;
if x < 0 then x := GetWidth ;
if y < 0 then y := GetHeight ;
if x2 < 0 then x2 := GetWidth ;
if y2 < 0 then y2 := GetHeight ;
x := x + StringToInteger(xx) ;
y := y + StringToInteger(yy) ;
x2 := x2 + StringToInteger(xx2) ;
y2 := y2 + StringToInteger(yy2) ;
SetColor(Trunc(x),Trunc(y),Trunc((x2 + y2) / 2));
DrawLine(Trunc(x),Trunc(y),Trunc(x2),Trunc(y2));
Repaint;
Delay(1000 / StringToInteger(s));
until GetKeyclicked = KE_KEY2;
until getkeyclicked=ke_key1
end.
|