Skip to content

Commit

Permalink
fps flicker fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qimiko committed May 18, 2024
1 parent c9c29f9 commit 053b0b3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,9 +769,14 @@ struct CustomCCDirector : geode::Modify<CustomCCDirector, cocos2d::CCDirector> {
CCDirector::showFPSLabel();

if (willUpdate) {
auto fpsLabel = fmt::format("FPS: {:.0f}\nInput: {}", this->m_fFrameRate, g_inputTps);
this->m_pFPSNode->setString(fpsLabel.c_str());
// the node is already visited and drawing fps twice creates some visual weirdness
// so only draw the next line and then set it to render the full thing on the next iteration
auto inputSection = fmt::format("\nInput: {}", g_inputTps);
this->m_pFPSNode->setString(inputSection.c_str());
this->m_pFPSNode->visit();

auto fpsLabel = fmt::format("FPS: {:.0f}{}", this->m_fFrameRate, inputSection);
this->m_pFPSNode->setString(fpsLabel.c_str());
}
}
};
Expand Down

0 comments on commit 053b0b3

Please sign in to comment.