Changed the font size and line spacing for the GPU statistics overlay.

This commit is contained in:
Leon Styhre 2020-11-16 17:46:36 +01:00
parent 2220787c3b
commit f334eb7037
3 changed files with 11 additions and 7 deletions

View file

@ -212,7 +212,7 @@ void Window::input(InputConfig* config, Input input)
} }
else if (config->getDeviceId() == DEVICE_KEYBOARD && input.value && input.id == SDLK_i && else if (config->getDeviceId() == DEVICE_KEYBOARD && input.value && input.id == SDLK_i &&
SDL_GetModState() & KMOD_LCTRL && Settings::getInstance()->getBool("Debug")) { SDL_GetModState() & KMOD_LCTRL && Settings::getInstance()->getBool("Debug")) {
// Toggle TextComponent debug view with Ctrl-I. // Toggle ImageComponent debug view with Ctrl-I.
Settings::getInstance()->setBool("DebugImage", Settings::getInstance()->setBool("DebugImage",
!Settings::getInstance()->getBool("DebugImage")); !Settings::getInstance()->getBool("DebugImage"));
} }
@ -274,8 +274,8 @@ void Window::update(int deltaTime)
textureVramUsageMiB << " MiB\nMax Texture VRAM: " << textureVramUsageMiB << " MiB\nMax Texture VRAM: " <<
textureTotalUsageMiB << " MiB"; textureTotalUsageMiB << " MiB";
mFrameDataText = std::unique_ptr<TextCache> mFrameDataText = std::unique_ptr<TextCache>
(mDefaultFonts.at(1)->buildTextCache(ss.str(), Renderer::getScreenWidth() * (mDefaultFonts.at(0)->buildTextCache(ss.str(), Renderer::getScreenWidth() *
0.02 , Renderer::getScreenHeight() * 0.02, 0xFF00FFFF)); 0.02 , Renderer::getScreenHeight() * 0.02, 0xFF00FFFF, 1.3));
} }
mFrameTimeElapsed = 0; mFrameTimeElapsed = 0;

View file

@ -636,10 +636,14 @@ TextCache* Font::buildTextCache(
return cache; return cache;
} }
TextCache* Font::buildTextCache(const std::string& text, float offsetX, TextCache* Font::buildTextCache(
float offsetY, unsigned int color) const std::string& text,
float offsetX,
float offsetY,
unsigned int color,
float lineSpacing)
{ {
return buildTextCache(text, Vector2f(offsetX, offsetY), color, 0.0f); return buildTextCache(text, Vector2f(offsetX, offsetY), color, 0.0f, ALIGN_LEFT, lineSpacing);
} }
void TextCache::setColor(unsigned int color) void TextCache::setColor(unsigned int color)

View file

@ -55,7 +55,7 @@ public:
// Returns the expected size of a string when rendered. Extra spacing is applied to the Y axis. // Returns the expected size of a string when rendered. Extra spacing is applied to the Y axis.
Vector2f sizeText(std::string text, float lineSpacing = 1.5f); Vector2f sizeText(std::string text, float lineSpacing = 1.5f);
TextCache* buildTextCache(const std::string& text, float offsetX, TextCache* buildTextCache(const std::string& text, float offsetX,
float offsetY, unsigned int color); float offsetY, unsigned int color, float lineSpacing = 1.5f);
TextCache* buildTextCache( TextCache* buildTextCache(
const std::string& text, const std::string& text,
Vector2f offset, Vector2f offset,