#include "ui_mod_menu.h" #include "recomp_ui.h" #include "zelda_support.h" #include "zelda_render.h" #include "librecomp/mods.hpp" #include #ifdef WIN32 #include #endif // TODO: // - Set up navigation. // - Add hover and active state for mod entries. namespace recompui { static std::string generate_thumbnail_src_for_mod(const std::string &mod_id) { return "?/mods/" + mod_id + "/thumb"; } static bool is_mod_enabled_or_auto(const std::string &mod_id) { return recomp::mods::is_mod_enabled(mod_id) || recomp::mods::is_mod_auto_enabled(mod_id); } // ModEntryView #define COL_TEXT_DEFAULT 242, 242, 242 #define COL_TEXT_DIM 204, 204, 204 #define COL_SECONDARY 23, 214, 232 constexpr float modEntryHeight = 120.0f; constexpr float modEntryPadding = 4.0f; extern const std::string mod_tab_id; const std::string mod_tab_id = "#tab_mods"; ModEntryView::ModEntryView(Element *parent) : Element(parent) { ContextId context = get_current_context(); set_display(Display::Flex); set_flex_direction(FlexDirection::Row); set_width(100.0f, Unit::Percent); set_height_auto(); set_padding(modEntryPadding); set_border_left_width(2.0f); set_border_color(Color{ COL_TEXT_DEFAULT, 12 }); set_background_color(Color{ COL_TEXT_DEFAULT, 12 }); set_cursor(Cursor::Pointer); set_color(Color{ COL_TEXT_DEFAULT, 255 }); checked_style.set_border_color(Color{ COL_TEXT_DEFAULT, 160 }); checked_style.set_color(Color{ 255, 255, 255, 255 }); checked_style.set_background_color(Color{ 26, 24, 32, 255 }); hover_style.set_border_color(Color{ COL_TEXT_DEFAULT, 64 }); checked_hover_style.set_border_color(Color{ COL_TEXT_DEFAULT, 255 }); { thumbnail_image = context.create_element(this, ""); thumbnail_image->set_width(modEntryHeight); thumbnail_image->set_height(modEntryHeight); thumbnail_image->set_min_width(modEntryHeight); thumbnail_image->set_min_height(modEntryHeight); thumbnail_image->set_background_color(Color{ 190, 184, 219, 25 }); body_container = context.create_element(this); body_container->set_width_auto(); body_container->set_margin_left(16.0f); body_container->set_padding_top(8.0f); body_container->set_padding_bottom(8.0f); body_container->set_max_height(modEntryHeight); body_container->set_overflow_y(Overflow::Hidden); { name_label = context.create_element