diff --git a/Makefile b/Makefile index d8cf4edf..ed086203 100644 --- a/Makefile +++ b/Makefile @@ -41,11 +41,11 @@ SRCS = \ libs/miniz/miniz.c \ menu/actions.c \ menu/cart_load.c \ - menu/components/background.c \ - menu/components/boxart.c \ - menu/components/common.c \ - menu/components/context_menu.c \ - menu/components/file_list.c \ + menu/ui_components/background.c \ + menu/ui_components/boxart.c \ + menu/ui_components/common.c \ + menu/ui_components/context_menu.c \ + menu/ui_components/file_list.c \ menu/disk_info.c \ menu/fonts.c \ menu/hdmi.c \ diff --git a/src/menu/menu.c b/src/menu/menu.c index 5e2b2168..91a51a09 100644 --- a/src/menu/menu.c +++ b/src/menu/menu.c @@ -87,7 +87,7 @@ static void menu_init (boot_params_t *boot_params) { directory_create(path_get(path)); path_push(path, BACKGROUND_CACHE_FILE); - component_background_init(path_get(path)); + ui_components_background_init(path_get(path)); path_free(path); @@ -103,7 +103,7 @@ static void menu_init (boot_params_t *boot_params) { static void menu_deinit (menu_t *menu) { hdmi_send_game_id(menu->boot_params); - component_background_free(); + ui_components_background_free(); path_free(menu->load.disk_path); path_free(menu->load.rom_path); diff --git a/src/menu/components.h b/src/menu/ui_components.h similarity index 75% rename from src/menu/components.h rename to src/menu/ui_components.h index f15a6ba5..f0dc6060 100644 --- a/src/menu/components.h +++ b/src/menu/ui_components.h @@ -1,24 +1,20 @@ /** - * @file components.h + * @file ui_components.h * @brief Menu Graphical User Interface Components * @ingroup menu */ -#ifndef COMPONENTS_H__ -#define COMPONENTS_H__ +#ifndef UI_COMPONENTS_H__ +#define UI_COMPONENTS_H__ #include #include "menu_state.h" -/** - * @addtogroup menu_ui_components - * @{ - */ /** * @brief File image Enumeration. * - * Enumeration for different types of file images used in the GUI. + * Enumeration for different types of file images used in the user interface. */ typedef enum { IMAGE_BOXART_FRONT, /**< Boxart image from the front */ @@ -42,7 +38,7 @@ typedef enum { * @param y1 Ending y-coordinate. * @param color Color of the box. */ -void component_box_draw(int x0, int y0, int x1, int y1, color_t color); +void ui_components_box_draw(int x0, int y0, int x1, int y1, color_t color); /** * @brief Draw a border component. @@ -52,12 +48,12 @@ void component_box_draw(int x0, int y0, int x1, int y1, color_t color); * @param x1 Ending x-coordinate. * @param y1 Ending y-coordinate. */ -void component_border_draw(int x0, int y0, int x1, int y1); +void ui_components_border_draw(int x0, int y0, int x1, int y1); /** * @brief Draw the layout component. */ -void component_layout_draw(void); +void ui_components_layout_draw(void); /** * @brief Draw a progress bar component. @@ -68,21 +64,21 @@ void component_layout_draw(void); * @param y1 Ending y-coordinate. * @param progress Progress value (0.0 to 1.0). */ -void component_progressbar_draw(int x0, int y0, int x1, int y1, float progress); +void ui_components_progressbar_draw(int x0, int y0, int x1, int y1, float progress); /** * @brief Draw a seek bar component. * * @param progress Progress value (0.0 to 1.0). */ -void component_seekbar_draw(float progress); +void ui_components_seekbar_draw(float progress); /** * @brief Draw a loader component. * * @param position Position value (0.0 to 1.0). */ -void component_loader_draw(float position); +void ui_components_loader_draw(float position); /** * @brief Draw a scrollbar component. @@ -95,7 +91,7 @@ void component_loader_draw(float position); * @param items Total number of items. * @param visible_items Number of visible items. */ -void component_scrollbar_draw(int x, int y, int width, int height, int position, int items, int visible_items); +void ui_components_scrollbar_draw(int x, int y, int width, int height, int position, int items, int visible_items); /** * @brief Draw a list scrollbar component. @@ -104,7 +100,7 @@ void component_scrollbar_draw(int x, int y, int width, int height, int position, * @param items Total number of items. * @param visible_items Number of visible items. */ -void component_list_scrollbar_draw(int position, int items, int visible_items); +void ui_components_list_scrollbar_draw(int position, int items, int visible_items); /** * @brief Draw a dialog component. @@ -112,7 +108,7 @@ void component_list_scrollbar_draw(int position, int items, int visible_items); * @param width Width of the dialog. * @param height Height of the dialog. */ -void component_dialog_draw(int width, int height); +void ui_components_dialog_draw(int width, int height); /** * @brief Draw a message box component. @@ -120,7 +116,7 @@ void component_dialog_draw(int width, int height); * @param fmt Format string for the message. * @param ... Additional arguments for the format string. */ -void component_messagebox_draw(char *fmt, ...); +void ui_components_messagebox_draw(char *fmt, ...); /** * @brief Draw the main text component. @@ -130,7 +126,7 @@ void component_messagebox_draw(char *fmt, ...); * @param fmt Format string for the text. * @param ... Additional arguments for the format string. */ -void component_main_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...); +void ui_components_main_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...); /** * @brief Draw the actions bar text component. @@ -140,31 +136,31 @@ void component_main_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fm * @param fmt Format string for the text. * @param ... Additional arguments for the format string. */ -void component_actions_bar_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...); +void ui_components_actions_bar_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...); /** * @brief Initialize the background component. * * @param cache_location Location of the cache. */ -void component_background_init(char *cache_location); +void ui_components_background_init(char *cache_location); /** * @brief Free the background component resources. */ -void component_background_free(void); +void ui_components_background_free(void); /** * @brief Replace the background image. * * @param image New background image. */ -void component_background_replace_image(surface_t *image); +void ui_components_background_replace_image(surface_t *image); /** * @brief Draw the background component. */ -void component_background_draw(void); +void ui_components_background_draw(void); /** * @brief Draw the file list component. @@ -173,7 +169,7 @@ void component_background_draw(void); * @param entries Number of entries. * @param selected Index of the selected entry. */ -void component_file_list_draw(entry_t *list, int entries, int selected); +void ui_components_file_list_draw(entry_t *list, int entries, int selected); /** * @brief Context menu structure. @@ -199,14 +195,14 @@ typedef struct component_context_menu { * * @param cm Pointer to the context menu structure. */ -void component_context_menu_init(component_context_menu_t *cm); +void ui_components_context_menu_init(component_context_menu_t *cm); /** * @brief Show the context menu component. * * @param cm Pointer to the context menu structure. */ -void component_context_menu_show(component_context_menu_t *cm); +void ui_components_context_menu_show(component_context_menu_t *cm); /** * @brief Process the context menu component. @@ -215,14 +211,14 @@ void component_context_menu_show(component_context_menu_t *cm); * @param cm Pointer to the context menu structure. * @return True if the context menu was processed, false otherwise. */ -bool component_context_menu_process(menu_t *menu, component_context_menu_t *cm); +bool ui_components_context_menu_process(menu_t *menu, component_context_menu_t *cm); /** * @brief Draw the context menu component. * * @param cm Pointer to the context menu structure. */ -void component_context_menu_draw(component_context_menu_t *cm); +void ui_components_context_menu_draw(component_context_menu_t *cm); /** * @brief Box Art Structure. @@ -240,22 +236,20 @@ typedef struct { * @param current_image_view Current image view type. * @return Pointer to the initialized box art component. */ -component_boxart_t *component_boxart_init(const char *storage_prefix, char *game_code, file_image_type_t current_image_view); +component_boxart_t *ui_components_boxart_init(const char *storage_prefix, char *game_code, file_image_type_t current_image_view); /** * @brief Free the box art component resources. * * @param b Pointer to the box art component. */ -void component_boxart_free(component_boxart_t *b); +void ui_components_boxart_free(component_boxart_t *b); /** * @brief Draw the box art component. * * @param b Pointer to the box art component. */ -void component_boxart_draw(component_boxart_t *b); - -/** @} */ /* menu_ui_components */ +void ui_components_boxart_draw(component_boxart_t *b); -#endif /* COMPONENTS_H__ */ +#endif /* UI_COMPONENTS_H__ */ diff --git a/src/menu/components/background.c b/src/menu/ui_components/background.c similarity index 95% rename from src/menu/components/background.c rename to src/menu/ui_components/background.c index 525fb0c8..548bc0f0 100644 --- a/src/menu/components/background.c +++ b/src/menu/ui_components/background.c @@ -1,7 +1,7 @@ #include #include -#include "../components.h" +#include "../ui_components.h" #include "constants.h" #include "utils/fs.h" @@ -157,7 +157,7 @@ static void display_list_free (void *arg) { } -void component_background_init (char *cache_location) { +void ui_components_background_init (char *cache_location) { if (!background) { background = calloc(1, sizeof(component_background_t)); background->cache_location = strdup(cache_location); @@ -166,7 +166,7 @@ void component_background_init (char *cache_location) { } } -void component_background_free (void) { +void ui_components_background_free (void) { if (background) { if (background->image) { surface_free(background->image); @@ -185,7 +185,7 @@ void component_background_free (void) { } } -void component_background_replace_image (surface_t *image) { +void ui_components_background_replace_image (surface_t *image) { if (!background) { return; } @@ -206,7 +206,7 @@ void component_background_replace_image (surface_t *image) { prepare_background(background); } -void component_background_draw (void) { +void ui_components_background_draw (void) { if (background && background->image_display_list) { rspq_block_run(background->image_display_list); } else { diff --git a/src/menu/components/boxart.c b/src/menu/ui_components/boxart.c similarity index 93% rename from src/menu/components/boxart.c rename to src/menu/ui_components/boxart.c index d663230a..16070523 100644 --- a/src/menu/components/boxart.c +++ b/src/menu/ui_components/boxart.c @@ -1,6 +1,6 @@ #include -#include "../components.h" +#include "../ui_components.h" #include "../path.h" #include "../png_decoder.h" #include "constants.h" @@ -17,7 +17,7 @@ static void png_decoder_callback (png_err_t err, surface_t *decoded_image, void } -component_boxart_t *component_boxart_init (const char *storage_prefix, char *game_code, file_image_type_t current_image_view) { +component_boxart_t *ui_components_boxart_init (const char *storage_prefix, char *game_code, file_image_type_t current_image_view) { component_boxart_t *b; char boxart_id_path[8]; @@ -120,7 +120,7 @@ component_boxart_t *component_boxart_init (const char *storage_prefix, char *gam return NULL; } -void component_boxart_free (component_boxart_t *b) { +void ui_components_boxart_free (component_boxart_t *b) { if (b) { if (b->loading) { png_decoder_abort(); @@ -133,7 +133,7 @@ void component_boxart_free (component_boxart_t *b) { } } -void component_boxart_draw (component_boxart_t *b) { +void ui_components_boxart_draw (component_boxart_t *b) { int box_x = BOXART_X; int box_y = BOXART_Y; @@ -150,7 +150,7 @@ void component_boxart_draw (component_boxart_t *b) { rdpq_tex_blit(b->image, box_x, box_y, NULL); rdpq_mode_pop(); } else { - component_box_draw( + ui_components_box_draw( BOXART_X, BOXART_Y, BOXART_X + BOXART_WIDTH, diff --git a/src/menu/components/common.c b/src/menu/ui_components/common.c similarity index 70% rename from src/menu/components/common.c rename to src/menu/ui_components/common.c index 29a97ada..dec31885 100644 --- a/src/menu/components/common.c +++ b/src/menu/ui_components/common.c @@ -1,11 +1,11 @@ #include -#include "../components.h" +#include "../ui_components.h" #include "../fonts.h" #include "constants.h" -void component_box_draw (int x0, int y0, int x1, int y1, color_t color) { +void ui_components_box_draw (int x0, int y0, int x1, int y1, color_t color) { rdpq_mode_push(); rdpq_set_mode_fill(color); @@ -13,7 +13,7 @@ void component_box_draw (int x0, int y0, int x1, int y1, color_t color) { rdpq_mode_pop(); } -void component_border_draw (int x0, int y0, int x1, int y1) { +void ui_components_border_draw (int x0, int y0, int x1, int y1) { rdpq_mode_push(); rdpq_set_mode_fill(BORDER_COLOR); @@ -25,14 +25,14 @@ void component_border_draw (int x0, int y0, int x1, int y1) { rdpq_mode_pop(); } -void component_layout_draw (void) { - component_border_draw( +void ui_components_layout_draw (void) { + ui_components_border_draw( VISIBLE_AREA_X0, VISIBLE_AREA_Y0, VISIBLE_AREA_X1, VISIBLE_AREA_Y1 ); - component_box_draw( + ui_components_box_draw( VISIBLE_AREA_X0, LAYOUT_ACTIONS_SEPARATOR_Y, VISIBLE_AREA_X1, @@ -41,47 +41,47 @@ void component_layout_draw (void) { ); } -void component_progressbar_draw (int x0, int y0, int x1, int y1, float progress) { +void ui_components_progressbar_draw (int x0, int y0, int x1, int y1, float progress) { float progress_width = progress * (x1 - x0); - component_box_draw(x0, y0, x0 + progress_width, y1, PROGRESSBAR_DONE_COLOR); - component_box_draw(x0 + progress_width, y0, x1, y1, PROGRESSBAR_BG_COLOR); + ui_components_box_draw(x0, y0, x0 + progress_width, y1, PROGRESSBAR_DONE_COLOR); + ui_components_box_draw(x0 + progress_width, y0, x1, y1, PROGRESSBAR_BG_COLOR); } -void component_seekbar_draw (float position) { +void ui_components_seekbar_draw (float position) { int x0 = SEEKBAR_X; int y0 = SEEKBAR_Y; int x1 = SEEKBAR_X + SEEKBAR_WIDTH; int y1 = SEEKBAR_Y + SEEKBAR_HEIGHT; - component_border_draw(x0, y0, x1, y1); - component_progressbar_draw(x0, y0, x1, y1, position); + ui_components_border_draw(x0, y0, x1, y1); + ui_components_progressbar_draw(x0, y0, x1, y1, position); } -void component_loader_draw (float progress) { +void ui_components_loader_draw (float progress) { int x0 = LOADER_X; int y0 = LOADER_Y; int x1 = LOADER_X + LOADER_WIDTH; int y1 = LOADER_Y + LOADER_HEIGHT; - component_border_draw(x0, y0, x1, y1); - component_progressbar_draw(x0, y0, x1, y1, progress); + ui_components_border_draw(x0, y0, x1, y1); + ui_components_progressbar_draw(x0, y0, x1, y1, progress); } -void component_scrollbar_draw (int x, int y, int width, int height, int position, int items, int visible_items) { +void ui_components_scrollbar_draw (int x, int y, int width, int height, int position, int items, int visible_items) { if (items <= 1 || items <= visible_items) { - component_box_draw(x, y, x + width, y + height, SCROLLBAR_INACTIVE_COLOR); + ui_components_box_draw(x, y, x + width, y + height, SCROLLBAR_INACTIVE_COLOR); } else { int scroll_height = (int) ((visible_items / (float) (items)) * height); float scroll_position = ((position / (float) (items - 1)) * (height - scroll_height)); - component_box_draw(x, y, x + width, y + height, SCROLLBAR_BG_COLOR); - component_box_draw(x, y + scroll_position, x + width, y + scroll_position + scroll_height, SCROLLBAR_POSITION_COLOR); + ui_components_box_draw(x, y, x + width, y + height, SCROLLBAR_BG_COLOR); + ui_components_box_draw(x, y + scroll_position, x + width, y + scroll_position + scroll_height, SCROLLBAR_POSITION_COLOR); } } -void component_list_scrollbar_draw (int position, int items, int visible_items) { - component_scrollbar_draw( +void ui_components_list_scrollbar_draw (int position, int items, int visible_items) { + ui_components_scrollbar_draw( LIST_SCROLLBAR_X, LIST_SCROLLBAR_Y, LIST_SCROLLBAR_WIDTH, @@ -92,17 +92,17 @@ void component_list_scrollbar_draw (int position, int items, int visible_items) ); } -void component_dialog_draw (int width, int height) { +void ui_components_dialog_draw (int width, int height) { int x0 = DISPLAY_CENTER_X - (width / 2); int y0 = DISPLAY_CENTER_Y - (height / 2); int x1 = DISPLAY_CENTER_X + (width / 2); int y1 = DISPLAY_CENTER_Y + (height / 2); - component_border_draw(x0, y0, x1, y1); - component_box_draw(x0, y0, x1, y1, DIALOG_BG_COLOR); + ui_components_border_draw(x0, y0, x1, y1); + ui_components_box_draw(x0, y0, x1, y1, DIALOG_BG_COLOR); } -void component_messagebox_draw (char *fmt, ...) { +void ui_components_messagebox_draw (char *fmt, ...) { char buffer[512]; size_t nbytes = sizeof(buffer); @@ -126,7 +126,7 @@ void component_messagebox_draw (char *fmt, ...) { free(formatted); } - component_dialog_draw( + ui_components_dialog_draw( paragraph->bbox.x1 - paragraph->bbox.x0 + MESSAGEBOX_MARGIN, paragraph->bbox.y1 - paragraph->bbox.y0 + MESSAGEBOX_MARGIN ); @@ -136,7 +136,7 @@ void component_messagebox_draw (char *fmt, ...) { rdpq_paragraph_free(paragraph); } -void component_main_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...) { +void ui_components_main_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...) { char buffer[1024]; size_t nbytes = sizeof(buffer); @@ -166,7 +166,7 @@ void component_main_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *f } } -void component_actions_bar_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...) { +void ui_components_actions_bar_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...) { char buffer[256]; size_t nbytes = sizeof(buffer); diff --git a/src/menu/components/constants.h b/src/menu/ui_components/constants.h similarity index 100% rename from src/menu/components/constants.h rename to src/menu/ui_components/constants.h diff --git a/src/menu/components/context_menu.c b/src/menu/ui_components/context_menu.c similarity index 87% rename from src/menu/components/context_menu.c rename to src/menu/ui_components/context_menu.c index abf1947e..b08085fc 100644 --- a/src/menu/components/context_menu.c +++ b/src/menu/ui_components/context_menu.c @@ -1,4 +1,4 @@ -#include "../components.h" +#include "../ui_components.h" #include "../fonts.h" #include "../sound.h" #include "constants.h" @@ -12,7 +12,7 @@ static component_context_menu_t *get_current_submenu (component_context_menu_t * } -void component_context_menu_init (component_context_menu_t *cm) { +void ui_components_context_menu_init (component_context_menu_t *cm) { cm->row_selected = -1; cm->row_count = 0; cm->hide_pending = false; @@ -22,12 +22,12 @@ void component_context_menu_init (component_context_menu_t *cm) { } } -void component_context_menu_show (component_context_menu_t *cm) { +void ui_components_context_menu_show (component_context_menu_t *cm) { cm->row_selected = 0; cm->submenu = NULL; } -bool component_context_menu_process (menu_t *menu, component_context_menu_t *cm) { +bool ui_components_context_menu_process (menu_t *menu, component_context_menu_t *cm) { if (!cm || (cm->row_selected < 0)) { return false; } @@ -46,7 +46,7 @@ bool component_context_menu_process (menu_t *menu, component_context_menu_t *cm) } else if (menu->actions.enter) { if (cm->list[cm->row_selected].submenu) { cm->submenu = cm->list[cm->row_selected].submenu; - component_context_menu_init(cm->submenu); + ui_components_context_menu_init(cm->submenu); cm->submenu->row_selected = 0; cm->submenu->parent = cm; } else if (cm->list[cm->row_selected].action) { @@ -71,7 +71,7 @@ bool component_context_menu_process (menu_t *menu, component_context_menu_t *cm) return true; } -void component_context_menu_draw (component_context_menu_t *cm) { +void ui_components_context_menu_draw (component_context_menu_t *cm) { if (!cm || (cm->row_selected < 0)) { return; } @@ -105,14 +105,14 @@ void component_context_menu_draw (component_context_menu_t *cm) { int width = layout->bbox.x1 - layout->bbox.x0 + MESSAGEBOX_MARGIN; int height = layout->bbox.y1 - layout->bbox.y0 + MESSAGEBOX_MARGIN; - component_dialog_draw(width, height); + ui_components_dialog_draw(width, height); int highlight_x0 = DISPLAY_CENTER_X - (width / 2); int highlight_x1 = DISPLAY_CENTER_X + (width / 2); int highlight_height = (layout->bbox.y1 - layout->bbox.y0) / layout->nlines; int highlight_y = VISIBLE_AREA_Y0 + layout->bbox.y0 + ((cm->row_selected) * highlight_height); - component_box_draw( + ui_components_box_draw( highlight_x0, highlight_y, highlight_x1, diff --git a/src/menu/components/file_list.c b/src/menu/ui_components/file_list.c similarity index 95% rename from src/menu/components/file_list.c rename to src/menu/ui_components/file_list.c index 7a9835ce..af10e3a0 100644 --- a/src/menu/components/file_list.c +++ b/src/menu/ui_components/file_list.c @@ -1,6 +1,6 @@ #include -#include "../components.h" +#include "../ui_components.h" #include "../fonts.h" #include "constants.h" @@ -25,7 +25,7 @@ static int format_file_size (char *buffer, int64_t size) { } -void component_file_list_draw (entry_t *list, int entries, int selected) { +void ui_components_file_list_draw (entry_t *list, int entries, int selected) { int starting_position = 0; if (entries > LIST_ENTRIES && selected >= (LIST_ENTRIES / 2)) { @@ -35,10 +35,10 @@ void component_file_list_draw (entry_t *list, int entries, int selected) { } } - component_list_scrollbar_draw(selected, entries, LIST_ENTRIES); + ui_components_list_scrollbar_draw(selected, entries, LIST_ENTRIES); if (entries == 0) { - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "^%02X** empty directory **", STL_GRAY @@ -117,7 +117,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) { int highlight_height = (layout->bbox.y1 - layout->bbox.y0) / layout->nlines; int highlight_y = VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + TEXT_OFFSET_VERTICAL + ((selected - starting_position) * highlight_height); - component_box_draw( + ui_components_box_draw( FILE_LIST_HIGHLIGHT_X, highlight_y, FILE_LIST_HIGHLIGHT_X + FILE_LIST_HIGHLIGHT_WIDTH, diff --git a/src/menu/views/browser.c b/src/menu/views/browser.c index 2ff3c867..abe86b59 100644 --- a/src/menu/views/browser.c +++ b/src/menu/views/browser.c @@ -288,11 +288,11 @@ static component_context_menu_t settings_context_menu = { }; static void process (menu_t *menu) { - if (component_context_menu_process(menu, &entry_context_menu)) { + if (ui_components_context_menu_process(menu, &entry_context_menu)) { return; } - if (component_context_menu_process(menu, &settings_context_menu)) { + if (ui_components_context_menu_process(menu, &settings_context_menu)) { return; } @@ -353,10 +353,10 @@ static void process (menu_t *menu) { } sound_play_effect(SFX_EXIT); } else if (menu->actions.options && menu->browser.entry) { - component_context_menu_show(&entry_context_menu); + ui_components_context_menu_show(&entry_context_menu); sound_play_effect(SFX_SETTING); } else if (menu->actions.settings) { - component_context_menu_show(&settings_context_menu); + ui_components_context_menu_show(&settings_context_menu); sound_play_effect(SFX_SETTING); } } @@ -365,11 +365,11 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_file_list_draw(menu->browser.list, menu->browser.entries, menu->browser.selected); + ui_components_file_list_draw(menu->browser.list, menu->browser.entries, menu->browser.selected); const char *action = NULL; @@ -385,7 +385,7 @@ static void draw (menu_t *menu, surface_t *d) { } } - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "%s\n" "^%02XB: Back^00", @@ -393,7 +393,7 @@ static void draw (menu_t *menu, surface_t *d) { path_is_root(menu->browser.directory) ? STL_GRAY : STL_DEFAULT ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_RIGHT, VALIGN_TOP, "Start: Settings\n" "^%02XR: Options^00", @@ -401,7 +401,7 @@ static void draw (menu_t *menu, surface_t *d) { ); if (menu->current_time >= 0) { - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_CENTER, VALIGN_TOP, "\n" "%s", @@ -409,9 +409,9 @@ static void draw (menu_t *menu, surface_t *d) { ); } - component_context_menu_draw(&entry_context_menu); + ui_components_context_menu_draw(&entry_context_menu); - component_context_menu_draw(&settings_context_menu); + ui_components_context_menu_draw(&settings_context_menu); rdpq_detach_show(); } @@ -419,8 +419,8 @@ static void draw (menu_t *menu, surface_t *d) { void view_browser_init (menu_t *menu) { if (!menu->browser.valid) { - component_context_menu_init(&entry_context_menu); - component_context_menu_init(&settings_context_menu); + ui_components_context_menu_init(&entry_context_menu); + ui_components_context_menu_init(&settings_context_menu); if (load_directory(menu)) { path_free(menu->browser.directory); menu->browser.directory = path_init(menu->storage_prefix, ""); diff --git a/src/menu/views/credits.c b/src/menu/views/credits.c index 1889232a..3595b30c 100644 --- a/src/menu/views/credits.c +++ b/src/menu/views/credits.c @@ -20,16 +20,16 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "MENU INFORMATION" ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -54,7 +54,7 @@ static void draw (menu_t *menu, surface_t *d) { BUILD_TIMESTAMP ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "B: Exit" diff --git a/src/menu/views/error.c b/src/menu/views/error.c index 7cb4f7d2..b163f885 100644 --- a/src/menu/views/error.c +++ b/src/menu/views/error.c @@ -12,12 +12,12 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); if (menu->error_message) { - component_messagebox_draw(menu->error_message); + ui_components_messagebox_draw(menu->error_message); } else { - component_messagebox_draw("Unspecified error"); + ui_components_messagebox_draw("Unspecified error"); } rdpq_detach_show(); diff --git a/src/menu/views/fault.c b/src/menu/views/fault.c index 6ec767a4..ee2f8c5e 100644 --- a/src/menu/views/fault.c +++ b/src/menu/views/fault.c @@ -13,7 +13,7 @@ static void draw (menu_t *menu, surface_t *d) { "SummerCart64: 2.17.0+" ); - component_messagebox_draw( + ui_components_messagebox_draw( "UNRECOVERABLE ERROR\n" "\n" "%s\n" diff --git a/src/menu/views/file_info.c b/src/menu/views/file_info.c index 9d45574b..be204e5f 100644 --- a/src/menu/views/file_info.c +++ b/src/menu/views/file_info.c @@ -58,11 +58,11 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "ENTRY INFORMATION\n" "\n" @@ -70,7 +70,7 @@ static void draw (menu_t *menu, surface_t *d) { menu->browser.entry->name ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -87,7 +87,7 @@ static void draw (menu_t *menu, surface_t *d) { ctime(&st.st_mtime) ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "B: Exit" diff --git a/src/menu/views/flashcart_info.c b/src/menu/views/flashcart_info.c index 635ef2ca..abf99991 100644 --- a/src/menu/views/flashcart_info.c +++ b/src/menu/views/flashcart_info.c @@ -36,18 +36,18 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "FLASHCART INFORMATION" "\n" "\n" ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -78,7 +78,7 @@ static void draw (menu_t *menu, surface_t *d) { //format_diagnostic_data(flashcart_has_feature(FLASHCART_FEATURE_DIAGNOSTIC_DATA)) ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "B: Back" diff --git a/src/menu/views/image_viewer.c b/src/menu/views/image_viewer.c index d58d3743..64af16f6 100644 --- a/src/menu/views/image_viewer.c +++ b/src/menu/views/image_viewer.c @@ -58,9 +58,9 @@ static void draw (menu_t *menu, surface_t *d) { if (!image) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_loader_draw(png_decoder_get_progress()); + ui_components_loader_draw(png_decoder_get_progress()); } else { rdpq_attach_clear(d, NULL); @@ -73,13 +73,13 @@ static void draw (menu_t *menu, surface_t *d) { rdpq_mode_pop(); if (show_message) { - component_messagebox_draw( + ui_components_messagebox_draw( "Set \"%s\" as background image?\n\n" "A: Yes, B: Back", menu->browser.entry->name ); } else if (image_set_as_background) { - component_messagebox_draw("Preparing background…"); + ui_components_messagebox_draw("Preparing background…"); } } @@ -93,7 +93,7 @@ static void deinit (menu_t *menu) { if (image) { if (image_set_as_background) { - component_background_replace_image(image); + ui_components_background_replace_image(image); } else { surface_free(image); free(image); diff --git a/src/menu/views/load_disk.c b/src/menu/views/load_disk.c index 9ba914d9..c1e24a79 100644 --- a/src/menu/views/load_disk.c +++ b/src/menu/views/load_disk.c @@ -45,14 +45,14 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); if (menu->boot_pending.disk_file) { - component_loader_draw(0.0f); + ui_components_loader_draw(0.0f); } else { - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "64DD disk information\n" "\n" @@ -60,7 +60,7 @@ static void draw (menu_t *menu, surface_t *d) { menu->browser.entry->name ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -80,21 +80,21 @@ static void draw (menu_t *menu, surface_t *d) { menu->load.rom_path ? path_last_get(menu->load.rom_path) : "" ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "A: Load and run 64DD disk\n" "B: Exit" ); if (menu->load.rom_path) { - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_RIGHT, VALIGN_TOP, "R: Load with ROM" ); } if (boxart != NULL) { - component_boxart_draw(boxart); + ui_components_boxart_draw(boxart); } } @@ -107,9 +107,9 @@ static void draw_progress (float progress) { if (d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_loader_draw(progress); + ui_components_loader_draw(progress); rdpq_detach_show(); } @@ -153,7 +153,7 @@ static void load (menu_t *menu) { } static void deinit (void) { - component_boxart_free(boxart); + ui_components_boxart_free(boxart); } void view_load_disk_init (menu_t *menu) { @@ -172,7 +172,7 @@ void view_load_disk_init (menu_t *menu) { return; } - boxart = component_boxart_init(menu->storage_prefix, menu->load.disk_info.id, IMAGE_BOXART_FRONT); + boxart = ui_components_boxart_init(menu->storage_prefix, menu->load.disk_info.id, IMAGE_BOXART_FRONT); } void view_load_disk_display (menu_t *menu, surface_t *display) { diff --git a/src/menu/views/load_emulator.c b/src/menu/views/load_emulator.c index 3a131722..ad923145 100644 --- a/src/menu/views/load_emulator.c +++ b/src/menu/views/load_emulator.c @@ -43,19 +43,19 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); if (menu->boot_pending.emulator_file) { - component_loader_draw(0.0f); + ui_components_loader_draw(0.0f); } else { - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "Load Emulated ROM\n" ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -65,7 +65,7 @@ static void draw (menu_t *menu, surface_t *d) { menu->browser.entry->name ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "A: Load and run Emulated ROM\n" "B: Exit" @@ -81,9 +81,9 @@ static void draw_progress (float progress) { if (d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_loader_draw(progress); + ui_components_loader_draw(progress); rdpq_detach_show(); } diff --git a/src/menu/views/load_rom.c b/src/menu/views/load_rom.c index 2a4ce34d..fb95003f 100644 --- a/src/menu/views/load_rom.c +++ b/src/menu/views/load_rom.c @@ -203,7 +203,7 @@ static component_context_menu_t options_context_menu = { .list = { }}; static void process (menu_t *menu) { - if (component_context_menu_process(menu, &options_context_menu)) { + if (ui_components_context_menu_process(menu, &options_context_menu)) { return; } @@ -213,7 +213,7 @@ static void process (menu_t *menu) { sound_play_effect(SFX_EXIT); menu->next_mode = MENU_MODE_BROWSER; } else if (menu->actions.options) { - component_context_menu_show(&options_context_menu); + ui_components_context_menu_show(&options_context_menu); sound_play_effect(SFX_SETTING); } else if (menu->actions.lz_context) { if (show_extra_info_message) { @@ -228,14 +228,14 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); if (menu->boot_pending.rom_file) { - component_loader_draw(0.0f); + ui_components_loader_draw(0.0f); } else { - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "N64 ROM information\n" "\n" @@ -243,7 +243,7 @@ static void draw (menu_t *menu, surface_t *d) { menu->browser.entry->name ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -262,24 +262,24 @@ static void draw (menu_t *menu, surface_t *d) { format_rom_save_type(rom_info_get_save_type(&menu->load.rom_info), menu->load.rom_info.features.controller_pak) ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "A: Load and run ROM\n" "B: Back" ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_RIGHT, VALIGN_TOP, "L|Z: Extra Info\n" "R: Options" ); if (boxart != NULL) { - component_boxart_draw(boxart); + ui_components_boxart_draw(boxart); } if (show_extra_info_message) { - component_messagebox_draw( + ui_components_messagebox_draw( "EXTRA ROM INFO\n" "\n" "Endianness: %s\n" @@ -306,7 +306,7 @@ static void draw (menu_t *menu, surface_t *d) { ); } - component_context_menu_draw(&options_context_menu); + ui_components_context_menu_draw(&options_context_menu); } rdpq_detach_show(); @@ -318,9 +318,9 @@ static void draw_progress (float progress) { if (d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_loader_draw(progress); + ui_components_loader_draw(progress); rdpq_detach_show(); } @@ -348,7 +348,7 @@ static void load (menu_t *menu) { } static void deinit (void) { - component_boxart_free(boxart); + ui_components_boxart_free(boxart); boxart = NULL; } @@ -371,8 +371,8 @@ void view_load_rom_init (menu_t *menu) { } if (!menu->settings.rom_autoload_enabled) { - boxart = component_boxart_init(menu->storage_prefix, menu->load.rom_info.game_code, IMAGE_BOXART_FRONT); - component_context_menu_init(&options_context_menu); + boxart = ui_components_boxart_init(menu->storage_prefix, menu->load.rom_info.game_code, IMAGE_BOXART_FRONT); + ui_components_context_menu_init(&options_context_menu); } } diff --git a/src/menu/views/music_player.c b/src/menu/views/music_player.c index c540bfab..b2dde597 100644 --- a/src/menu/views/music_player.c +++ b/src/menu/views/music_player.c @@ -61,13 +61,13 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_seekbar_draw(mp3player_get_progress()); + ui_components_seekbar_draw(mp3player_get_progress()); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "MUSIC PLAYER\n" "\n" @@ -83,7 +83,7 @@ static void draw (menu_t *menu, surface_t *d) { mp3player_get_duration() ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -102,7 +102,7 @@ static void draw (menu_t *menu, surface_t *d) { mp3player_get_samplerate() ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "A: %s\n" "B: Exit | Left / Right: Rewind / Fast forward", diff --git a/src/menu/views/rtc.c b/src/menu/views/rtc.c index 88196d00..f7e93dad 100644 --- a/src/menu/views/rtc.c +++ b/src/menu/views/rtc.c @@ -110,7 +110,7 @@ void component_editdatetime_draw ( struct tm t, rtc_field_t selected_field ) { snprintf( current_selection_chars, sizeof(current_selection_chars), "******************^^^^*****"); break; } - component_messagebox_draw( + ui_components_messagebox_draw( "|YYYY|MM|DD|HH|MM|SS| DOW\n%s\n%s\n", full_dt, current_selection_chars); } @@ -165,14 +165,14 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); if (!is_editing_mode) { if( menu->current_time >= 0 ) { - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "ADJUST REAL TIME CLOCK\n" "\n" @@ -186,7 +186,7 @@ static void draw (menu_t *menu, surface_t *d) { menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown" ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "A: Change\n" "B: Back" @@ -194,7 +194,7 @@ static void draw (menu_t *menu, surface_t *d) { } else { - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "ADJUST REAL TIME CLOCK\n" "\n" @@ -206,7 +206,7 @@ static void draw (menu_t *menu, surface_t *d) { menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown" ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "B: Back" @@ -214,12 +214,12 @@ static void draw (menu_t *menu, surface_t *d) { } } else { - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_RIGHT, VALIGN_TOP, "Up/Down: Adjust Field\n" "Left/Right: Switch Field" ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "R: Save\n" "B: Back" diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 068b4675..4b2467d1 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -106,12 +106,12 @@ static component_context_menu_t options_context_menu = { .list = { static void process (menu_t *menu) { - if (component_context_menu_process(menu, &options_context_menu)) { + if (ui_components_context_menu_process(menu, &options_context_menu)) { return; } if (menu->actions.enter) { - component_context_menu_show(&options_context_menu); + ui_components_context_menu_show(&options_context_menu); sound_play_effect(SFX_SETTING); } else if (menu->actions.back) { sound_play_effect(SFX_EXIT); @@ -122,17 +122,17 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "MENU SETTINGS EDITOR\n" "\n" ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n\n" " Default Directory : %s\n\n" @@ -163,13 +163,13 @@ static void draw (menu_t *menu, surface_t *d) { ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "A: Change\n" "B: Back" ); - component_context_menu_draw(&options_context_menu); + ui_components_context_menu_draw(&options_context_menu); rdpq_detach_show(); } @@ -177,7 +177,7 @@ static void draw (menu_t *menu, surface_t *d) { void view_settings_init (menu_t *menu) { - component_context_menu_init(&options_context_menu); + ui_components_context_menu_init(&options_context_menu); } diff --git a/src/menu/views/system_info.c b/src/menu/views/system_info.c index 18cffb0d..653ee0b0 100644 --- a/src/menu/views/system_info.c +++ b/src/menu/views/system_info.c @@ -36,16 +36,16 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "N64 SYSTEM INFORMATION" ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -65,7 +65,7 @@ static void draw (menu_t *menu, surface_t *d) { (joypad[3]) ? "" : "not ", format_accessory(3) ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "B: Exit" diff --git a/src/menu/views/text_viewer.c b/src/menu/views/text_viewer.c index 0339ba37..b3cdb559 100644 --- a/src/menu/views/text_viewer.c +++ b/src/menu/views/text_viewer.c @@ -1,7 +1,7 @@ #include #include -#include "../components/constants.h" +#include "../ui_components/constants.h" #include "../fonts.h" #include "../sound.h" #include "utils/utils.h" @@ -69,19 +69,19 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "%s\n", text->contents + text->offset ); - component_list_scrollbar_draw(text->current_line, text->lines, LIST_ENTRIES); + ui_components_list_scrollbar_draw(text->current_line, text->lines, LIST_ENTRIES); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "^%02XUp / Down: Scroll^00\n" "B: Back", diff --git a/src/menu/views/views.h b/src/menu/views/views.h index 8da900dc..8c475280 100644 --- a/src/menu/views/views.h +++ b/src/menu/views/views.h @@ -8,7 +8,7 @@ #define VIEWS_H__ -#include "../components.h" +#include "../ui_components.h" #include "../menu_state.h"