mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Fixed the ear bleeding sound when using a slider with mouse controls
Now only ticks every 9 "ticks" unless the slider has less than 18 possible values..
This commit is contained in:
parent
43d520f692
commit
9996122749
|
|
@ -66,12 +66,44 @@ void UIControl_Slider::init(UIString label, int id, int min, int max, int curren
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsUsingKeyboardMouse()
|
||||||
|
{
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
|
||||||
|
if (g_KBMInput.IsKBMActive()) return true;
|
||||||
|
|
||||||
|
return g_KBMInput.HasAnyInput();
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void UIControl_Slider::handleSliderMove(int newValue)
|
void UIControl_Slider::handleSliderMove(int newValue)
|
||||||
{
|
{
|
||||||
if (m_current!=newValue)
|
if (m_current!=newValue)
|
||||||
{
|
{
|
||||||
ui.PlayUISFX(eSFX_Scroll);
|
int valueCount = 1;
|
||||||
m_current = newValue;
|
if (!m_allPossibleLabels.empty()) {
|
||||||
|
valueCount = static_cast<int>(m_allPossibleLabels.size());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
long long range = static_cast<long long>(m_max) - static_cast<long long>(m_min) + 1;
|
||||||
|
if (range <= 0) range = 1;
|
||||||
|
valueCount = static_cast<int>(range);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsUsingKeyboardMouse() == true) {
|
||||||
|
if (newValue % 9 == 0) {
|
||||||
|
ui.PlayUISFX(eSFX_Scroll);
|
||||||
|
m_current = newValue;
|
||||||
|
} else if (valueCount < 18) {
|
||||||
|
ui.PlayUISFX(eSFX_Scroll);
|
||||||
|
m_current = newValue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ui.PlayUISFX(eSFX_Scroll);
|
||||||
|
m_current = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
if(newValue < m_allPossibleLabels.size())
|
if(newValue < m_allPossibleLabels.size())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue