Skip to content

Commit

Permalink
imgui: add command line option to customize config file path
Browse files Browse the repository at this point in the history
when `-imguiconfig` is specified without value or with an empty string, config file loading/saving is disabled
fix #178
  • Loading branch information
alexey-lysiuk committed Jan 25, 2024
1 parent eae21c5 commit 7b83c2c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Quake/ig_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,16 @@ static void IG_Close()
void IG_Init(SDL_Window* window, SDL_GLContext context)
{
ImGui::CreateContext();
ImGui::GetIO().ConfigFlags = ImGuiConfigFlags_NoMouse;

ImGuiIO& io = ImGui::GetIO();

const int configargindex = COM_CheckParm("-imguiconfig");
const char* const configpath = configargindex > 0
? (configargindex < com_argc - 1 ? com_argv[configargindex + 1] : "")
: io.IniFilename;

io.ConfigFlags = ImGuiConfigFlags_NoMouse;
io.IniFilename = configpath[0] == '\0' ? nullptr : configpath;

ImGui_ImplSDL2_InitForOpenGL(window, context);
ImGui_ImplOpenGL2_Init();
Expand Down

0 comments on commit 7b83c2c

Please sign in to comment.