Added imguiLabel() overload.

This commit is contained in:
Dario Manesku 2014-08-11 19:49:48 +01:00
parent 0c7dea6cb3
commit fcc642483f
2 changed files with 12 additions and 3 deletions

View file

@ -1392,7 +1392,7 @@ struct Imgui
return res; return res;
} }
void labelVargs(const char* _format, va_list _argList) void labelVargs(const char* _format, va_list _argList, bool _enabled)
{ {
char temp[8192]; char temp[8192];
char* out = temp; char* out = temp;
@ -1411,7 +1411,7 @@ struct Imgui
, yy + BUTTON_HEIGHT / 2 + TEXT_HEIGHT / 2 , yy + BUTTON_HEIGHT / 2 + TEXT_HEIGHT / 2
, ImguiTextAlign::Left , ImguiTextAlign::Left
, out , 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_list argList;
va_start(argList, _format); 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); va_end(argList);
} }

View file

@ -103,6 +103,7 @@ bool imguiItem(const char* _text, bool _enabled = true);
bool imguiCheck(const char* _text, bool _checked, 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); bool imguiCollapse(const char* _text, const char* _subtext, bool _checked, bool _enabled = true);
void imguiLabel(const char* _format, ...); void imguiLabel(const char* _format, ...);
void imguiLabel(bool _enabled, const char* _format, ...);
void imguiValue(const char* _text); 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, 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); bool imguiSlider(const char* _text, int32_t& _val, int32_t _vmin, int32_t _vmax, bool _enabled = true);