Skip to content

Commit

Permalink
Quick adjustments to build and work with latest CGE
Browse files Browse the repository at this point in the history
  • Loading branch information
michaliskambi committed Jun 15, 2024
1 parent 53c1e92 commit ef76d19
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
10 changes: 5 additions & 5 deletions code/drawinggame.pas
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ procedure DrawGame(HighlightOneBF: boolean; const HighlightOneBFPos: TVector2Int

procedure DrawText(x, y: Single; const s: string; const Color: TCastleColor);
begin
UIFontSmall.Print(X, Y, Color, s);
FallbackFont.Print(X, Y, Color, s);
end;

procedure DrawTextRPad(x, y: Single; const s: string; const Color: TCastleColor);
begin
DrawText(x-UIFontSmall.TextWidth(s), y, s, Color);
DrawText(x-FallbackFont.TextWidth(s), y, s, Color);
end;

procedure DrawPlayerName(const s: string; MiddleX: Integer);
Expand All @@ -158,8 +158,8 @@ procedure DrawGame(HighlightOneBF: boolean; const HighlightOneBFPos: TVector2Int
procedure DrawButton(y: Integer; const s: string);
begin
ButtonImage.Draw(ButtonsAndFramesX, y);
UIFontSmall.Print(ButtonsAndFramesX + (ImgButtonWidth -
UIFontSmall.TextWidth(s)) / 2, y+7, Black, s);
FallbackFont.Print(ButtonsAndFramesX + (ImgButtonWidth -
FallbackFont.TextWidth(s)) / 2, y+7, Black, s);
ButtonsAndFramesX += ImgButtonWidth;
end;

Expand All @@ -170,7 +170,7 @@ procedure DrawGame(HighlightOneBF: boolean; const HighlightOneBFPos: TVector2Int
x0 := ButtonsAndFramesX;
FrameLImage.Draw(ButtonsAndFramesX, y);
ButtonsAndFramesX += ImgFrameLWidth;
for i := 0 to Round(UIFontSmall.TextWidth(s) + CaptionHorizMargin*2) do
for i := 0 to Round(FallbackFont.TextWidth(s) + CaptionHorizMargin*2) do
begin
FrameMImage.Draw(ButtonsAndFramesX, y);
Inc(ButtonsAndFramesX);
Expand Down
4 changes: 2 additions & 2 deletions code/highscoresunit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ procedure DrawHighscores;

procedure PrintRight(const x, y: Integer; const s: string);
begin
UIFontSmall.Print(x - UIFontSmall.TextWidth(s), y, Color, s);
FallbackFont.Print(x - FallbackFont.TextWidth(s), y, Color, s);
end;

var
Expand All @@ -167,7 +167,7 @@ procedure DrawHighscores;
if i < Highscores.Count then
begin
PrintRight(HighscrScoreX, RowY, IntToStr(Highscores.L[i].Score));
UIFontSmall.Print(HighscrNameX, RowY, Color, Highscores.L[i].PlayerName);
FallbackFont.Print(HighscrNameX, RowY, Color, Highscores.L[i].PlayerName);
end;
end;
end;
Expand Down
2 changes: 1 addition & 1 deletion code/kambi_lines.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ procedure OptionProc(OptionNum: Integer; HasArgument: boolean;
if Parameters.High > 0 then
raise EInvalidParams.Create('Invalid parameter "'+Parameters[1]+'"');

{ open glw (everything else about initing glw is done in LinesWindow) }
{ open Window (everything else about initializing Window is done in LinesWindow) }
Window.Open;

try
Expand Down
3 changes: 3 additions & 0 deletions code/lineswindow.pas
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ procedure OptionProc(ParamNum: Integer; HasArgument: boolean;
procedure Open;
begin
Window := TCastleWindowBase.Create(nil);

Application.MainWindow := Window;

// this background would cover our LinesMove rendering
Window.Container.BackgroundEnable := false;

Expand Down

0 comments on commit ef76d19

Please sign in to comment.