Skip to content

Commit

Permalink
Close #20157: Hide FPS Counter if top toolbar is hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry-Hopkinson committed May 4, 2024
1 parent cd52866 commit bbc5a10
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions distribution/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Improved: [#21855] Add a separator between “Load Game” and “Save Game”, to avoid accidental overwriting.
- Change: [#21715] [Plugin] Remove access to the internal `owner` property. Note: `ownership` is still accessible.
- Change: [#21855] Cheats menu dropdown no longer requires dragging.
- Change: [#21866] Hide the FPS Counter when the top toolbar/widgets have been toggled off.
- Fix: [#866] Boat Hire boats get stuck entering track (original bug).
- Fix: [#10701] No reason specified when placing door over unsuitable track.
- Fix: [#18723, #21870] Attempting to demolish a flat ride in pause mode allows you to place multiple copies.
Expand Down
14 changes: 14 additions & 0 deletions src/openrct2/paint/Painter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,22 @@ void Painter::PaintReplayNotice(DrawPixelInfo& dpi, const char* text)
GfxSetDirtyBlocks({ screenCoords, screenCoords + ScreenCoordsXY{ stringWidth, 16 } });
}

static bool ShouldShowFPS()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO && !TitleShouldHideVersionInfo())
return true;

if (!WindowFindByClass(WindowClass::TopToolbar))
return false;

return true;
}

void Painter::PaintFPS(DrawPixelInfo& dpi)
{
if (!ShouldShowFPS())
return;

ScreenCoordsXY screenCoords(_uiContext->GetWidth() / 2, 2);

MeasureFPS();
Expand Down

0 comments on commit bbc5a10

Please sign in to comment.