From 41db0bfafa1adcb6be052fb62b62e45bd0785c36 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 16 Aug 2021 23:55:06 +0200 Subject: [PATCH] ui: Fixed welcome screen banner and hyperlink rendering --- external/ImGui/source/imgui_imhex_extensions.cpp | 3 ++- plugins/builtin/source/content/lang_builtin_functions.cpp | 2 +- source/window.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/external/ImGui/source/imgui_imhex_extensions.cpp b/external/ImGui/source/imgui_imhex_extensions.cpp index e6d74d13e..43c69a091 100644 --- a/external/ImGui/source/imgui_imhex_extensions.cpp +++ b/external/ImGui/source/imgui_imhex_extensions.cpp @@ -23,7 +23,8 @@ namespace ImGui { ImGuiContext& g = *GImGui; const ImGuiStyle& style = g.Style; const ImGuiID id = window->GetID(label); - const ImVec2 label_size = CalcTextSize(icon, NULL, false) + CalcTextSize(" ", NULL, false) + CalcTextSize(label, NULL, false); + ImVec2 label_size = CalcTextSize(icon, NULL, false); + label_size.x += CalcTextSize(" ", NULL, false).x + CalcTextSize(label, NULL, false).x; ImVec2 pos = window->DC.CursorPos; ImVec2 size = CalcItemSize(size_arg, label_size.x, label_size.y); diff --git a/plugins/builtin/source/content/lang_builtin_functions.cpp b/plugins/builtin/source/content/lang_builtin_functions.cpp index a250dd59b..e063344f2 100644 --- a/plugins/builtin/source/content/lang_builtin_functions.cpp +++ b/plugins/builtin/source/content/lang_builtin_functions.cpp @@ -116,7 +116,7 @@ namespace hex::plugin::builtin { auto message = AS_TYPE(ASTNodeStringLiteral, params[1])->getString(); if (LITERAL_COMPARE(condition, condition == 0)) - ctx.getConsole().log(LogConsole::Level::Warning, hex::format("assert failed \"{0}\"", message.data())); + ctx.getConsole().log(LogConsole::Level::Warning, hex::format("assert failed \"{0}\"", message)); return nullptr; }); diff --git a/source/window.cpp b/source/window.cpp index 78cd62ef4..4ef519b4d 100644 --- a/source/window.cpp +++ b/source/window.cpp @@ -433,7 +433,7 @@ namespace hex { void Window::drawWelcomeScreen() { const auto availableSpace = ImGui::GetContentRegionAvail(); - ImGui::Image(this->m_bannerTexture, ImVec2(this->m_bannerWidth / 2, this->m_bannerHeight / 2)); + ImGui::Image(this->m_bannerTexture, ImVec2(this->m_bannerWidth / (2 * (1.0F / this->m_globalScale)), this->m_bannerHeight / (2 * (1.0F / this->m_globalScale)))); ImGui::Indent(); if (ImGui::BeginTable("Welcome Left", 1, ImGuiTableFlags_NoBordersInBody, ImVec2(availableSpace.x / 2, 0))) {