MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / Initialize

Method Initialize

Source/3rdParty/imgui/imgui.cpp:4381–4439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4379}
4380
4381void ImGui::Initialize()
4382{
4383 ImGuiContext& g = *GImGui;
4384 IM_ASSERT(!g.Initialized && !g.SettingsLoaded);
4385
4386 // Add .ini handle for ImGuiWindow and ImGuiTable types
4387 {
4388 ImGuiSettingsHandler ini_handler;
4389 ini_handler.TypeName = "Window";
4390 ini_handler.TypeHash = ImHashStr("Window");
4391 ini_handler.ClearAllFn = WindowSettingsHandler_ClearAll;
4392 ini_handler.ReadOpenFn = WindowSettingsHandler_ReadOpen;
4393 ini_handler.ReadLineFn = WindowSettingsHandler_ReadLine;
4394 ini_handler.ApplyAllFn = WindowSettingsHandler_ApplyAll;
4395 ini_handler.WriteAllFn = WindowSettingsHandler_WriteAll;
4396 AddSettingsHandler(&ini_handler);
4397 }
4398 TableSettingsAddSettingsHandler();
4399
4400 // Setup default localization table
4401 LocalizeRegisterEntries(GLocalizationEntriesEnUS, IM_COUNTOF(GLocalizationEntriesEnUS));
4402
4403 // Setup default ImGuiPlatformIO clipboard/IME handlers.
4404 g.PlatformIO.Platform_GetClipboardTextFn = Platform_GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations
4405 g.PlatformIO.Platform_SetClipboardTextFn = Platform_SetClipboardTextFn_DefaultImpl;
4406 g.PlatformIO.Platform_OpenInShellFn = Platform_OpenInShellFn_DefaultImpl;
4407 g.PlatformIO.Platform_SetImeDataFn = Platform_SetImeDataFn_DefaultImpl;
4408
4409 // Create default viewport
4410 ImGuiViewportP* viewport = IM_NEW(ImGuiViewportP)();
4411 viewport->ID = IMGUI_VIEWPORT_DEFAULT_ID;
4412 g.Viewports.push_back(viewport);
4413 g.TempBuffer.resize(1024 * 3 + 1, 0);
4414
4415 // Build KeysMayBeCharInput[] lookup table (1 bit per named key)
4416 for (ImGuiKey key = ImGuiKey_NamedKey_BEGIN; key < ImGuiKey_NamedKey_END; key = (ImGuiKey)(key + 1))
4417 if ((key >= ImGuiKey_0 && key <= ImGuiKey_9) || (key >= ImGuiKey_A && key <= ImGuiKey_Z) || (key >= ImGuiKey_Keypad0 && key <= ImGuiKey_Keypad9)
4418 || key == ImGuiKey_Tab || key == ImGuiKey_Space || key == ImGuiKey_Apostrophe || key == ImGuiKey_Comma || key == ImGuiKey_Minus || key == ImGuiKey_Period
4419 || key == ImGuiKey_Slash || key == ImGuiKey_Semicolon || key == ImGuiKey_Equal || key == ImGuiKey_LeftBracket || key == ImGuiKey_RightBracket || key == ImGuiKey_GraveAccent
4420 || key == ImGuiKey_KeypadDecimal || key == ImGuiKey_KeypadDivide || key == ImGuiKey_KeypadMultiply || key == ImGuiKey_KeypadSubtract || key == ImGuiKey_KeypadAdd || key == ImGuiKey_KeypadEqual)
4421 g.KeysMayBeCharInput.SetBit(key);
4422
4423#ifdef IMGUI_HAS_DOCK
4424#endif
4425
4426 // Print a debug message when running with debug feature IMGUI_DEBUG_HIGHLIGHT_ALL_ID_CONFLICTS because it is very slow.
4427 // DO NOT COMMENT OUT THIS MESSAGE. IT IS DESIGNED TO REMIND YOU THAT IMGUI_DEBUG_HIGHLIGHT_ALL_ID_CONFLICTS SHOULD ONLY BE TEMPORARILY ENABLED.
4428#ifdef IMGUI_DEBUG_HIGHLIGHT_ALL_ID_CONFLICTS
4429 DebugLog("IMGUI_DEBUG_HIGHLIGHT_ALL_ID_CONFLICTS is enabled.\nMust disable after use! Otherwise Dear ImGui will run slower.\n");
4430#endif
4431
4432 // ImDrawList/ImFontAtlas are designed to function without ImGui, and 99% of it works without an ImGui context.
4433 // But this link allows us to facilitate/handle a few edge cases better.
4434 ImFontAtlas* atlas = g.IO.Fonts;
4435 g.DrawListSharedData.Context = &g;
4436 RegisterFontAtlas(atlas);
4437
4438 g.Initialized = true;

Callers

nothing calls this directly

Calls 4

ImHashStrFunction · 0.85
push_backMethod · 0.45
resizeMethod · 0.45
SetBitMethod · 0.45

Tested by

no test coverage detected