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.
*/
typedef enum {
SPRITE_JOYPAD_BUTTON_NONE,
SPRITE_JOYPAD_BUTTON_A,
SPRITE_JOYPAD_BUTTON_B,
SPRITE_JOYPAD_BUTTON_C_DOWN,
@ -47,6 +48,7 @@ typedef enum {
SPRITE_JOYPAD_BUTTON_D_UP,
SPRITE_JOYPAD_BUTTON_L,
SPRITE_JOYPAD_BUTTON_R,
SPRITE_JOYPAD_BUTTON_START,
SPRITE_JOYPAD_BUTTON_Z,
SPRITE_JOYPAD_BUTTON_TYPE_END /**< List end marker */
} 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 ... 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.

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];
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(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE,
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_NONE,
"%s",
menu->browser.entries == 0 ? "" : action
);
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"
"^%02XB: Back^00",
path_is_root(menu->browser.directory) ? STL_GRAY : STL_DEFAULT
);
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"
);
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"
"^%02XR: Options^00",
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) {
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"
"%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, ACTION_BAR_LINE_TWO,
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B,
"\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, ACTION_BAR_LINE_TWO,
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B,
"\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, ACTION_BAR_LINE_TWO,
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B,
"\n"
"B: Back"
);

View File

@ -81,18 +81,18 @@ static void draw (menu_t *menu, surface_t *d) {
);
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"
);
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"
"B: Exit"
);
if (menu->load.rom_path) {
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"
);
}

View File

@ -66,11 +66,11 @@ static void draw (menu_t *menu, surface_t *d) {
);
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"
);
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"
"B: Exit"
);

View File

@ -263,21 +263,21 @@ static void draw (menu_t *menu, surface_t *d) {
);
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"
);
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"
"B: Back"
);
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"
);
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"
"R: Options"
);

View File

@ -103,12 +103,12 @@ static void draw (menu_t *menu, surface_t *d) {
);
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",
mp3player_is_playing() ? "Pause" : mp3player_is_finished() ? "Play again" : "Play"
);
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"
"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(
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE,
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_A,
"A: Change"
);
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"
"B: Back"
);
@ -211,7 +211,7 @@ static void draw (menu_t *menu, surface_t *d) {
);
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"
"B: Back"
);
@ -219,20 +219,20 @@ static void draw (menu_t *menu, surface_t *d) {
}
else {
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"
);
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"
"Left/Right: Switch Field"
);
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"
);
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"
"B: Back"
);

View File

@ -164,12 +164,12 @@ static void draw (menu_t *menu, surface_t *d) {
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"
);
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"
"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, ACTION_BAR_LINE_TWO,
ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B,
"\n"
"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_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",
text->vertical_scroll_possible ? STL_DEFAULT : STL_GRAY
);
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"
"B: Back"
);