diff --git a/examples/common/imgui/imgui.cpp b/examples/common/imgui/imgui.cpp index 76d45cab..a7c6201a 100644 --- a/examples/common/imgui/imgui.cpp +++ b/examples/common/imgui/imgui.cpp @@ -1457,12 +1457,12 @@ struct Imgui uint8_t ii = 0; for (; ii < enabledCount; ++ii) { - bool enabled = va_arg(_argList, int); + const bool enabled = (0 != va_arg(_argList, int) ); tabEnabled[ii] = enabled; } for (; ii < _nEnabled; ++ii) { - bool enabled = va_arg(_argList, int); + const int enabled = va_arg(_argList, int); BX_UNUSED(enabled); } for (; ii < _nTabs; ++ii) @@ -1524,7 +1524,7 @@ struct Imgui { const uint32_t id = getId(); - int32_t buttonX = xx + ii*tabWidth; + int32_t buttonX = xx + ii*width/tabCount; int32_t textX = buttonX + tabWidthHalf; const bool enabled = _enabled && tabEnabled[ii] && isEnabled(m_areaId); @@ -3258,6 +3258,16 @@ uint8_t imguiTabs(uint8_t _selected, bool _enabled, ImguiAlign::Enum _align, int return result; } +uint8_t imguiTabs(uint8_t _selected, bool _enabled, ImguiAlign::Enum _align, int32_t _height, int32_t _r, uint8_t _nTabs, ...) +{ + va_list argList; + va_start(argList, _nTabs); + const uint8_t result = s_imgui.tabs(_selected, _enabled, _align, _height, _r, _nTabs, 0, argList); + va_end(argList); + + return result; +} + uint32_t imguiChooseUseMacroInstead(uint32_t _selected, ...) { va_list argList; diff --git a/examples/common/imgui/imgui.h b/examples/common/imgui/imgui.h index fc8ec0bc..c48ccdc2 100644 --- a/examples/common/imgui/imgui.h +++ b/examples/common/imgui/imgui.h @@ -169,6 +169,7 @@ void imguiInput(const char* _label, char* _str, uint32_t _len, bool _enabled = t /// In the above example, there are 2 enabled flags: 'Tab0' is specified as enabled and 'Tab1' is specified as disabled. /// Tab2 is unspecified and therefore is treated as enabled. uint8_t imguiTabs(uint8_t _selected, bool _enabled, ImguiAlign::Enum _align, int32_t _height, int32_t _r, uint8_t _nTabs, uint8_t _nEnabled, ...); +uint8_t imguiTabs(uint8_t _selected, bool _enabled, ImguiAlign::Enum _align, int32_t _height, int32_t _r, uint8_t _nTabs, ...); uint32_t imguiChooseUseMacroInstead(uint32_t _selected, ...); #define imguiChoose(...) imguiChooseUseMacroInstead(__VA_ARGS__, NULL)