fix menu slider sounds

This commit is contained in:
hackgrid 2023-11-12 17:44:26 +01:00 committed by GitHub
parent 47ac5c663f
commit 3c2f6fe4e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -113,10 +113,9 @@ void sliderMenuItemInit(struct MenuBuilderElement* element) {
enum MenuDirection sliderMenuItemUpdate(struct MenuBuilderElement* element, MenuActionCalback actionCallback, void* data) {
struct MenuSlider* slider = (struct MenuSlider*)element->data;
if (element->params->params.slider.discrete) {
int controllerDir = controllerGetDirectionDown(0);
if (element->params->params.slider.discrete) {
int numTicks = element->params->params.slider.numberOfTicks;
int currentValue = (int)floorf(slider->value * (numTicks - 1));
int newValue = currentValue;
@ -197,6 +196,9 @@ enum MenuDirection sliderMenuItemUpdate(struct MenuBuilderElement* element, Menu
}
}
if (controllerGetButtonDown(0, L_JPAD | R_JPAD | A_BUTTON) || (element->params->params.slider.discrete && ((controllerDir & ControllerDirectionLeft) || (controllerDir & ControllerDirectionRight))))
soundPlayerPlay(SOUNDS_BUTTONCLICKRELEASE, 1.0f, 0.5f, NULL, NULL, SoundTypeAll);
return MenuDirectionStay;
}