From 94090eb08f8b9308be02617893c06dda9a02329d Mon Sep 17 00:00:00 2001 From: omar Date: Sun, 28 Jan 2018 17:47:28 +0100 Subject: [PATCH] Added IMGUI_USER_CONFIG to define a custom configuration filename. (#255, #1573, #1144, #41) --- imconfig.h | 9 ++++++--- imgui.h | 9 +++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/imconfig.h b/imconfig.h index 90e127a9..afa54914 100644 --- a/imconfig.h +++ b/imconfig.h @@ -1,7 +1,10 @@ //----------------------------------------------------------------------------- -// USER IMPLEMENTATION -// This file contains compile-time options for ImGui. -// Other options (memory allocation overrides, callbacks, etc.) can be set at runtime via the ImGuiIO structure - ImGui::GetIO(). +// COMPILE-TIME OPTIONS FOR DEAR IMGUI +// Most options (memory allocation, clipboard callbacks, etc.) can be set at runtime via the ImGuiIO structure - ImGui::GetIO(). +//----------------------------------------------------------------------------- +// A) You may edit imconfig.h (and not overwrite it when updating imgui, or maintain a patch/branch with your modifications to imconfig.h) +// B) or add configuration directives in your own file and compile with #define IMGUI_USER_CONFIG "myfilename.h" +// Note that options such as IMGUI_API, IM_VEC2_CLASS_EXTRA or ImDrawIdx needs to be defined consistently everywhere you include imgui.h, not only for the imgui*.cpp compilation units. //----------------------------------------------------------------------------- #pragma once diff --git a/imgui.h b/imgui.h index 56725bc0..40b95149 100644 --- a/imgui.h +++ b/imgui.h @@ -8,9 +8,14 @@ #pragma once -#if !defined(IMGUI_DISABLE_INCLUDE_IMCONFIG_H) || defined(IMGUI_INCLUDE_IMCONFIG_H) -#include "imconfig.h" // User-editable configuration file +// User-editable configuration files (edit stock imconfig.h or define IMGUI_USER_CONFIG to your own filename) +#ifdef IMGUI_USER_CONFIG +#include IMGUI_USER_CONFIG #endif +#if !defined(IMGUI_DISABLE_INCLUDE_IMCONFIG_H) || defined(IMGUI_INCLUDE_IMCONFIG_H) +#include "imconfig.h" +#endif + #include // FLT_MAX #include // va_list #include // ptrdiff_t, NULL