procedure TForm1.FormCreate(Sender: TObject);
begin
if FTimerService = nil then
if not TPlatformServices.Current.SupportsPlatformService(IFMXTimerService, FTimerService) then
raise EUnsupportedPlatformService.Create('IFMXTimerService');
end;
procedure TForm1.BeginScene;
begin
if FTimerService <> nil then
FBeginTime := FTimerService.GetTick;
end;
procedure TForm1.EndScene;
begin
if FTimerService <> nil then
begin
FEndTime := FTimerService.GetTick;
FRenderTime := FRenderTime + (FEndTime - FBeginTime);
FFrameCount := FFrameCount + 1;
if (FFrameCount > 10) and (FRenderTime > 0) then
begin
FFPS := FFrameCount / FRenderTime;
FRenderTime := 0;
FFrameCount := 0;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
TThread.CreateAnonymousThread(
procedure
var i: Integer;
begin
try
for i:=0 to 100 do
begin
BeginScene;
TThread.Synchronize(TThread.CurrentThread,
procedure
begin