diff options
Diffstat (limited to 'source/frontend')
-rw-r--r-- | source/frontend/StarMainInterface.cpp | 27 | ||||
-rw-r--r-- | source/frontend/StarMainInterfaceTypes.cpp | 1 | ||||
-rw-r--r-- | source/frontend/StarMainInterfaceTypes.hpp | 1 |
3 files changed, 21 insertions, 8 deletions
diff --git a/source/frontend/StarMainInterface.cpp b/source/frontend/StarMainInterface.cpp index 86c7bb6..37ff2e3 100644 --- a/source/frontend/StarMainInterface.cpp +++ b/source/frontend/StarMainInterface.cpp @@ -1261,33 +1261,44 @@ void MainInterface::renderDebug() { auto assets = Root::singleton().assets(); m_guiContext->setFontSize(m_config->debugFontSize); m_guiContext->setFont(m_config->debugFont); + m_guiContext->setFontProcessingDirectives(m_config->debugFontDirectives); m_guiContext->setFontColor(Color::Green.toRgba()); + m_guiContext->setFontMode(FontMode::Normal); bool clearMap = m_debugMapClearTimer.wrapTick(); auto logMapValues = LogMap::getValues(); if (clearMap) LogMap::clear(); + List<String> formatted; + formatted.reserve(logMapValues.size()); + int counter = 0; for (auto const& pair : logMapValues) { - TextPositioning positioning = {Vec2F(m_config->debugOffset[0], windowHeight() - m_config->debugOffset[1] - m_config->fontSize * interfaceScale() * counter)}; - m_debugTextRect.combine(m_guiContext->determineTextSize(strf("{}: {}", pair.first, pair.second), positioning).padded(m_config->debugBackgroundPad)); - ++counter; + TextPositioning positioning = {Vec2F(m_config->debugOffset[0], windowHeight() - m_config->debugOffset[1] - m_config->fontSize * interfaceScale() * counter++)}; + String& text = formatted.emplace_back(strf("^white;{}^lightgray;:^reset; {}", pair.first, pair.second)); + m_debugTextRect.combine(m_guiContext->determineTextSize(text, positioning).padded(m_config->debugBackgroundPad)); } - if (!m_debugTextRect.isNull()) - m_guiContext->drawQuad(m_debugTextRect, m_config->debugBackgroundColor.toRgba()); + if (!m_debugTextRect.isNull()) { + RenderQuad& quad = m_guiContext->renderer()->immediatePrimitives() + .emplace_back(std::in_place_type_t<RenderQuad>(), m_debugTextRect, m_config->debugBackgroundColor.toRgba(), 0.0f).get<RenderQuad>(); - if (clearMap) - m_debugTextRect = RectF::null(); + quad.b.color[3] = quad.c.color[3] = 0; + }; + + m_debugTextRect = RectF::null(); counter = 0; for (auto const& pair : logMapValues) { TextPositioning positioning = {Vec2F(m_config->debugOffset[0], windowHeight() - m_config->debugOffset[1] - m_config->fontSize * interfaceScale() * counter)}; - m_guiContext->renderText(strf("{}: {}", pair.first, pair.second), positioning); + m_guiContext->renderText(formatted[counter], positioning); ++counter; } + m_guiContext->setFontSize(8); + m_guiContext->setDefaultFont(); m_guiContext->setFontColor(Vec4B::filled(255)); + m_guiContext->setFontProcessingDirectives(""); auto const& camera = m_worldPainter->camera(); diff --git a/source/frontend/StarMainInterfaceTypes.cpp b/source/frontend/StarMainInterfaceTypes.cpp index b0f7041..0731574 100644 --- a/source/frontend/StarMainInterfaceTypes.cpp +++ b/source/frontend/StarMainInterfaceTypes.cpp @@ -114,6 +114,7 @@ MainInterfaceConfigPtr MainInterfaceConfig::loadFromAssets() { config->debugOffset = jsonToVec2I(assets->json("/interface.config:debugOffset")); config->debugFontSize = assets->json("/interface.config:debugFontSize").toUInt(); config->debugFont = assets->json("/interface.config:debugFont").toString(); + config->debugFontDirectives = assets->json("/interface.config:debugFontDirectives").toString(); config->debugSpatialClearTime = assets->json("/interface.config:debugSpatialClearTime").toFloat(); config->debugMapClearTime = assets->json("/interface.config:debugMapClearTime").toFloat(); config->debugBackgroundColor = jsonToColor(assets->json("/interface.config:debugBackgroundColor")); diff --git a/source/frontend/StarMainInterfaceTypes.hpp b/source/frontend/StarMainInterfaceTypes.hpp index 4158639..e09892c 100644 --- a/source/frontend/StarMainInterfaceTypes.hpp +++ b/source/frontend/StarMainInterfaceTypes.hpp @@ -145,6 +145,7 @@ struct MainInterfaceConfig { Vec2I debugOffset; unsigned debugFontSize; String debugFont; + String debugFontDirectives; float debugSpatialClearTime; float debugMapClearTime; Color debugBackgroundColor; |