Also du brauchst Zeitabhängige Bewegungen zu implementieren. Da brauchst du nicht jede 1/30 sekunde eine Prozedur aufzurufen, sondern kannst auch 320 mal pro Sekunde diese "Draw" Prozedure aufrufen. Das Hacken ist dass du die Koordinaten der zu bewegenden Objekt Zeitabhängig machst.
Beispiel :
v = s / t;
Delphi-Quellcode:
//---
var FPS: int64 = 0;
framesPerSecond : int64 = 0; // This will store our fps
frameTime : int64 = 0 ; // This stores the last frame's time
Freq : int64;
lastTime : int64 = 0; // This will hold the time from the last frame
//---
procedure Tform1.create(sender:tobject);
begin
QueryPerformanceFrequency( Freq );
end;
///-----
function speed() : double;
var currentTime : int64;
begin
// Get the current time in seconds
QueryPerformanceCounter( currentTime );
// Here we store the elapsed time between the current and last frame,
g_FrameInterval := currentTime - frameTime;
frameTime := currentTime;
// Increase the frame counter
inc(framesPerSecond);
result := g_FrameInterval / Freq ;
// Now we want to subtract the current time by the last time that was stored
// to see if the time elapsed has been over a second, which means we found our FPS.
if ( currentTime - lastTime > Freq ) then
begin
// Here we set the lastTime to the currentTime
lastTime := currentTime;
FPS := framesPerSecond ;
// Reset the frames per second
framesPerSecond := 0;
end;
end;