mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp
synced 2026-05-23 23:05:46 -04:00
Convert to spaces, hook up mod enabled to toggle.
This commit is contained in:
+13
-2
@@ -69,8 +69,12 @@ void ModEntry::process_event(const Event& e) {
|
||||
}
|
||||
}
|
||||
|
||||
void ModMenu::set_active_mod(uint32_t mod_index) {
|
||||
mod_details_panel->set_mod_details(mod_details[mod_index]);
|
||||
void ModMenu::set_active_mod(int32_t mod_index) {
|
||||
active_mod_index = mod_index;
|
||||
if (active_mod_index >= 0) {
|
||||
bool mod_enabled = recomp::mods::is_mod_enabled(mod_details[mod_index].mod_id);
|
||||
mod_details_panel->set_mod_details(mod_details[mod_index], mod_enabled);
|
||||
}
|
||||
}
|
||||
|
||||
void ModMenu::refresh_mods() {
|
||||
@@ -79,6 +83,12 @@ void ModMenu::refresh_mods() {
|
||||
create_mod_list();
|
||||
}
|
||||
|
||||
void ModMenu::mod_toggled(bool enabled) {
|
||||
if (active_mod_index >= 0) {
|
||||
recomp::mods::enable_mod(mod_details[active_mod_index].mod_id, enabled);
|
||||
}
|
||||
}
|
||||
|
||||
void ModMenu::create_mod_list() {
|
||||
// Clear the contents of the list scroll.
|
||||
list_scroll_container->clear_children();
|
||||
@@ -121,6 +131,7 @@ ModMenu::ModMenu(Element *parent) : Element(parent) {
|
||||
} // list_container
|
||||
|
||||
mod_details_panel = new ModDetailsPanel(body_container);
|
||||
mod_details_panel->set_mod_toggled_callback(std::bind(&ModMenu::mod_toggled, this, std::placeholders::_1));
|
||||
} // body_container
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user