Skip to content

Commit

Permalink
Add some rounding to int-based slider
Browse files Browse the repository at this point in the history
  • Loading branch information
nullsystem committed Sep 8, 2024
1 parent 5f12b52 commit 4f41f46
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mp/src/game/client/neo/ui/neo_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,9 +845,13 @@ void Slider(const wchar_t *wszLeftLabel, float *flValue, const float flMin, cons

void SliderInt(const wchar_t *wszLeftLabel, int *iValue, const int iMin, const int iMax, const int iStep, const wchar_t *wszSpecialText)
{
float flValue = *iValue;
const float flOrigValue = *iValue;
float flValue = flOrigValue;
Slider(wszLeftLabel, &flValue, static_cast<float>(iMin), static_cast<float>(iMax), 0, static_cast<float>(iStep), wszSpecialText);
*iValue = static_cast<int>(flValue);
if (flValue != flOrigValue)
{
*iValue = RoundFloatToInt(flValue);
}
}

void TextEdit(const wchar_t *wszLeftLabel, wchar_t *wszText, const int iMaxSize)
Expand Down

0 comments on commit 4f41f46

Please sign in to comment.