MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / Initialize

Method Initialize

TheForceEngine/TFE_Ui/imGUI/imgui.cpp:3713–3760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3711};
3712
3713void ImGui::Initialize()
3714{
3715 ImGuiContext& g = *GImGui;
3716 IM_ASSERT(!g.Initialized && !g.SettingsLoaded);
3717
3718 // Add .ini handle for ImGuiWindow and ImGuiTable types
3719 {
3720 ImGuiSettingsHandler ini_handler;
3721 ini_handler.TypeName = "Window";
3722 ini_handler.TypeHash = ImHashStr("Window");
3723 ini_handler.ClearAllFn = WindowSettingsHandler_ClearAll;
3724 ini_handler.ReadOpenFn = WindowSettingsHandler_ReadOpen;
3725 ini_handler.ReadLineFn = WindowSettingsHandler_ReadLine;
3726 ini_handler.ApplyAllFn = WindowSettingsHandler_ApplyAll;
3727 ini_handler.WriteAllFn = WindowSettingsHandler_WriteAll;
3728 AddSettingsHandler(&ini_handler);
3729 }
3730 TableSettingsAddSettingsHandler();
3731
3732 // Setup default localization table
3733 LocalizeRegisterEntries(GLocalizationEntriesEnUS, IM_ARRAYSIZE(GLocalizationEntriesEnUS));
3734
3735 // Setup default platform clipboard/IME handlers.
3736 g.IO.GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations
3737 g.IO.SetClipboardTextFn = SetClipboardTextFn_DefaultImpl;
3738 g.IO.ClipboardUserData = (void*)&g; // Default implementation use the ImGuiContext as user data (ideally those would be arguments to the function)
3739 g.IO.PlatformOpenInShellFn = PlatformOpenInShellFn_DefaultImpl;
3740 g.IO.PlatformSetImeDataFn = PlatformSetImeDataFn_DefaultImpl;
3741
3742 // Create default viewport
3743 ImGuiViewportP* viewport = IM_NEW(ImGuiViewportP)();
3744 viewport->ID = IMGUI_VIEWPORT_DEFAULT_ID;
3745 g.Viewports.push_back(viewport);
3746 g.TempBuffer.resize(1024 * 3 + 1, 0);
3747
3748 // Build KeysMayBeCharInput[] lookup table (1 bool per named key)
3749 for (ImGuiKey key = ImGuiKey_NamedKey_BEGIN; key < ImGuiKey_NamedKey_END; key = (ImGuiKey)(key + 1))
3750 if ((key >= ImGuiKey_0 && key <= ImGuiKey_9) || (key >= ImGuiKey_A && key <= ImGuiKey_Z) || (key >= ImGuiKey_Keypad0 && key <= ImGuiKey_Keypad9)
3751 || key == ImGuiKey_Tab || key == ImGuiKey_Space || key == ImGuiKey_Apostrophe || key == ImGuiKey_Comma || key == ImGuiKey_Minus || key == ImGuiKey_Period
3752 || key == ImGuiKey_Slash || key == ImGuiKey_Semicolon || key == ImGuiKey_Equal || key == ImGuiKey_LeftBracket || key == ImGuiKey_RightBracket || key == ImGuiKey_GraveAccent
3753 || key == ImGuiKey_KeypadDecimal || key == ImGuiKey_KeypadDivide || key == ImGuiKey_KeypadMultiply || key == ImGuiKey_KeypadSubtract || key == ImGuiKey_KeypadAdd || key == ImGuiKey_KeypadEqual)
3754 g.KeysMayBeCharInput.SetBit(key);
3755
3756#ifdef IMGUI_HAS_DOCK
3757#endif
3758
3759 g.Initialized = true;
3760}
3761
3762// This function is merely here to free heap allocations.
3763void ImGui::Shutdown()

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected