I am trying to make a 2D game in Delphi XE5 / XE6 with FireMonkey, and I need to support multidimensionality - I need Windows and Android. At the moment, the game is only drawn with lines, circles, rectangles or other polygons, and I use Canvas ( TPaintBoxfull screen and OnPaint event for drawing). The problem is that I find the performance extremely low even when FireMonkey should use GPU acceleration. I did this performance test, which draws 1000 rectangles at random XY positions:
procedure Paint(Canvas: TCanvas);
var
I: Integer;
X, Y: Single;
begin
Canvas.BeginScene;
Canvas.Clear($ffffffff);
Canvas.Fill.Color := $ffff0000;
for I := 0 to 10000 do begin
X := Random(500);
Y := Random(400);
Canvas.FillRect(TRectF.Create(X, Y, X + 20, Y + 20), 0, 0, [], 1);
end;
Canvas.EndScene;
end;
I measured the approach to this function, and I get the following results:
Windows PC - Core2Duo 3.2GHz, GeForce 660Ti - pretty strong for such a simple task - it took 20 milliseconds
Android- - HTC One X (4 , 1 , Tegra 3/GPU) - 50-60 milisends ( , )
, 10 000, 100 000 ( GTX 660 Ti ) ( , 25 FPS, 40 miliseconds), FireMonkey, Delphi , , GPU . ( FillArc), 100 , , 10 000 . ( - char ). ? - , ? FireMonkey? ?
Canvas , Windows Android?