mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Changed Window to cache the framerate string as a TextCache instead of regenerate it every frame which was significantly impacting the framerate because I am dumb.
This commit is contained in:
parent
1b66150fe7
commit
9955261a1e
|
@ -156,7 +156,7 @@ void Window::update(int deltaTime)
|
||||||
float vramUsageMb = (TextureResource::getTotalMemUsage() + Font::getTotalMemUsage()) / 1000.0f / 1000.0f;
|
float vramUsageMb = (TextureResource::getTotalMemUsage() + Font::getTotalMemUsage()) / 1000.0f / 1000.0f;
|
||||||
ss << "\nVRAM: " << vramUsageMb << "mb";
|
ss << "\nVRAM: " << vramUsageMb << "mb";
|
||||||
|
|
||||||
mFrameDataString = ss.str();
|
mFrameDataText = std::unique_ptr<TextCache>(mDefaultFonts.at(1)->buildTextCache(ss.str(), 50.f, 50.f, 0xFF00FFFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
mFrameTimeElapsed = 0;
|
mFrameTimeElapsed = 0;
|
||||||
|
@ -200,7 +200,7 @@ void Window::render()
|
||||||
if(Settings::getInstance()->getBool("DrawFramerate"))
|
if(Settings::getInstance()->getBool("DrawFramerate"))
|
||||||
{
|
{
|
||||||
Renderer::setMatrix(Eigen::Affine3f::Identity());
|
Renderer::setMatrix(Eigen::Affine3f::Identity());
|
||||||
mDefaultFonts.at(1)->drawText(mFrameDataString, Eigen::Vector2f(50, 50), 0xFF00FFFF);
|
mDefaultFonts.at(1)->renderTextCache(mFrameDataText.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,8 @@ private:
|
||||||
int mFrameTimeElapsed;
|
int mFrameTimeElapsed;
|
||||||
int mFrameCountElapsed;
|
int mFrameCountElapsed;
|
||||||
int mAverageDeltaTime;
|
int mAverageDeltaTime;
|
||||||
std::string mFrameDataString;
|
|
||||||
|
std::unique_ptr<TextCache> mFrameDataText;
|
||||||
|
|
||||||
bool mNormalizeNextUpdate;
|
bool mNormalizeNextUpdate;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue