From fcc642483f5b020136b931b88fa55c5a8ee127ec Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Mon, 11 Aug 2014 19:49:48 +0100 Subject: [PATCH] Added imguiLabel() overload. --- examples/common/imgui/imgui.cpp | 14 +++++++++++--- examples/common/imgui/imgui.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/examples/common/imgui/imgui.cpp b/examples/common/imgui/imgui.cpp index 9e86240b..acea0a1e 100644 --- a/examples/common/imgui/imgui.cpp +++ b/examples/common/imgui/imgui.cpp @@ -1392,7 +1392,7 @@ struct Imgui return res; } - void labelVargs(const char* _format, va_list _argList) + void labelVargs(const char* _format, va_list _argList, bool _enabled) { char temp[8192]; char* out = temp; @@ -1411,7 +1411,7 @@ struct Imgui , yy + BUTTON_HEIGHT / 2 + TEXT_HEIGHT / 2 , ImguiTextAlign::Left , out - , imguiRGBA(255, 255, 255, 255) + , _enabled?imguiRGBA(255, 255, 255, 255):imguiRGBA(255, 255, 255, 128) ); } @@ -2499,7 +2499,15 @@ void imguiLabel(const char* _format, ...) { va_list argList; va_start(argList, _format); - s_imgui.labelVargs(_format, argList); + s_imgui.labelVargs(_format, argList, true); + va_end(argList); +} + +void imguiLabel(bool _enabled, const char* _format, ...) +{ + va_list argList; + va_start(argList, _format); + s_imgui.labelVargs(_format, argList, _enabled); va_end(argList); } diff --git a/examples/common/imgui/imgui.h b/examples/common/imgui/imgui.h index 1ff293e5..82ba29e1 100644 --- a/examples/common/imgui/imgui.h +++ b/examples/common/imgui/imgui.h @@ -103,6 +103,7 @@ bool imguiItem(const char* _text, bool _enabled = true); bool imguiCheck(const char* _text, bool _checked, bool _enabled = true); bool imguiCollapse(const char* _text, const char* _subtext, bool _checked, bool _enabled = true); void imguiLabel(const char* _format, ...); +void imguiLabel(bool _enabled, const char* _format, ...); void imguiValue(const char* _text); bool imguiSlider(const char* _text, float& _val, float _vmin, float _vmax, float _vinc, bool _enabled = true); bool imguiSlider(const char* _text, int32_t& _val, int32_t _vmin, int32_t _vmax, bool _enabled = true);