Changeset 65


Ignore:
Timestamp:
Nov 26, 2020, 7:19:50 PM (3 years ago)
Author:
chronos
Message:
  • Fixed: Correct vertical position of game over text.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UEngine.pas

    r64 r65  
    300300    procedure DrawClock(Canvas: TCanvas);
    301301    procedure DrawTrains(Canvas: TCanvas);
     302    procedure DrawGameOver(Canvas: TCanvas);
    302303    procedure ComputeShapeDistance;
    303304    procedure ComputeShapeDistanceStation(Station: TMapStation;
     
    21292130end;
    21302131
     2132procedure TEngine.DrawGameOver(Canvas: TCanvas);
     2133var
     2134  Y: Integer;
     2135  Text: string;
     2136begin
     2137  Canvas.Font.Color := Colors.Text;
     2138  with Canvas do begin
     2139    Y := 100;
     2140    Font.Size := 40;
     2141    TextOut((Width - TextWidth(SGameOver)) div 2, Y, SGameOver);
     2142
     2143    Y := Y + Round(TextHeight(SGameOver) * 1.1);
     2144    Font.Size := 14;
     2145    TextOut((Width - TextWidth(SGameOverReason)) div 2, Y, SGameOverReason);
     2146
     2147    Y := Y + Round(TextHeight(SGameOverReason) * 1.1);
     2148    Text := Format(SGameOverStatistic, [ServedPassengerCount, Trunc(Time)]);
     2149    TextOut((Width - TextWidth(Text)) div 2, Y, Text);
     2150  end;
     2151end;
     2152
    21312153procedure TEngine.Tick;
    21322154var
     
    27632785  if State = gsGameOver then
    27642786  begin
    2765     TargetCanvas.Font.Size := 40;
    2766     TargetCanvas.Font.Color := Colors.Text;
    2767     TargetCanvas.TextOut((TargetCanvas.Width - TargetCanvas.TextWidth(SGameOver)) div 2, 100, SGameOver);
    2768     TargetCanvas.Font.Size := 14;
    2769     TargetCanvas.TextOut((TargetCanvas.Width - TargetCanvas.TextWidth(SGameOverReason)) div 2, 160, SGameOverReason);
    2770     Text := Format(SGameOverStatistic, [ServedPassengerCount, Trunc(Time)]);
    2771     TargetCanvas.TextOut((TargetCanvas.Width - TargetCanvas.TextWidth(Text)) div 2, 180, Text);
     2787    DrawGameOver(TargetCanvas);
    27722788  end else
    27732789  if State = gsMenu then begin
Note: See TracChangeset for help on using the changeset viewer.