//after called for first time i showmessage(text) it just work buat before
//the second called the picture still move therefore in the next calling it //move incorrectly. Plese help me what wrong with this?i dont really understand how to use queryPerformanceCounter
- Code: Select all
// i have global saved: array of TPoint, i move picture based on this array
procedure TForm1.tampilkanGunduLoncat(gunduA:TImage;mode:integer);
var
i,jlhPos:integer;
drawtime:integer;
startcount,stopcount:int64;
begin
gunduLoncat(gunduA,mode);{in this function i assign saved}
if(mode<3) then jlhPos:=17 else jlhPos:=28;
for i:= 1 to jlhPos do
begin
gunduA.left:=saved[i].x;
gunduA.top:=saved[i].y;
queryperformanceCounter(startcount);
application.processmessages;
queryPerformanceCounter(stopcount);
drawtime:=(stopcount-startcount) div freq;
sleep(max(0,sleepms-drawtime));
end;
queryPerformanceCounter(stopcount);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
temp:Timage;
begin
gundu.Top:=160;
gundu.Left:=136;
tampilkanGunduLoncat(gundu,1);
tampilkanGunduLoncat(temp,2);
tampilkanGunduLoncat(gundu,3);
tampilkanGunduLoncat(gundu,4);
end;