diff --git a/include/window.hpp b/include/window.hpp index 4c518f9e6..8ae56be46 100644 --- a/include/window.hpp +++ b/include/window.hpp @@ -28,7 +28,7 @@ namespace hex { friend void ImHexSettingsHandler_ApplyAll(ImGuiContext *ctx, ImGuiSettingsHandler *handler); friend void ImHexSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler *handler, ImGuiTextBuffer *buf); - bool setFont(const std::filesystem::path &font_path); + void setFont(const std::filesystem::path &font_path); private: void setupNativeWindow(); diff --git a/plugins/builtin/CMakeLists.txt b/plugins/builtin/CMakeLists.txt index 39f57a115..08a140c97 100644 --- a/plugins/builtin/CMakeLists.txt +++ b/plugins/builtin/CMakeLists.txt @@ -12,7 +12,7 @@ add_library(${PROJECT_NAME} SHARED source/content/settings_entries.cpp source/content/tools_entries.cpp source/content/data_processor_nodes.cpp - source/content/footer_items.cpp + source/content/ui_items.cpp source/math_evaluator.cpp diff --git a/plugins/builtin/source/content/ui_items.cpp b/plugins/builtin/source/content/ui_items.cpp index 39862a75c..e9636ae2b 100644 --- a/plugins/builtin/source/content/ui_items.cpp +++ b/plugins/builtin/source/content/ui_items.cpp @@ -1,5 +1,9 @@ #include +#include +#include +#include + namespace hex::plugin::builtin { void addFooterItems() { @@ -15,4 +19,32 @@ namespace hex::plugin::builtin { } + void addToolbarItems() { + ContentRegistry::Interface::addToolbarItem([] { + const static auto buttonSize = ImVec2(ImGui::GetCurrentWindow()->MenuBarHeight(), ImGui::GetCurrentWindow()->MenuBarHeight()); + ImGui::ToolBarButton(ICON_VS_DISCARD, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarBlue), buttonSize); + ImGui::ToolBarButton(ICON_VS_REDO, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarBlue), buttonSize); + + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + + ImGui::ToolBarButton(ICON_VS_FILE, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarGray), buttonSize); + ImGui::ToolBarButton(ICON_VS_FOLDER_OPENED, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarBrown), buttonSize); + + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + + ImGui::ToolBarButton(ICON_VS_SAVE, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarBlue), buttonSize); + ImGui::ToolBarButton(ICON_VS_SAVE_AS, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarBlue), buttonSize); + + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + + ImGui::ToolBarButton(ICON_VS_COPY, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarGray), buttonSize); + ImGui::ToolBarButton(ICON_VS_OUTPUT, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarGray), buttonSize); + + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + + ImGui::ToolBarButton(ICON_VS_BOOKMARK, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarGreen), buttonSize); + }); + + } + } \ No newline at end of file diff --git a/plugins/builtin/source/plugin_builtin.cpp b/plugins/builtin/source/plugin_builtin.cpp index 58fae7bdc..b8dd44d4f 100644 --- a/plugins/builtin/source/plugin_builtin.cpp +++ b/plugins/builtin/source/plugin_builtin.cpp @@ -10,6 +10,7 @@ namespace hex::plugin::builtin { void registerDataProcessorNodes(); void addFooterItems(); + void addToolbarItems(); void registerLanguageEnUS(); void registerLanguageDeDE(); @@ -29,6 +30,7 @@ IMHEX_PLUGIN_SETUP("Built-in", "WerWolv", "Default ImHex functionality") { registerDataProcessorNodes(); addFooterItems(); + addToolbarItems(); registerLanguageEnUS(); registerLanguageDeDE(); diff --git a/plugins/libimhex/include/hex/api/content_registry.hpp b/plugins/libimhex/include/hex/api/content_registry.hpp index d2da9704e..4fc18e558 100644 --- a/plugins/libimhex/include/hex/api/content_registry.hpp +++ b/plugins/libimhex/include/hex/api/content_registry.hpp @@ -191,9 +191,11 @@ namespace hex { static void addWelcomeScreenEntry(const DrawCallback &function); static void addFooterItem(const DrawCallback &function); + static void addToolbarItem(const DrawCallback &function); static std::vector& getWelcomeScreenEntries(); static std::vector& getFooterItems(); + static std::vector& getToolbarItems(); }; }; diff --git a/plugins/libimhex/include/hex/helpers/shared_data.hpp b/plugins/libimhex/include/hex/helpers/shared_data.hpp index 8559794a2..553beec2d 100644 --- a/plugins/libimhex/include/hex/helpers/shared_data.hpp +++ b/plugins/libimhex/include/hex/helpers/shared_data.hpp @@ -72,6 +72,7 @@ namespace hex { static std::vector welcomeScreenEntries; static std::vector footerItems; + static std::vector toolbarItems; static std::vector dataProcessorNodes; static u32 dataProcessorNodeIdCounter; diff --git a/plugins/libimhex/include/hex/plugin.hpp b/plugins/libimhex/include/hex/plugin.hpp index 19758d7f2..5cca8fa7e 100644 --- a/plugins/libimhex/include/hex/plugin.hpp +++ b/plugins/libimhex/include/hex/plugin.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -20,5 +21,6 @@ [[gnu::visibility("default")]] const char* getPluginName() { return name; } \ [[gnu::visibility("default")]] const char* getPluginAuthor() { return author; } \ [[gnu::visibility("default")]] const char* getPluginDescription() { return description; } \ + [[gnu::visibility("default")]] void setImGuiContext(ImGuiContext *ctx) { ImGui::SetCurrentContext(ctx); GImGui = ctx; } \ } \ void hex::plugin::namespaceName::internal::initializePlugin() diff --git a/plugins/libimhex/source/api/content_registry.cpp b/plugins/libimhex/source/api/content_registry.cpp index b3de495b4..d2301cb20 100644 --- a/plugins/libimhex/source/api/content_registry.cpp +++ b/plugins/libimhex/source/api/content_registry.cpp @@ -233,6 +233,10 @@ namespace hex { getFooterItems().push_back(function); } + void ContentRegistry::Interface::addToolbarItem(const ContentRegistry::Interface::DrawCallback &function){ + getToolbarItems().push_back(function); + } + std::vector& ContentRegistry::Interface::getWelcomeScreenEntries() { return SharedData::welcomeScreenEntries; @@ -240,4 +244,7 @@ namespace hex { std::vector& ContentRegistry::Interface::getFooterItems() { return SharedData::footerItems; } + std::vector& ContentRegistry::Interface::getToolbarItems() { + return SharedData::toolbarItems; + } } \ No newline at end of file diff --git a/plugins/libimhex/source/helpers/shared_data.cpp b/plugins/libimhex/source/helpers/shared_data.cpp index f78249f37..d54f91945 100644 --- a/plugins/libimhex/source/helpers/shared_data.cpp +++ b/plugins/libimhex/source/helpers/shared_data.cpp @@ -22,6 +22,7 @@ namespace hex { std::vector SharedData::welcomeScreenEntries; std::vector SharedData::footerItems; + std::vector SharedData::toolbarItems; std::vector SharedData::dataProcessorNodes; u32 SharedData::dataProcessorNodeIdCounter = 1; diff --git a/source/helpers/plugin_manager.cpp b/source/helpers/plugin_manager.cpp index 37b29337d..7ddf0886e 100644 --- a/source/helpers/plugin_manager.cpp +++ b/source/helpers/plugin_manager.cpp @@ -11,6 +11,7 @@ namespace hex { constexpr auto GetPluginNameSymbol = "_ZN3hex6plugin{0}{1}8internal13getPluginNameEv"; constexpr auto GetPluginAuthorSymbol = "_ZN3hex6plugin{0}{1}8internal15getPluginAuthorEv"; constexpr auto GetPluginDescriptionSymbol = "_ZN3hex6plugin{0}{1}8internal20getPluginDescriptionEv"; + constexpr auto SetImGuiContextSymbol = "_ZN3hex6plugin{0}{1}8internal15setImGuiContextEP12ImGuiContext"; Plugin::Plugin(std::string_view path) { this->m_handle = dlopen(path.data(), RTLD_LAZY); @@ -26,6 +27,7 @@ namespace hex { this->m_getPluginNameFunction = getPluginFunction(pluginName, GetPluginNameSymbol); this->m_getPluginAuthorFunction = getPluginFunction(pluginName, GetPluginAuthorSymbol); this->m_getPluginDescriptionFunction = getPluginFunction(pluginName, GetPluginDescriptionSymbol); + this->m_setImGuiContextFunction = getPluginFunction(pluginName, SetImGuiContextSymbol); } Plugin::Plugin(Plugin &&other) noexcept { @@ -34,12 +36,14 @@ namespace hex { this->m_getPluginNameFunction = other.m_getPluginNameFunction; this->m_getPluginAuthorFunction = other.m_getPluginAuthorFunction; this->m_getPluginDescriptionFunction = other.m_getPluginDescriptionFunction; + this->m_setImGuiContextFunction = other.m_setImGuiContextFunction; other.m_handle = nullptr; other.m_initializePluginFunction = nullptr; other.m_getPluginNameFunction = nullptr; other.m_getPluginAuthorFunction = nullptr; other.m_getPluginDescriptionFunction = nullptr; + other.m_setImGuiContextFunction = nullptr; } Plugin::~Plugin() { @@ -73,6 +77,11 @@ namespace hex { return ""; } + void Plugin::setImGuiContext(ImGuiContext *ctx) const { + if (this->m_setImGuiContextFunction != nullptr) + this->m_setImGuiContextFunction(ctx); + } + bool PluginManager::load(std::string_view pluginFolder) { if (!std::filesystem::exists(pluginFolder)) return false; diff --git a/source/init/splash_window.cpp b/source/init/splash_window.cpp index a6ce1e492..85c354ea3 100644 --- a/source/init/splash_window.cpp +++ b/source/init/splash_window.cpp @@ -90,7 +90,7 @@ namespace hex::init { { std::lock_guard guard(this->m_progressMutex); - auto drawList = ImGui::GetOverlayDrawList(); + auto drawList = ImGui::GetForegroundDrawList(); drawList->AddImage(splashTexture, ImVec2(0, 0), splashTexture.size() * this->m_globalScale); diff --git a/source/window/win_window.cpp b/source/window/win_window.cpp index 93d212963..b47bd74e1 100644 --- a/source/window/win_window.cpp +++ b/source/window/win_window.cpp @@ -110,7 +110,7 @@ case RegionBottom | RegionRight: return HTBOTTOMRIGHT; case RegionClient: - if ((cursor.y < (window.top + titleBarHeight)) && !ImGui::IsAnyItemHovered()) + if ((cursor.y < (window.top + titleBarHeight * 2)) && !ImGui::IsAnyItemHovered()) return HTCAPTION; else break; } @@ -137,7 +137,7 @@ } void Window::drawTitleBar() { - auto buttonSize = ImVec2(titleBarHeight * 1.5F, titleBarHeight); + auto buttonSize = ImVec2(titleBarHeight * 1.5F, titleBarHeight - 1); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetColorU32(ImGuiCol_MenuBarBg)); @@ -146,22 +146,22 @@ ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * 6); #if defined(DEBUG) - if (ImGui::Button(ICON_VS_DEBUG, buttonSize)) + if (ImGui::TitleBarButton(ICON_VS_DEBUG, buttonSize)) hex::openWebpage("https://imhex.werwolv.net/debug"); ImGui::InfoTooltip("hex.menu.debug_build"_lang); #endif - if (ImGui::Button(ICON_VS_SMILEY, buttonSize)) + if (ImGui::TitleBarButton(ICON_VS_SMILEY, buttonSize)) hex::openWebpage("mailto://hey@werwolv.net"); ImGui::InfoTooltip("hex.menu.feedback"_lang); ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * 3); - if (ImGui::Button(ICON_VS_CHROME_MINIMIZE, buttonSize)) + if (ImGui::TitleBarButton(ICON_VS_CHROME_MINIMIZE, buttonSize)) glfwIconifyWindow(this->m_window); if (glfwGetWindowAttrib(this->m_window, GLFW_MAXIMIZED)) { - if (ImGui::Button(ICON_VS_CHROME_RESTORE, buttonSize)) + if (ImGui::TitleBarButton(ICON_VS_CHROME_RESTORE, buttonSize)) glfwRestoreWindow(this->m_window); } else { - if (ImGui::Button(ICON_VS_CHROME_MAXIMIZE, buttonSize)) + if (ImGui::TitleBarButton(ICON_VS_CHROME_MAXIMIZE, buttonSize)) glfwMaximizeWindow(this->m_window); } @@ -169,7 +169,7 @@ ImGui::PushStyleColor(ImGuiCol_ButtonHovered, 0xFF2311E8); - if (ImGui::Button(ICON_VS_CHROME_CLOSE, buttonSize)) { + if (ImGui::TitleBarButton(ICON_VS_CHROME_CLOSE, buttonSize)) { EventManager::post(); EventManager::post(this->m_window); } diff --git a/source/window/window.cpp b/source/window/window.cpp index bd8a27967..89e19a506 100644 --- a/source/window/window.cpp +++ b/source/window/window.cpp @@ -107,6 +107,9 @@ namespace hex { } ImGui::GetStyle().Colors[ImGuiCol_DockingEmptyBg] = ImGui::GetStyle().Colors[ImGuiCol_WindowBg]; + ImGui::GetStyle().Colors[ImGuiCol_TitleBg] = ImGui::GetStyle().Colors[ImGuiCol_MenuBarBg]; + ImGui::GetStyle().Colors[ImGuiCol_TitleBgActive] = ImGui::GetStyle().Colors[ImGuiCol_MenuBarBg]; + ImGui::GetStyle().Colors[ImGuiCol_TitleBgCollapsed] = ImGui::GetStyle().Colors[ImGuiCol_MenuBarBg]; if (!this->m_bannerTexture.valid()) { log::fatal("Failed to load banner texture!"); @@ -214,7 +217,9 @@ namespace hex { auto signalHandler = [](int signalNumber) { EventManager::post(signalNumber); - std::abort(); + + std::signal(signalNumber, SIG_DFL); + std::raise(signalNumber); }; std::signal(SIGTERM, signalHandler); @@ -255,15 +260,9 @@ namespace hex { } } - bool Window::setFont(const std::filesystem::path &path) { - if (!std::filesystem::exists(path)) - return false; - + void Window::setFont(const std::filesystem::path &path) { auto &io = ImGui::GetIO(); - // If we have a custom font, then rescaling is unnecessary and will make it blurry - io.FontGlobalScale = 1.0f; - // Load font data & build atlas std::uint8_t *px; int w, h; @@ -271,15 +270,6 @@ namespace hex { ImVector ranges; ImFontGlyphRangesBuilder glyphRangesBuilder; - glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesDefault()); - glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesJapanese()); - glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesChineseFull()); - glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesCyrillic()); - glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesKorean()); - glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesThai()); - glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesVietnamese()); - glyphRangesBuilder.BuildRanges(&ranges); - ImWchar fontAwesomeRange[] = { ICON_MIN_FA, ICON_MAX_FA, 0 @@ -291,16 +281,42 @@ namespace hex { }; ImFontConfig cfg; - cfg.OversampleH = cfg.OversampleV = 1, cfg.PixelSnapH = true; - cfg.SizePixels = 13.0f * this->m_fontScale; - io.Fonts->AddFontFromFileTTF(path.string().c_str(), std::floor(14.0f * this->m_fontScale), &cfg, ranges.Data); // Needs conversion to char for Windows + if (!std::filesystem::exists(path)) { + // Load default font + io.Fonts->Clear(); + + cfg.OversampleH = cfg.OversampleV = 1, cfg.PixelSnapH = true; + cfg.SizePixels = 13.0f * this->m_fontScale; + io.Fonts->AddFontDefault(&cfg); + } else { + // Load custom font + + // If we have a custom font, then rescaling is unnecessary and will make it blurry + io.FontGlobalScale = 1.0f; + + glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesDefault()); + glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesJapanese()); + glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesChineseFull()); + glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesCyrillic()); + glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesKorean()); + glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesThai()); + glyphRangesBuilder.AddRanges(io.Fonts->GetGlyphRangesVietnamese()); + glyphRangesBuilder.BuildRanges(&ranges); + + + cfg.OversampleH = cfg.OversampleV = 1, cfg.PixelSnapH = true; + cfg.SizePixels = 13.0f * this->m_fontScale; + + io.Fonts->AddFontFromFileTTF(path.string().c_str(), std::floor(14.0f * this->m_fontScale), &cfg, ranges.Data); // Needs conversion to char for Windows + } + cfg.MergeMode = true; io.Fonts->AddFontFromMemoryCompressedTTF(font_awesome_compressed_data, font_awesome_compressed_size, 13.0f * this->m_fontScale, &cfg, fontAwesomeRange); io.Fonts->AddFontFromMemoryCompressedTTF(codicons_compressed_data, codicons_compressed_size, 13.0f * this->m_fontScale, &cfg, codiconsRange); - ImGuiFreeType::BuildFontAtlas(io.Fonts, ImGuiFreeType::Monochrome); + ImGuiFreeType::BuildFontAtlas(io.Fonts); io.Fonts->GetTexDataAsRGBA32(&px, &w, &h); // Create new font atlas @@ -311,8 +327,6 @@ namespace hex { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA8, GL_UNSIGNED_INT, px); io.Fonts->SetTexID(reinterpret_cast(tex)); - - return true; } void Window::frameBegin() { @@ -322,11 +336,12 @@ namespace hex { ImGui::NewFrame(); ImGuiViewport* viewport = ImGui::GetMainViewport(); - ImGui::SetNextWindowPos(viewport->GetWorkPos()); - ImGui::SetNextWindowSize(viewport->GetWorkSize()); + ImGui::SetNextWindowPos(viewport->WorkPos); + ImGui::SetNextWindowSize(viewport->WorkSize); ImGui::SetNextWindowViewport(viewport->ID); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0)); ImGuiWindowFlags windowFlags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse @@ -337,11 +352,11 @@ namespace hex { ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; if (ImGui::Begin("DockSpace", nullptr, windowFlags)) { - ImGui::PopStyleVar(2); - - ImGui::DockSpace(ImGui::GetID("MainDock"), ImVec2(0.0f, ImGui::GetContentRegionAvail().y - ImGui::GetTextLineHeightWithSpacing() - 1)); + ImGui::PopStyleVar(); + ImGui::DockSpace(ImGui::GetID("MainDock"), ImVec2(0.0f, ImGui::GetContentRegionAvail().y - ImGui::GetTextLineHeightWithSpacing() - ImGui::GetStyle().FramePadding.y * 2 - 1)); ImGui::Separator(); + ImGui::SetCursorPosX(8); for (const auto &callback : ContentRegistry::Interface::getFooterItems()) { auto prevIdx = ImGui::GetWindowDrawList()->_VtxCurrentIdx; callback(); @@ -355,7 +370,8 @@ namespace hex { } } - if (ImGui::BeginMenuBar()) { + ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); + if (ImGui::BeginMainMenuBar()) { auto menuBarHeight = ImGui::GetCurrentWindow()->MenuBarHeight(); ImGui::SetCursorPosX(5); @@ -386,7 +402,19 @@ namespace hex { this->drawTitleBar(); - ImGui::EndMenuBar(); + ImGui::EndMainMenuBar(); + } + ImGui::PopStyleVar(); + + // Draw toolbar + if (ImGui::BeginMenuBar()) { + + for (const auto &callback : ContentRegistry::Interface::getToolbarItems()) { + callback(); + ImGui::SameLine(); + } + + ImGui::EndMenuBar(); } if (SharedData::currentProvider == nullptr) { @@ -410,6 +438,7 @@ namespace hex { } ImGui::End(); + ImGui::PopStyleVar(2); // Popup for when no plugins were loaded. Intentionally left untranslated because localization isn't available @@ -788,6 +817,9 @@ namespace hex { ImGuiIO& io = ImGui::GetIO(); ImGuiStyle& style = ImGui::GetStyle(); + style.Alpha = 1.0F; + style.WindowRounding = 0.0F; + io.ConfigFlags |= ImGuiConfigFlags_DockingEnable | ImGuiConfigFlags_NavEnableKeyboard; #if !defined(OS_LINUX) io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; @@ -838,44 +870,7 @@ namespace hex { break; } - if (this->setFont(fontFile)) { - - } - else { - io.Fonts->Clear(); - - ImFontConfig cfg; - cfg.OversampleH = cfg.OversampleV = 1, cfg.PixelSnapH = true; - cfg.SizePixels = 13.0f * this->m_fontScale; - io.Fonts->AddFontDefault(&cfg); - - cfg.MergeMode = true; - - ImWchar fontAwesomeRange[] = { - ICON_MIN_FA, ICON_MAX_FA, - 0 - }; - - ImWchar codiconsRange[] = { - ICON_MIN_VS, ICON_MAX_VS, - 0 - }; - std::uint8_t *px; - int w, h; - io.Fonts->AddFontFromMemoryCompressedTTF(font_awesome_compressed_data, font_awesome_compressed_size, 11.0f * this->m_fontScale, &cfg, fontAwesomeRange); - io.Fonts->AddFontFromMemoryCompressedTTF(codicons_compressed_data, codicons_compressed_size, 11.0f * this->m_fontScale, &cfg, codiconsRange); - - io.Fonts->GetTexDataAsRGBA32(&px, &w, &h); - - // Create new font atlas - GLuint tex; - glGenTextures(1, &tex); - glBindTexture(GL_TEXTURE_2D, tex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA8, GL_UNSIGNED_INT, px); - io.Fonts->SetTexID(reinterpret_cast(tex)); - } + this->setFont(fontFile); style.WindowMenuButtonPosition = ImGuiDir_None; @@ -903,6 +898,9 @@ namespace hex { ImGui_ImplGlfw_InitForOpenGL(this->m_window, true); ImGui_ImplOpenGL3_Init("#version 150"); + + for (const auto &plugin : PluginManager::getPlugins()) + plugin.setImGuiContext(ImGui::GetCurrentContext()); } void Window::deinitGLFW() {