mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-31 17:01:36 -04:00
945ce3e4bc
* Alternate RMLUI Menu Sounds Those fit more the game I feel like. * swapped tab sounds * pressing A on tab button plays the OK sound * Fix tab sound + Added menu sounds to prelaunch menu * Centralize UI sound definitions * Improvements * Add "Play" button sound * Use kSoundItemFocus in prelaunch * Oops * Update play/enable/disable sounds --------- Co-authored-by: MelonSpeedruns <melonspeedruns@stratobox.net> Co-authored-by: Luke Street <luke@street.dev>
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
#include "bool_button.hpp"
|
|
|
|
#include "Z2AudioLib/Z2SeMgr.h"
|
|
#include "m_Do/m_Do_audio.h"
|
|
|
|
namespace dusk::ui {
|
|
|
|
BoolButton::BoolButton(Rml::Element* parent, Props props)
|
|
: BaseControlledSelectButton(parent,
|
|
{
|
|
.key = std::move(props.key),
|
|
.icon = std::move(props.icon),
|
|
}),
|
|
mGetValue(std::move(props.getValue)), mSetValue(std::move(props.setValue)),
|
|
mIsDisabled(std::move(props.isDisabled)), mIsModified(std::move(props.isModified)) {}
|
|
|
|
bool BoolButton::modified() const {
|
|
if (mIsModified) {
|
|
return mIsModified();
|
|
}
|
|
return BaseControlledSelectButton::modified();
|
|
}
|
|
|
|
bool BoolButton::disabled() const {
|
|
if (mIsDisabled) {
|
|
return mIsDisabled();
|
|
}
|
|
return BaseControlledSelectButton::disabled();
|
|
}
|
|
|
|
Rml::String BoolButton::format_value() {
|
|
return mGetValue() ? "On" : "Off";
|
|
}
|
|
|
|
bool BoolButton::handle_nav_command(NavCommand cmd) {
|
|
if (cmd == NavCommand::Confirm || cmd == NavCommand::Left || cmd == NavCommand::Right) {
|
|
const bool newValue = !mGetValue();
|
|
mSetValue(newValue);
|
|
mDoAud_seStartMenu(newValue ? kSoundItemEnable : kSoundItemDisable);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
} // namespace dusk::ui
|