MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / Initialize

Method Initialize

imgui_tiny_app/imgui/imgui.cpp:4461–4526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4459}
4460
4461void ImGui::Initialize()
4462{
4463 ImGuiContext& g = *GImGui;
4464 IM_ASSERT(!g.Initialized && !g.SettingsLoaded);
4465
4466 // Add .ini handle for ImGuiWindow and ImGuiTable types
4467 {
4468 ImGuiSettingsHandler ini_handler;
4469 ini_handler.TypeName = "Window";
4470 ini_handler.TypeHash = ImHashStr("Window");
4471 ini_handler.ClearAllFn = WindowSettingsHandler_ClearAll;
4472 ini_handler.ReadOpenFn = WindowSettingsHandler_ReadOpen;
4473 ini_handler.ReadLineFn = WindowSettingsHandler_ReadLine;
4474 ini_handler.ApplyAllFn = WindowSettingsHandler_ApplyAll;
4475 ini_handler.WriteAllFn = WindowSettingsHandler_WriteAll;
4476 AddSettingsHandler(&ini_handler);
4477 }
4478 TableSettingsAddSettingsHandler();
4479
4480 // Setup default localization table
4481 LocalizeRegisterEntries(GLocalizationEntriesEnUS, IM_COUNTOF(GLocalizationEntriesEnUS));
4482
4483 // Setup default ImGuiPlatformIO clipboard/IME handlers.
4484 g.PlatformIO.Platform_GetClipboardTextFn = Platform_GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations
4485 g.PlatformIO.Platform_SetClipboardTextFn = Platform_SetClipboardTextFn_DefaultImpl;
4486 g.PlatformIO.Platform_OpenInShellFn = Platform_OpenInShellFn_DefaultImpl;
4487 g.PlatformIO.Platform_SetImeDataFn = Platform_SetImeDataFn_DefaultImpl;
4488
4489 // Create default viewport
4490 ImGuiViewportP* viewport = IM_NEW(ImGuiViewportP)();
4491 viewport->ID = IMGUI_VIEWPORT_DEFAULT_ID;
4492 viewport->Idx = 0;
4493 viewport->PlatformWindowCreated = true;
4494 viewport->Flags = ImGuiViewportFlags_OwnedByApp;
4495 g.Viewports.push_back(viewport);
4496 g.TempBuffer.resize(1024 * 3 + 1, 0);
4497 g.ViewportCreatedCount++;
4498 g.PlatformIO.Viewports.push_back(g.Viewports[0]);
4499
4500 // Build KeysMayBeCharInput[] lookup table (1 bit per named key)
4501 for (ImGuiKey key = ImGuiKey_NamedKey_BEGIN; key < ImGuiKey_NamedKey_END; key = (ImGuiKey)(key + 1))
4502 if ((key >= ImGuiKey_0 && key <= ImGuiKey_9) || (key >= ImGuiKey_A && key <= ImGuiKey_Z) || (key >= ImGuiKey_Keypad0 && key <= ImGuiKey_Keypad9)
4503 || key == ImGuiKey_Tab || key == ImGuiKey_Space || key == ImGuiKey_Apostrophe || key == ImGuiKey_Comma || key == ImGuiKey_Minus || key == ImGuiKey_Period
4504 || key == ImGuiKey_Slash || key == ImGuiKey_Semicolon || key == ImGuiKey_Equal || key == ImGuiKey_LeftBracket || key == ImGuiKey_RightBracket || key == ImGuiKey_GraveAccent
4505 || key == ImGuiKey_KeypadDecimal || key == ImGuiKey_KeypadDivide || key == ImGuiKey_KeypadMultiply || key == ImGuiKey_KeypadSubtract || key == ImGuiKey_KeypadAdd || key == ImGuiKey_KeypadEqual)
4506 g.KeysMayBeCharInput.SetBit(key);
4507
4508#ifdef IMGUI_HAS_DOCK
4509 // Initialize Docking
4510 DockContextInitialize(&g);
4511#endif
4512
4513 // Print a debug message when running with debug feature IMGUI_DEBUG_HIGHLIGHT_ALL_ID_CONFLICTS because it is very slow.
4514 // DO NOT COMMENT OUT THIS MESSAGE. IT IS DESIGNED TO REMIND YOU THAT IMGUI_DEBUG_HIGHLIGHT_ALL_ID_CONFLICTS SHOULD ONLY BE TEMPORARILY ENABLED.
4515#ifdef IMGUI_DEBUG_HIGHLIGHT_ALL_ID_CONFLICTS
4516 DebugLog("IMGUI_DEBUG_HIGHLIGHT_ALL_ID_CONFLICTS is enabled.\nMust disable after use! Otherwise Dear ImGui will run slower.\n");
4517#endif
4518

Callers 1

LoadBitmapFromStreamFunction · 0.80

Calls 4

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

Tested by

no test coverage detected