problemanimation with QueryPerformanceCounter(please help.)

Please discuss general Delphi programming topics here.

problemanimation with QueryPerformanceCounter(please help.)

Postby willy » April 19th, 2005, 10:38 am

//why when i call procedure tampilkanGunduLoncat the picture move //correctly but when i call it more then one such below
//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;
[/b]
willy
Member
Member
 
Posts: 3
Joined: March 19th, 2005, 12:55 pm

just ignore the my previos post

Postby willy » April 20th, 2005, 2:07 am

sorry i just make little mistaka in other part of the program so it works now.
willy
Member
Member
 
Posts: 3
Joined: March 19th, 2005, 12:55 pm


Return to Delphi Programming

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

cron