split action bar text lines

This commit is contained in:
Robin Jones 2024-11-15 19:44:59 +00:00
parent 90157f5930
commit 0019e5e445
16 changed files with 129 additions and 36 deletions

View File

@ -56,6 +56,7 @@ SRCS = \
menu/ui_components/common.c \
menu/ui_components/context_menu.c \
menu/ui_components/file_list.c \
menu/ui_components/joypad_buttons.c \
menu/usb_comm.c \
menu/views/browser.c \
menu/views/credits.c \

View File

@ -29,6 +29,36 @@ typedef enum {
IMAGE_TYPE_END /**< List end marker */
} file_image_type_t;
/**
* @brief joypad button sprite Enumeration.
*
* Enumeration for different types of joypad button sprites used in the user interface.
*/
typedef enum {
SPRITE_JOYPAD_BUTTON_A,
SPRITE_JOYPAD_BUTTON_B,
SPRITE_JOYPAD_BUTTON_C_DOWN,
SPRITE_JOYPAD_BUTTON_C_LEFT,
SPRITE_JOYPAD_BUTTON_C_RIGHT,
SPRITE_JOYPAD_BUTTON_C_UP,
SPRITE_JOYPAD_BUTTON_D_DOWN,
SPRITE_JOYPAD_BUTTON_D_LEFT,
SPRITE_JOYPAD_BUTTON_D_RIGHT,
SPRITE_JOYPAD_BUTTON_D_UP,
SPRITE_JOYPAD_BUTTON_L,
SPRITE_JOYPAD_BUTTON_R,
SPRITE_JOYPAD_BUTTON_Z,
SPRITE_JOYPAD_BUTTON_TYPE_END /**< List end marker */
} sprite_joypad_button_type_t;
typedef enum {
ACTION_BAR_LINE_ONE,
ACTION_BAR_LINE_TWO,
ACTION_BAR_LINE_END
} action_bar_line_t;
/**
* @brief Draw a box component.
*
@ -136,7 +166,7 @@ void ui_components_main_text_draw(rdpq_align_t align, rdpq_valign_t valign, char
* @param fmt Format string for the text.
* @param ... Additional arguments for the format string.
*/
void ui_components_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, action_bar_line_t line, char *fmt, ...);
/**
* @brief Initialize the background component.

View File

@ -166,7 +166,7 @@ void ui_components_main_text_draw (rdpq_align_t align, rdpq_valign_t valign, cha
}
}
void ui_components_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, action_bar_line_t line, char *fmt, ...) {
char buffer[256];
size_t nbytes = sizeof(buffer);

View File

@ -0,0 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include "../ui_components.h"
void ui_components_joypad_buttons_init(void) {
}
void ui_components_joypad_buttons_draw (void) {
}

View File

@ -386,23 +386,31 @@ static void draw (menu_t *menu, surface_t *d) {
}
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
"%s\n"
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE,
"%s",
menu->browser.entries == 0 ? "" : action
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"^%02XB: Back^00",
menu->browser.entries == 0 ? "" : action,
path_is_root(menu->browser.directory) ? STL_GRAY : STL_DEFAULT
);
ui_components_actions_bar_text_draw(
ALIGN_RIGHT, VALIGN_TOP,
"Start: Settings\n"
ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_ONE,
"Start: Settings"
);
ui_components_actions_bar_text_draw(
ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"^%02XR: Options^00",
menu->browser.entries == 0 ? STL_GRAY : STL_DEFAULT
);
if (menu->current_time >= 0) {
ui_components_actions_bar_text_draw(
ALIGN_CENTER, VALIGN_TOP,
ALIGN_CENTER, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"%s",
ctime(&menu->current_time)

View File

@ -55,7 +55,7 @@ static void draw (menu_t *menu, surface_t *d) {
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"B: Exit"
);

View File

@ -88,7 +88,7 @@ static void draw (menu_t *menu, surface_t *d) {
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"B: Exit"
);

View File

@ -79,7 +79,7 @@ static void draw (menu_t *menu, surface_t *d) {
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"B: Back"
);

View File

@ -81,14 +81,18 @@ static void draw (menu_t *menu, surface_t *d) {
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
"A: Load and run 64DD disk\n"
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE,
"A: Load and run 64DD disk"
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"B: Exit"
);
if (menu->load.rom_path) {
ui_components_actions_bar_text_draw(
ALIGN_RIGHT, VALIGN_TOP,
ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_ONE,
"R: Load with ROM"
);
}

View File

@ -66,8 +66,12 @@ static void draw (menu_t *menu, surface_t *d) {
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
"A: Load and run Emulated ROM\n"
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE,
"A: Load and run Emulated ROM"
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"B: Exit"
);
}

View File

@ -263,14 +263,22 @@ static void draw (menu_t *menu, surface_t *d) {
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
"A: Load and run ROM\n"
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE,
"A: Load and run ROM"
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"B: Back"
);
ui_components_actions_bar_text_draw(
ALIGN_RIGHT, VALIGN_TOP,
"L|Z: Extra Info\n"
ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_ONE,
"L|Z: Extra Info"
);
ui_components_actions_bar_text_draw(
ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"R: Options"
);

View File

@ -103,11 +103,15 @@ static void draw (menu_t *menu, surface_t *d) {
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
"A: %s\n"
"B: Exit | Left / Right: Rewind / Fast forward",
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE,
"A: %s",
mp3player_is_playing() ? "Pause" : mp3player_is_finished() ? "Play again" : "Play"
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"B: Exit | Left / Right: Rewind / Fast forward"
);
rdpq_detach_show();
}

View File

@ -187,8 +187,12 @@ static void draw (menu_t *menu, surface_t *d) {
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
"A: Change\n"
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE,
"A: Change"
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"B: Back"
);
}
@ -207,7 +211,7 @@ static void draw (menu_t *menu, surface_t *d) {
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"B: Back"
);
@ -215,13 +219,21 @@ static void draw (menu_t *menu, surface_t *d) {
}
else {
ui_components_actions_bar_text_draw(
ALIGN_RIGHT, VALIGN_TOP,
"Up/Down: Adjust Field\n"
ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_ONE,
"Up/Down: Adjust Field"
);
ui_components_actions_bar_text_draw(
ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"Left/Right: Switch Field"
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
"R: Save\n"
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE,
"R: Save"
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"B: Back"
);
}

View File

@ -164,8 +164,13 @@ static void draw (menu_t *menu, surface_t *d) {
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
"A: Change\n"
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE,
"A: Change"
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"B: Back"
);

View File

@ -66,7 +66,7 @@ static void draw (menu_t *menu, surface_t *d) {
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"B: Exit"
);

View File

@ -82,12 +82,17 @@ static void draw (menu_t *menu, surface_t *d) {
ui_components_list_scrollbar_draw(text->current_line, text->lines, LIST_ENTRIES);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
"^%02XUp / Down: Scroll^00\n"
"B: Back",
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE,
"^%02XUp / Down: Scroll^00",
text->vertical_scroll_possible ? STL_DEFAULT : STL_GRAY
);
ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO,
"\n"
"B: Back"
);
rdpq_detach_show();
}