Alternate RMLUI Menu Sounds (#686)

* 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>
This commit is contained in:
MelonSpeedruns
2026-05-05 18:44:11 -04:00
committed by GitHub
parent 782a8573e9
commit 945ce3e4bc
18 changed files with 142 additions and 44 deletions
+2 -2
View File
@@ -65,7 +65,7 @@ public:
btn.on_nav_command([this, key = std::string(a.key)](Rml::Event&, NavCommand cmd) {
if (cmd == NavCommand::Confirm) {
if (mConfirming) {
mDoAud_seStartMenu(Z2SE_SY_CURSOR_OK);
mDoAud_seStartMenu(kSoundClick);
AchievementSystem::get().clearOne(key.c_str());
resetConfirm();
} else {
@@ -158,7 +158,7 @@ AchievementsWindow::AchievementsWindow() {
clearAllBtn.on_nav_command([clearAllPtr, confirmingAll](Rml::Event&, NavCommand cmd) {
if (cmd == NavCommand::Confirm) {
if (*confirmingAll) {
mDoAud_seStartMenu(Z2SE_SY_CURSOR_OK);
mDoAud_seStartMenu(kSoundClick);
AchievementSystem::get().clearAll();
*confirmingAll = false;
clearAllPtr->set_text("Clear All Achievements");
+1 -1
View File
@@ -36,7 +36,7 @@ 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 ? Z2SE_SY_CURSOR_OK : Z2SE_SY_CURSOR_CANCEL);
mDoAud_seStartMenu(newValue ? kSoundItemEnable : kSoundItemDisable);
return true;
}
return false;
-1
View File
@@ -37,7 +37,6 @@ Button& Button::on_pressed(ButtonCallback callback) {
// TODO: convert this to a FluentComponent method?
on_nav_command([callback = std::move(callback)](Rml::Event&, NavCommand cmd) {
if (cmd == NavCommand::Confirm) {
mDoAud_seStartMenu(Z2SE_SY_CURSOR_OK);
callback();
return true;
}
+2
View File
@@ -322,6 +322,7 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
.isSelected = [port] { return PADGetIndexForPort(port) < 0; },
})
.on_pressed([this, port] {
mDoAud_seStartMenu(kSoundItemChange);
cancel_pending_binding();
PADClearPort(port);
PADSerializeMappings();
@@ -335,6 +336,7 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
[port, i] { return PADGetIndexForPort(port) == static_cast<s32>(i); },
})
.on_pressed([this, port, i] {
mDoAud_seStartMenu(kSoundItemChange);
cancel_pending_binding();
PADSetPortForIndex(i, port);
PADSerializeMappings();
+1 -8
View File
@@ -44,15 +44,8 @@ Document::Document(const Rml::String& source) : mDocument(load_document(source))
if (cmd == NavCommand::None) {
return;
}
auto* prevFocused = mDocument->GetFocusLeafNode();
if (handle_nav_command(event, cmd)) {
event.StopPropagation();
return;
}
if ((cmd == NavCommand::Up || cmd == NavCommand::Down) &&
mDocument->GetFocusLeafNode() != prevFocused)
{
mDoAud_seStartMenu(Z2SE_SY_NAME_CURSOR);
}
});
}
@@ -113,7 +106,7 @@ bool Document::visible() const {
bool Document::handle_nav_command(Rml::Event& event, NavCommand cmd) {
if (cmd == NavCommand::Menu) {
mDoAud_seStartMenu(visible() ? Z2SE_SY_MENU_OUT : Z2SE_SY_MENU_IN);
mDoAud_seStartMenu(visible() ? kSoundMenuClose : kSoundMenuOpen);
toggle();
return true;
}
+76 -17
View File
@@ -185,7 +185,10 @@ void populate_stage_picker(Pane& pane, std::function<Rml::String()> getStageFile
return getStageFile() == stageFile;
},
})
.on_pressed([setStageFile, stageFile = map.mapFile] { setStageFile(stageFile); });
.on_pressed([setStageFile, stageFile = map.mapFile] {
mDoAud_seStartMenu(kSoundItemChange);
setStageFile(stageFile);
});
}
}
}
@@ -741,11 +744,13 @@ void populate_toggle_group(Pane& pane, const std::vector<ToggleEntry>& entries)
pane.clear();
pane.add_section("Actions");
pane.add_button("Select All").on_pressed([entries] {
mDoAud_seStartMenu(kSoundItemChange);
for (const auto& entry : entries) {
entry.setSelected(true);
}
});
pane.add_button("Select None").on_pressed([entries] {
mDoAud_seStartMenu(kSoundItemChange);
for (const auto& entry : entries) {
entry.setSelected(false);
}
@@ -758,6 +763,7 @@ void populate_toggle_group(Pane& pane, const std::vector<ToggleEntry>& entries)
.isSelected = entry.isSelected,
})
.on_pressed([isSelected = entry.isSelected, setSelected = entry.setSelected] {
mDoAud_seStartMenu(kSoundItemChange);
setSelected(!isSelected());
});
}
@@ -878,7 +884,10 @@ void populate_item_slot_picker(Pane& pane, int slot) {
pane.clear();
pane.add_section("Actions");
pane.add_button(fmt::format("Default ({})", get_item_name(get_slot_default(slot))))
.on_pressed([slot] { dComIfGs_setItem(slot, get_slot_default(slot)); });
.on_pressed([slot] {
mDoAud_seStartMenu(kSoundItemChange);
dComIfGs_setItem(slot, get_slot_default(slot));
});
pane.add_section("Items");
pane.add_button(
@@ -886,7 +895,10 @@ void populate_item_slot_picker(Pane& pane, int slot) {
.text = "None",
.isSelected = [slot] { return get_player_item()->mItems[slot] == dItemNo_NONE_e; },
})
.on_pressed([slot] { dComIfGs_setItem(slot, dItemNo_NONE_e); });
.on_pressed([slot] {
mDoAud_seStartMenu(kSoundItemChange);
dComIfGs_setItem(slot, dItemNo_NONE_e);
});
for (const auto& [itemId, item] : itemMap) {
if (item.m_type != ITEMTYPE_EQUIP_e) {
continue;
@@ -896,15 +908,24 @@ void populate_item_slot_picker(Pane& pane, int slot) {
.text = item.m_name,
.isSelected = [slot, itemId] { return get_player_item()->mItems[slot] == itemId; },
})
.on_pressed([slot, itemId] { dComIfGs_setItem(slot, static_cast<u8>(itemId)); });
.on_pressed([slot, itemId] {
mDoAud_seStartMenu(kSoundItemChange);
dComIfGs_setItem(slot, static_cast<u8>(itemId));
});
}
}
void populate_item_flag_picker(Pane& pane) {
pane.clear();
pane.add_section("Actions");
pane.add_button("Select All").on_pressed([] { set_all_item_first_bits(true); });
pane.add_button("Clear None").on_pressed([] { set_all_item_first_bits(false); });
pane.add_button("Select All").on_pressed([] {
mDoAud_seStartMenu(kSoundItemChange);
set_all_item_first_bits(true);
});
pane.add_button("Clear None").on_pressed([] {
mDoAud_seStartMenu(kSoundItemChange);
set_all_item_first_bits(false);
});
pane.add_section("Items");
for (const auto& [itemId, item] : itemMap) {
@@ -916,7 +937,10 @@ void populate_item_flag_picker(Pane& pane) {
.text = item.m_name,
.isSelected = [itemId] { return dComIfGs_isItemFirstBit(static_cast<u8>(itemId)); },
})
.on_pressed([itemId] { toggle_item_first_bit(static_cast<u8>(itemId)); });
.on_pressed([itemId] {
mDoAud_seStartMenu(kSoundItemChange);
toggle_item_first_bit(static_cast<u8>(itemId));
});
}
}
@@ -927,13 +951,19 @@ void populate_select_item_picker(Pane& pane, u8& selectItemData) {
.text = "None",
.isSelected = [&selectItemData] { return selectItemData == dItemNo_NONE_e; },
})
.on_pressed([&selectItemData] { selectItemData = dItemNo_NONE_e; });
.on_pressed([&selectItemData] {
mDoAud_seStartMenu(kSoundItemChange);
selectItemData = dItemNo_NONE_e;
});
for (int i = 0; i < 24; i++) {
pane.add_button({
.text = item_label_for_slot(i),
.isSelected = [i, &selectItemData] { return selectItemData == i; },
})
.on_pressed([i, &selectItemData] { selectItemData = i; });
.on_pressed([i, &selectItemData] {
mDoAud_seStartMenu(kSoundItemChange);
selectItemData = i;
});
}
}
@@ -946,6 +976,7 @@ void populate_select_clothes_picker(Pane& pane) {
.isSelected = [id] { return get_player_status()->mSelectEquip[0] == id; },
})
.on_pressed([id] {
mDoAud_seStartMenu(kSoundItemChange);
dMeter2Info_setCloth(id, false);
daPy_getPlayerActorClass()->setClothesChange(0);
});
@@ -964,7 +995,10 @@ void populate_select_equip_picker(Pane& pane, u8& equip, const std::array<u8, Si
.text = get_item_name(id),
.isSelected = [id, &equip] { return equip == id; },
})
.on_pressed([id, &equip] { equip = id; });
.on_pressed([id, &equip] {
mDoAud_seStartMenu(kSoundItemChange);
equip = id;
});
};
addOption(dItemNo_NONE_e);
for (const auto item : entries) {
@@ -985,7 +1019,10 @@ void populate_wallet_picker(Pane& pane) {
.text = walletSizeNames[i],
.isSelected = [i] { return get_player_status()->getWalletSize() == i; },
})
.on_pressed([i] { get_player_status()->setWalletSize(i); });
.on_pressed([i] {
mDoAud_seStartMenu(kSoundItemChange);
get_player_status()->setWalletSize(i);
});
}
}
@@ -1002,7 +1039,10 @@ void populate_form_picker(Pane& pane) {
.text = formNames[i],
.isSelected = [i] { return get_player_status()->getTransformStatus() == i; },
})
.on_pressed([i] { get_player_status()->setTransformStatus(i); });
.on_pressed([i] {
mDoAud_seStartMenu(kSoundItemChange);
get_player_status()->setTransformStatus(i);
});
}
}
@@ -1013,7 +1053,10 @@ void add_toggle_button(Pane& pane, ToggleEntry entry) {
.text = entry.text,
.isSelected = isSelected,
})
.on_pressed([isSelected, setSelected] { setSelected(!isSelected()); });
.on_pressed([isSelected, setSelected] {
mDoAud_seStartMenu(kSoundItemChange);
setSelected(!isSelected());
});
}
template <size_t Size>
@@ -1126,8 +1169,14 @@ void populate_collect_clothes_picker(Pane& pane) {
void populate_poe_souls_picker(Pane& pane) {
pane.clear();
pane.add_section("Actions");
pane.add_button("All 60").on_pressed([] { dComIfGs_setPohSpiritNum(60); });
pane.add_button("Clear").on_pressed([] { dComIfGs_setPohSpiritNum(0); });
pane.add_button("All 60").on_pressed([] {
mDoAud_seStartMenu(kSoundItemChange);
dComIfGs_setPohSpiritNum(60);
});
pane.add_button("Clear").on_pressed([] {
mDoAud_seStartMenu(kSoundItemChange);
dComIfGs_setPohSpiritNum(0);
});
pane.add_section("Value");
pane.add_child<NumberButton>(NumberButton::Props{
@@ -1143,10 +1192,12 @@ void populate_max_life_picker(Pane& pane) {
pane.clear();
pane.add_section("Actions");
pane.add_button("3 Hearts").on_pressed([] {
mDoAud_seStartMenu(kSoundItemChange);
dComIfGs_setMaxLife(15);
dComIfGs_setLife(12);
});
pane.add_button("20 Hearts").on_pressed([] {
mDoAud_seStartMenu(kSoundItemChange);
dComIfGs_setMaxLife(100);
dComIfGs_setLife(80);
});
@@ -1257,7 +1308,10 @@ void populate_target_type_picker(Pane& pane) {
.text = targetTypeNames[type],
.isSelected = [type] { return get_player_config()->getAttentionType() == type; },
})
.on_pressed([type] { get_player_config()->setAttentionType(type); });
.on_pressed([type] {
mDoAud_seStartMenu(kSoundItemChange);
get_player_config()->setAttentionType(type);
});
}
}
@@ -1269,7 +1323,10 @@ void populate_sound_mode_picker(Pane& pane) {
.text = soundModeNames[mode],
.isSelected = [mode] { return get_player_config()->getSound() == mode; },
})
.on_pressed([mode] { get_player_config()->setSound(mode); });
.on_pressed([mode] {
mDoAud_seStartMenu(kSoundItemChange);
get_player_config()->setSound(mode);
});
}
}
@@ -1594,6 +1651,7 @@ EditorWindow::EditorWindow() {
leftPane.add_section("Item Wheel");
leftPane.register_control(leftPane.add_button("Default All").on_pressed([&rightPane] {
mDoAud_seStartMenu(kSoundItemChange);
for (int slot = 0; slot < 24; ++slot) {
dComIfGs_setItem(slot, get_slot_default(slot));
}
@@ -1601,6 +1659,7 @@ EditorWindow::EditorWindow() {
}),
rightPane, {});
leftPane.register_control(leftPane.add_button("Clear All").on_pressed([&rightPane] {
mDoAud_seStartMenu(kSoundItemChange);
for (int slot = 0; slot < 24; ++slot) {
dComIfGs_setItem(slot, dItemNo_NONE_e);
}
+2 -2
View File
@@ -44,7 +44,7 @@ void Modal::dismiss() {
bool Modal::handle_nav_command(Rml::Event& event, NavCommand cmd) {
if (cmd == NavCommand::Cancel || cmd == NavCommand::Menu) {
mDoAud_seStartMenu(Z2SE_SY_CURSOR_CANCEL);
mDoAud_seStartMenu(kSoundWindowClose);
dismiss();
return true;
}
@@ -63,7 +63,7 @@ bool Modal::handle_nav_command(Rml::Event& event, NavCommand cmd) {
if (mButtons[i]->contains(target)) {
const int next = i + direction;
if (next >= 0 && next < static_cast<int>(mButtons.size()) && mButtons[next]->focus()) {
mDoAud_seStartMenu(Z2SE_SY_NAME_CURSOR);
mDoAud_seStartMenu(kSoundItemFocus);
return true;
}
return false;
+1 -1
View File
@@ -59,7 +59,7 @@ bool NumberButton::handle_nav_command(NavCommand cmd) {
mGetValue() + (cmd == NavCommand::Right ? mStep : -mStep), mMin, mMax);
if (newValue != mGetValue()) {
mSetValue(newValue);
mDoAud_seStartMenu(Z2SE_SY_NAME_CURSOR);
mDoAud_seStartMenu(kSoundItemChange);
}
return true;
}
+4 -2
View File
@@ -149,7 +149,7 @@ void SteppedCarousel::apply(int value) {
if (nextValue == currentValue) {
return;
}
mDoAud_seStartMenu(Z2SE_SY_NAME_CURSOR);
mDoAud_seStartMenu(kSoundItemChange);
if (mProps.onChange) {
mProps.onChange(nextValue);
}
@@ -216,6 +216,7 @@ Overlay::Overlay(OverlayProps props)
returnButton.root()->SetClass("return", true);
auto& resetButton =
add_component<Button>(footer, "Reset to default", "footer-button").on_pressed([this] {
mDoAud_seStartMenu(kSoundItemChange);
reset_default();
});
resetButton.root()->SetClass("reset", true);
@@ -233,15 +234,16 @@ Overlay::Overlay(OverlayProps props)
}
void Overlay::show() {
mDoAud_seStartMenu(Z2SE_SY_CURSOR_OK);
Document::show();
mRoot->SetAttribute("open", "");
mDoAud_seStartMenu(kSoundWindowOpen);
}
void Overlay::hide(bool close) {
mRoot->RemoveAttribute("open");
if (close) {
mPendingClose = true;
mDoAud_seStartMenu(kSoundWindowClose);
}
}
+1 -1
View File
@@ -58,7 +58,7 @@ Pane::Pane(Rml::Element* parent, Type type) : FluentComponent(createRoot(parent)
int i = focusedChild + direction;
while (i >= 0 && i < mChildren.size()) {
if (mChildren[i]->focus()) {
mDoAud_seStartMenu(Z2SE_SY_NAME_CURSOR);
mDoAud_seStartMenu(kSoundItemFocus);
event.StopPropagation();
break;
}
+6 -2
View File
@@ -39,7 +39,11 @@ const Rml::String kDocumentSource = R"RML(
Popup::Popup() : Document(kDocumentSource), mRoot(mDocument->GetElementById("popup")) {
mTabBar = std::make_unique<TabBar>(mRoot, TabBar::Props{
.onClose = [this] { hide(false); },
.onClose =
[this] {
mDoAud_seStartMenu(kSoundMenuClose);
hide(false);
},
.autoSelect = false,
});
mTabBar->add_tab("Settings", [this] { push(std::make_unique<SettingsWindow>()); });
@@ -137,7 +141,7 @@ bool Popup::handle_nav_command(Rml::Event& event, NavCommand cmd) {
return true;
}
if (cmd == NavCommand::Cancel && visible()) {
mDoAud_seStartMenu(Z2SE_SY_MENU_OUT);
mDoAud_seStartMenu(kSoundMenuClose);
hide(false);
return true;
}
+3
View File
@@ -178,6 +178,8 @@ Prelaunch::Prelaunch() : Document(kDocumentSource), mRoot(mDocument->GetElementB
return;
}
mDoAud_seStartMenu(kSoundPlay);
if (getSettings().audio.menuSounds) {
JAISoundHandle* handle = g_mEnvSeMgr.field_0x144.getHandle();
if (*handle) {
@@ -385,6 +387,7 @@ bool Prelaunch::handle_nav_command(Rml::Event& event, NavCommand cmd) {
int i = ((focusedButton + direction) % n + n) % n;
while (i >= 0 && i < mMenuButtons.size()) {
if (mMenuButtons[i]->focus()) {
mDoAud_seStartMenu(kSoundItemFocus);
event.StopPropagation();
return true;
}
+1 -1
View File
@@ -127,7 +127,7 @@ bool PresetWindow::handle_nav_command(Rml::Event& event, NavCommand cmd) {
const int next = i + direction;
if (next >= 0 && next < static_cast<int>(mButtons.size())) {
if (mButtons[next]->focus()) {
mDoAud_seStartMenu(Z2SE_SY_NAME_CURSOR);
mDoAud_seStartMenu(kSoundItemFocus);
return true;
}
}
+5
View File
@@ -362,6 +362,7 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
},
})
.on_pressed([i] {
mDoAud_seStartMenu(kSoundItemChange);
getSettings().game.language.setValue(static_cast<GameLanguage>(i));
config::Save();
});
@@ -387,6 +388,7 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
.isSelected = [backend] { return configured_backend() == backend; },
})
.on_pressed([backend] {
mDoAud_seStartMenu(kSoundItemChange);
getSettings().backend.graphicsBackend.setValue(
std::string{backend_id(backend)});
config::Save();
@@ -418,6 +420,7 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
},
})
.on_pressed([i] {
mDoAud_seStartMenu(kSoundItemChange);
getSettings().backend.cardFileType.setValue(i);
config::Save();
});
@@ -433,12 +436,14 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
leftPane.add_section("Display");
leftPane.register_control(leftPane.add_button("Toggle Fullscreen").on_pressed([] {
mDoAud_seStartMenu(kSoundItemChange);
getSettings().video.enableFullscreen.setValue(!getSettings().video.enableFullscreen);
VISetWindowFullscreen(getSettings().video.enableFullscreen);
config::Save();
}),
rightPane, [](Pane& pane) { pane.clear(); });
leftPane.register_control(leftPane.add_button("Restore Default Window Size").on_pressed([] {
mDoAud_seStartMenu(kSoundItemChange);
getSettings().video.enableFullscreen.setValue(false);
VISetWindowFullscreen(false);
VISetWindowSize(FB_WIDTH * 2, FB_HEIGHT * 2);
+4 -3
View File
@@ -47,7 +47,6 @@ TabBar::TabBar(Rml::Element* parent, Props props)
add_child<Button>(Button::Props{}, "close")
.on_nav_command([this](Rml::Event&, NavCommand cmd) {
if (cmd == NavCommand::Confirm) {
mDoAud_seStartMenu(Z2SE_SY_CURSOR_CANCEL);
mProps.onClose();
return true;
}
@@ -119,7 +118,9 @@ void TabBar::add_tab(const Rml::String& title, TabCallback callback) {
auto& button = add_child<Button>(Button::Props{title}, "tab");
button.on_nav_command([this, index](Rml::Event&, NavCommand cmd) {
if (cmd == NavCommand::Confirm) {
mDoAud_seStartMenu(mProps.autoSelect ? Z2SE_SY_NAME_CURSOR : Z2SE_SY_CURSOR_OK);
if (mProps.autoSelect) {
mDoAud_seStartMenu(kSoundTabChanged);
}
set_active_tab(index);
return true;
}
@@ -229,7 +230,7 @@ bool TabBar::handle_nav_command(Rml::Event& event, NavCommand cmd) {
while (i >= 0 && i < mTabs.size()) {
const bool changed = mProps.autoSelect ? set_active_tab(i) : focus_tab(i);
if (changed) {
mDoAud_seStartMenu(Z2SE_SY_NAME_CURSOR);
mDoAud_seStartMenu(kSoundTabChanged);
return true;
}
i += direction;
+25
View File
@@ -14,6 +14,31 @@ namespace dusk::ui {
class Document;
class Popup;
// Button clicked/pressed
constexpr u32 kSoundClick = Z2SE_SY_CURSOR_OK;
// "Play" button clicked/pressed
constexpr u32 kSoundPlay = Z2SE_SY_ITEM_COMBINE_ON;
// Menu button pressed (open/close menu bar or hide/show the active window)
constexpr u32 kSoundMenuOpen = Z2SE_SY_MENU_SUB_IN;
constexpr u32 kSoundMenuClose = Z2SE_SY_MENU_SUB_OUT;
// Window opened/closed
constexpr u32 kSoundWindowOpen = Z2SE_SY_MENU_NEXT;
constexpr u32 kSoundWindowClose = Z2SE_SY_MENU_BACK;
// Window tab changed
constexpr u32 kSoundTabChanged = Z2SE_SY_MENU_CURSOR_COMMON;
// Item within menu focused
constexpr u32 kSoundItemFocus = Z2SE_SY_CURSOR_ITEM;
// Item changed (e.g. number input left/right)
constexpr u32 kSoundItemChange = Z2SE_SY_NAME_CURSOR;
// Item enabled ("On")
constexpr u32 kSoundItemEnable = Z2SE_SUBJ_VIEW_IN;
// Item disabled ("Off")
constexpr u32 kSoundItemDisable = Z2SE_SUBJ_VIEW_OUT;
struct Insets {
float top = 0.0f;
float right = 0.0f;
+7 -3
View File
@@ -106,6 +106,10 @@ Window::Window() : Document(kDocumentSource), mRoot(mDocument->GetElementById("w
void Window::show() {
Document::show();
mRoot->SetAttribute("open", "");
if (mInitialOpen) {
mDoAud_seStartMenu(kSoundWindowOpen);
mInitialOpen = false;
}
}
void Window::hide(bool close) {
@@ -156,6 +160,7 @@ bool Window::set_active_tab(int index) {
void Window::request_close() {
if (!consume_close_request()) {
mDoAud_seStartMenu(kSoundWindowClose);
pop();
}
}
@@ -201,12 +206,11 @@ bool Window::handle_nav_command(Rml::Event& event, NavCommand cmd) {
}
if (cmd == NavCommand::Confirm || cmd == NavCommand::Down) {
if (!mContentComponents.empty() && mContentComponents.front()->focus()) {
mDoAud_seStartMenu(Z2SE_SY_NAME_CURSOR);
mDoAud_seStartMenu(kSoundItemFocus);
return true;
}
}
if (cmd == NavCommand::Cancel) {
mDoAud_seStartMenu(Z2SE_SY_CURSOR_CANCEL);
request_close();
return true;
}
@@ -219,7 +223,7 @@ bool Window::handle_nav_command(Rml::Event& event, NavCommand cmd) {
bool Window::handle_content_nav(Rml::Event& event, NavCommand cmd) noexcept {
if (cmd == NavCommand::Up) {
if (focus()) {
mDoAud_seStartMenu(Z2SE_SY_NAME_CURSOR);
mDoAud_seStartMenu(kSoundItemFocus);
return true;
}
return false;
+1
View File
@@ -54,6 +54,7 @@ protected:
std::unique_ptr<TabBar> mTabBar;
std::vector<std::unique_ptr<Component> > mContentComponents;
Insets mBodyPadding;
bool mInitialOpen = true;
};
// Shared shell for small-style windows such as Modal and PresetWindow