Add context button enumeration

This commit is contained in:
Robin Jones 2024-11-15 20:14:43 +00:00
parent 0019e5e445
commit 868f450ebf
14 changed files with 35 additions and 33 deletions

View File

@ -35,6 +35,7 @@ typedef enum {
* Enumeration for different types of joypad button sprites used in the user interface. * Enumeration for different types of joypad button sprites used in the user interface.
*/ */
typedef enum { typedef enum {
SPRITE_JOYPAD_BUTTON_NONE,
SPRITE_JOYPAD_BUTTON_A, SPRITE_JOYPAD_BUTTON_A,
SPRITE_JOYPAD_BUTTON_B, SPRITE_JOYPAD_BUTTON_B,
SPRITE_JOYPAD_BUTTON_C_DOWN, SPRITE_JOYPAD_BUTTON_C_DOWN,
@ -47,6 +48,7 @@ typedef enum {
SPRITE_JOYPAD_BUTTON_D_UP, SPRITE_JOYPAD_BUTTON_D_UP,
SPRITE_JOYPAD_BUTTON_L, SPRITE_JOYPAD_BUTTON_L,
SPRITE_JOYPAD_BUTTON_R, SPRITE_JOYPAD_BUTTON_R,
SPRITE_JOYPAD_BUTTON_START,
SPRITE_JOYPAD_BUTTON_Z, SPRITE_JOYPAD_BUTTON_Z,
SPRITE_JOYPAD_BUTTON_TYPE_END /**< List end marker */ SPRITE_JOYPAD_BUTTON_TYPE_END /**< List end marker */
} sprite_joypad_button_type_t; } sprite_joypad_button_type_t;
@ -166,7 +168,7 @@ void ui_components_main_text_draw(rdpq_align_t align, rdpq_valign_t valign, char
* @param fmt Format string for the text. * @param fmt Format string for the text.
* @param ... Additional arguments for the format string. * @param ... Additional arguments for the format string.
*/ */
void ui_components_actions_bar_text_draw(rdpq_align_t align, rdpq_valign_t valign, action_bar_line_t line, char *fmt, ...); void ui_components_actions_bar_text_draw(rdpq_align_t align, rdpq_valign_t valign, action_bar_line_t line, sprite_joypad_button_type_t context_button, char *fmt, ...);
/** /**
* @brief Initialize the background component. * @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, action_bar_line_t line, char *fmt, ...) { void ui_components_actions_bar_text_draw (rdpq_align_t align, rdpq_valign_t valign, action_bar_line_t line, sprite_joypad_button_type_t context_button, char *fmt, ...) {
char buffer[256]; char buffer[256];
size_t nbytes = sizeof(buffer); size_t nbytes = sizeof(buffer);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -187,11 +187,11 @@ static void draw (menu_t *menu, surface_t *d) {
); );
ui_components_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_A,
"A: Change" "A: Change"
); );
ui_components_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B,
"\n" "\n"
"B: Back" "B: Back"
); );
@ -211,7 +211,7 @@ static void draw (menu_t *menu, surface_t *d) {
); );
ui_components_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B,
"\n" "\n"
"B: Back" "B: Back"
); );
@ -219,20 +219,20 @@ static void draw (menu_t *menu, surface_t *d) {
} }
else { else {
ui_components_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_ONE, ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_NONE,
"Up/Down: Adjust Field" "Up/Down: Adjust Field"
); );
ui_components_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_TWO, ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_NONE,
"\n" "\n"
"Left/Right: Switch Field" "Left/Right: Switch Field"
); );
ui_components_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_R,
"R: Save" "R: Save"
); );
ui_components_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B,
"\n" "\n"
"B: Back" "B: Back"
); );

View File

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

View File

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

View File

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