MCPcopy Create free account
hub / github.com/Norbyte/bg3se / InitializeUI

Method InitializeUI

BG3Extender/Extender/Client/IMGUI/IMGUI.cpp:1800–1848  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1798}
1799
1800void IMGUIManager::InitializeUI()
1801{
1802 if (initialized_) return;
1803
1804 IMGUI_DEBUG("IMGUIManager::InitializeUI()");
1805
1806 IMGUI_CHECKVERSION();
1807 ImGui::CreateContext();
1808 ImGuiIO& io = ImGui::GetIO();
1809 io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
1810 io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
1811#if !defined(NDEBUG)
1812 io.ConfigDebugIsDebuggerPresent = IsDebuggerPresent();
1813#endif
1814 io.ConfigDebugHighlightIdConflicts = gExtender->GetConfig().DeveloperMode;
1815 io.ConfigDebugIniSettings = gExtender->GetConfig().DeveloperMode;
1816
1817 auto configPath = GetStaticSymbols().ToPath("imgui.ini", PathRootType::UserProfile);
1818 if (!configPath.empty()) {
1819 io.IniFilename = _strdup(configPath.c_str());
1820 }
1821
1822 sdl_.InitializeUI();
1823 renderer_->InitializeUI();
1824
1825 UpdateStyle();
1826
1827 auto const& language = GetStaticSymbols().GetGlobalSwitches()->Language;
1828 // Disable very small font sizes for fonts with small glyphs
1829 reducedFontAtlas_ =
1830 language == "Japanese"
1831 || language == "Chinese"
1832 || language == "ChineseTraditional";
1833
1834 if (reducedFontAtlas_) {
1835 LoadFont(GFS.strMedium, "", 32.0f);
1836 LoadFont(GFS.strDefault, "", 36.0f);
1837 LoadFont(GFS.strLarge, "", 40.0f);
1838 } else {
1839 LoadFont(GFS.strTiny, "", 24.0f);
1840 LoadFont(GFS.strSmall, "", 28.0f);
1841 LoadFont(GFS.strMedium, "", 32.0f);
1842 LoadFont(GFS.strDefault, "", 36.0f);
1843 LoadFont(GFS.strLarge, "", 40.0f);
1844 LoadFont(GFS.strBig, "", 44.0f);
1845 }
1846
1847 initialized_ = true;
1848}
1849
1850void IMGUIManager::DestroyUI()
1851{

Callers

nothing calls this directly

Calls 3

ToPathMethod · 0.80
GetGlobalSwitchesMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected