text: #include "hello_imgui/internal/backend_impls/abstract_runner.h"
  #include "hello_imgui/internal/docking_details.h"
  #include "hello_imgui/internal/menu_statusbar.h"
  #include "imgui.h"
  
  namespace HelloImGui
  {
  
  void AbstractRunner::Run()
  {
      Setup();
  
  #ifdef HELLOIMGUI_MOBILEDEVICE
      while (true)
          CreateFramesAndRender();
  #else
      while (!params.appShallExit)
          CreateFramesAndRender();
  #endif
      TearDown();
  }
  
  
  void AbstractRunner::Setup()
  {
      Impl_InitBackend();
      Impl_Select_Gl_Version();
      Impl_CreateWindowAndContext();
      Impl_InitGlLoader();
      IMGUI_CHECKVERSION();
      ImGui::CreateContext();
      Impl_SetupImgGuiContext();
      params.callbacks.SetupImGuiConfig();
      params.callbacks.SetupImGuiStyle();
      Impl_SetupPlatformRendererBindings();
      ImGui::GetIO().Fonts->Clear();
      params.callbacks.LoadAdditionalFonts();
      ImGui::GetIO().Fonts->Build();
      DockingDetails::ConfigureImGuiDocking(params.imGuiWindowParams);
  
      if (params.callbacks.PostInit)
          params.callbacks.PostInit();
  }
  
  void AbstractRunner::RenderGui()
  {
      DockingDetails::ProvideWindowOrDock(params.imGuiWindowParams, params.dockingParams);
  
      if (params.imGuiWindowParams.showMenuBar)
          Menu_StatusBar::ShowMenu(params);
  
      if (params.callbacks.ShowGui)
          params.callbacks.ShowGui();
  
      DockingDetails::ShowDockableWindows(params.dockingParams.dockableWindows);
  
      if (params.imGuiWindowParams.showStatusBar)
          Menu_StatusBar::ShowStatusBar(params);
  
      DockingDetails::CloseWindowOrDock(params.imGuiWindowParams);
  }
  
  
  void AbstractRunner::CreateFramesAndRender()
  {
      if (Impl_PollEvents())
          params.appShallExit = true;
  
      Impl_NewFrame_3D();
      Impl_NewFrame_Backend();
      ImGui::NewFrame();
  
      RenderGui();
  
      ImGui::Render();
      Impl_Frame_3D_ClearColor();
      Impl_RenderDrawData_To_3D();
  
      if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
          Impl_UpdateAndRenderAdditionalPlatformWindows();
  
      Impl_SwapBuffers();
  }
  
  void AbstractRunner::OnPause()
  {
  #ifdef HELLOIMGUI_MOBILEDEVICE
      if (params.callbacks.mobileCallbacks.OnPause)
          params.callbacks.mobileCallbacks.OnPause();
  #endif
  }
  
  void AbstractRunner::OnResume()
  {
  #ifdef HELLOIMGUI_MOBILEDEVICE
      if (params.callbacks.mobileCallbacks.OnResume)
          params.callbacks.mobileCallbacks.OnResume();
  #endif
  }
  
  void AbstractRunner::OnDestroy()
  {
  #ifdef HELLOIMGUI_MOBILEDEVICE
      if (params.callbacks.mobileCallbacks.OnDestroy)
          params.callbacks.mobileCallbacks.OnDestroy();
  #endif
  }
  
  void AbstractRunner::OnLowMemory()
  {
  #ifdef HELLOIMGUI_MOBILEDEVICE
      if (params.callbacks.mobileCallbacks.OnLowMemory)
          params.callbacks.mobileCallbacks.OnLowMemory();
  #endif
  }
  
  void AbstractRunner::TearDown()
  {
      Impl_Cleanup();
  }
  
  }  // namespace HelloImGui
  