| 4206 | } |
| 4207 | |
| 4208 | void ImGui::Initialize() |
| 4209 | { |
| 4210 | ImGuiContext& g = *GImGui; |
| 4211 | IM_ASSERT(!g.Initialized && !g.SettingsLoaded); |
| 4212 | |
| 4213 | // Add .ini handle for ImGuiWindow and ImGuiTable types |
| 4214 | { |
| 4215 | ImGuiSettingsHandler ini_handler; |
| 4216 | ini_handler.TypeName = "Window"; |
| 4217 | ini_handler.TypeHash = ImHashStr("Window"); |
| 4218 | ini_handler.ClearAllFn = WindowSettingsHandler_ClearAll; |
| 4219 | ini_handler.ReadOpenFn = WindowSettingsHandler_ReadOpen; |
| 4220 | ini_handler.ReadLineFn = WindowSettingsHandler_ReadLine; |
| 4221 | ini_handler.ApplyAllFn = WindowSettingsHandler_ApplyAll; |
| 4222 | ini_handler.WriteAllFn = WindowSettingsHandler_WriteAll; |
| 4223 | AddSettingsHandler(&ini_handler); |
| 4224 | } |
| 4225 | TableSettingsAddSettingsHandler(); |
| 4226 | |
| 4227 | // Setup default localization table |
| 4228 | LocalizeRegisterEntries(GLocalizationEntriesEnUS, IM_ARRAYSIZE(GLocalizationEntriesEnUS)); |
| 4229 | |
| 4230 | // Setup default ImGuiPlatformIO clipboard/IME handlers. |
| 4231 | g.PlatformIO.Platform_GetClipboardTextFn = Platform_GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations |
| 4232 | g.PlatformIO.Platform_SetClipboardTextFn = Platform_SetClipboardTextFn_DefaultImpl; |
| 4233 | g.PlatformIO.Platform_OpenInShellFn = Platform_OpenInShellFn_DefaultImpl; |
| 4234 | g.PlatformIO.Platform_SetImeDataFn = Platform_SetImeDataFn_DefaultImpl; |
| 4235 | |
| 4236 | // Create default viewport |
| 4237 | ImGuiViewportP* viewport = IM_NEW(ImGuiViewportP)(); |
| 4238 | viewport->ID = IMGUI_VIEWPORT_DEFAULT_ID; |
| 4239 | viewport->Idx = 0; |
| 4240 | viewport->PlatformWindowCreated = true; |
| 4241 | viewport->Flags = ImGuiViewportFlags_OwnedByApp; |
| 4242 | g.Viewports.push_back(viewport); |
| 4243 | g.TempBuffer.resize(1024 * 3 + 1, 0); |
| 4244 | g.ViewportCreatedCount++; |
| 4245 | g.PlatformIO.Viewports.push_back(g.Viewports[0]); |
| 4246 | |
| 4247 | // Build KeysMayBeCharInput[] lookup table (1 bool per named key) |
| 4248 | for (ImGuiKey key = ImGuiKey_NamedKey_BEGIN; key < ImGuiKey_NamedKey_END; key = (ImGuiKey)(key + 1)) |
| 4249 | if ((key >= ImGuiKey_0 && key <= ImGuiKey_9) || (key >= ImGuiKey_A && key <= ImGuiKey_Z) || (key >= ImGuiKey_Keypad0 && key <= ImGuiKey_Keypad9) |
| 4250 | || key == ImGuiKey_Tab || key == ImGuiKey_Space || key == ImGuiKey_Apostrophe || key == ImGuiKey_Comma || key == ImGuiKey_Minus || key == ImGuiKey_Period |
| 4251 | || key == ImGuiKey_Slash || key == ImGuiKey_Semicolon || key == ImGuiKey_Equal || key == ImGuiKey_LeftBracket || key == ImGuiKey_RightBracket || key == ImGuiKey_GraveAccent |
| 4252 | || key == ImGuiKey_KeypadDecimal || key == ImGuiKey_KeypadDivide || key == ImGuiKey_KeypadMultiply || key == ImGuiKey_KeypadSubtract || key == ImGuiKey_KeypadAdd || key == ImGuiKey_KeypadEqual) |
| 4253 | g.KeysMayBeCharInput.SetBit(key); |
| 4254 | |
| 4255 | #ifdef IMGUI_HAS_DOCK |
| 4256 | // Initialize Docking |
| 4257 | DockContextInitialize(&g); |
| 4258 | #endif |
| 4259 | |
| 4260 | g.Initialized = true; |
| 4261 | } |
| 4262 | |
| 4263 | // This function is merely here to free heap allocations. |
| 4264 | void ImGui::Shutdown() |
no test coverage detected