Added optional parameter for imguiInput().

This commit is contained in:
Dario Manesku 2014-08-11 22:28:22 +01:00
parent 4501e17f4b
commit 6e69a02906
2 changed files with 23 additions and 11 deletions

View file

@ -1057,7 +1057,7 @@ struct Imgui
return res;
}
void input(const char* _label, char* _str, uint32_t _len, bool _enabled)
void input(const char* _label, char* _str, uint32_t _len, bool _enabled, int32_t _r)
{
m_widgetId++;
const uint16_t id = (m_areaId << 8) | m_widgetId;
@ -1112,13 +1112,25 @@ struct Imgui
const bool over = enabled && inRect(xx, yy, width, height);
inputLogic(id, over);
if (0 == _r)
{
drawRect( (float)xx
, (float)yy
, (float)width
, (float)height
, isActiveInputField(id)?imguiRGBA(255,196,0,255):imguiRGBA(128,128,128,96)
);
}
else
{
drawRoundedRect( (float)xx
, (float)yy
, (float)width
, (float)height
, (float)BUTTON_HEIGHT / 5 - 1
, (float)_r
, isActiveInputField(id)?imguiRGBA(255,196,0,255):imguiRGBA(128,128,128,96)
);
}
drawText(xx + 6
, yy + BUTTON_HEIGHT / 2 + TEXT_HEIGHT / 2
@ -2600,9 +2612,9 @@ bool imguiSlider(const char* _text, int32_t& _val, int32_t _vmin, int32_t _vmax,
return result;
}
void imguiInput(const char* _label, char* _str, uint32_t _len, bool _enabled)
void imguiInput(const char* _label, char* _str, uint32_t _len, bool _enabled, int32_t _r)
{
s_imgui.input(_label, _str, _len, _enabled);
s_imgui.input(_label, _str, _len, _enabled, _r);
}
uint8_t imguiTabsUseMacroInstead(uint8_t _selected, bool _enabled, ...)

View file

@ -107,7 +107,7 @@ 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);
void imguiInput(const char* _label, char* _str, uint32_t _len, bool _enabled = true);
void imguiInput(const char* _label, char* _str, uint32_t _len, bool _enabled = true, int32_t _r = 4);
uint8_t imguiTabsUseMacroInstead(uint8_t _selected, bool _enabled, ...);
uint8_t imguiTabsUseMacroInstead(uint8_t _selected, bool _enabled, int32_t _height, int32_t _r, ...);