text: //
  // Created by Yaroslav on 05.04.2021.
  //
  
  #include "GUIRenderer.hpp"
  
  GUIRenderer::GUIRenderer(GLFWwindow *window)
  {
      IMGUI_CHECKVERSION();
      ImGui::CreateContext();
      ImGuiIO &io = ImGui::GetIO();
      ImGui::StyleColorsDark();
      ImGui_ImplGlfw_InitForOpenGL(window, true);
      const char* glslVersion = "#version 330";
      ImGui_ImplOpenGL3_Init(glslVersion);
  }
  
  void GUIRenderer::render(State *state)
  {
      ImGui_ImplOpenGL3_NewFrame();
      ImGui_ImplGlfw_NewFrame();
      ImGui::NewFrame();
  
      if (state->showInventory) renderInventory(state);
      if (state->showDebug) renderDebugInfo(state);
      renderRendererSettings(state);
  
      ImGui::Render();
      ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
      ImGui::EndFrame();
  }
  
  void GUIRenderer::renderDebugString(const std::string &string, float x, float y) {
      {
          ImGui_ImplOpenGL3_NewFrame();
          ImGui_ImplGlfw_NewFrame();
          ImGui::NewFrame();
  
          ImGui::SetNextWindowPos({x, y});
          ImGui::Begin("");
          ImGui::Text("%s", string.c_str());
          ImGui::End();
  
          ImGui::Render();
          ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
          ImGui::EndFrame();
      }
  }
  