That is close to how nxPascal game class handles it No worries, it's perfect for making smooth 60 fps animations, while keeping CPU and GPU use near 0%.
Actually i can show you. It supports frameskipping too for rendering (could make it optional though):
Code:
t:=nxEngine.GetTick;
if t<nextTick then begin
Application.ProcessMessages; Sleep(1);
end else begin
FrameSkips:=-1;
repeat
inc(FrameSkips);
nextTick:=nextTick+FrameInterval;
GameLoop;
until (nextTick>t) or (FrameSkips>=10) or FNoFrameSkipping;
Draw;
end;
Bookmarks