diff --git a/src/app.c b/src/app.c index bdd1957..bf0127f 100644 --- a/src/app.c +++ b/src/app.c @@ -162,6 +162,17 @@ static void handle_event(App *app, const SDL_Event *event) { return; } + if (app->about_modal_open) { + switch (event->key.keysym.sym) { + case SDLK_ESCAPE: + case SDLK_a: + app->about_modal_open = 0; + return; + default: + return; + } + } + if (app->theme_picker_open) { switch (event->key.keysym.sym) { case SDLK_ESCAPE: @@ -202,9 +213,17 @@ static void handle_event(App *app, const SDL_Event *event) { if (app->mode == MODE_FULLSCREEN) { app->mode = MODE_GUIDE; } + app->about_modal_open = 0; app->theme_picker_open = !app->theme_picker_open; app->theme_picker_selection = app->theme_index; break; + case SDLK_a: + if (app->mode == MODE_FULLSCREEN) { + app->mode = MODE_GUIDE; + } + app->theme_picker_open = 0; + app->about_modal_open = !app->about_modal_open; + break; case SDLK_UP: tune_relative(app, -1); break; @@ -348,6 +367,12 @@ void app_run(App *app) { &GUIDE_THEMES[app->theme_index], app->theme_index, app->theme_picker_selection); + } else if (app->about_modal_open) { + ui_render_about_modal(app->renderer, + &app->fonts, + output_width, + output_height, + &GUIDE_THEMES[app->theme_index]); } } else { if (!in_blackout) { diff --git a/src/app.h b/src/app.h index b057ac9..7ad2d10 100644 --- a/src/app.h +++ b/src/app.h @@ -20,6 +20,7 @@ typedef struct App { int theme_index; int theme_picker_open; int theme_picker_selection; + int about_modal_open; int startup_handoff_active; int last_blackout_state; Uint32 startup_handoff_until; diff --git a/src/app.o b/src/app.o index 83a38e8..be65668 100644 Binary files a/src/app.o and b/src/app.o differ diff --git a/src/ui.c b/src/ui.c index f368dff..a437294 100644 --- a/src/ui.c +++ b/src/ui.c @@ -538,7 +538,7 @@ static void draw_footer_legend(SDL_Renderer *renderer, draw_pill_button(renderer, theme, &chip, theme->panel_fill, theme->panel_border); draw_text_clipped(renderer, fonts->medium, "A", &footer, chip.x + 11, chip.y + 1, footer_text); - draw_text_clipped(renderer, fonts->small, "TIME", &footer, chip.x + 42, chip.y - 1, footer_text); + draw_text_clipped(renderer, fonts->small, "ABOUT", &footer, chip.x + 42, chip.y - 1, footer_text); chip.x += 144; draw_pill_button(renderer, theme, &chip, theme->block_mid, theme->panel_border); @@ -558,6 +558,79 @@ static void draw_scanline_overlay(SDL_Renderer *renderer, int width, int height, (void) theme; } +void ui_render_about_modal(SDL_Renderer *renderer, + const UiFonts *fonts, + int window_width, + int window_height, + const GuideTheme *active_theme) { + SDL_Rect overlay = {0, 0, window_width, window_height}; + SDL_Rect modal = {window_width / 2 - 280, window_height / 2 - 160, 560, 320}; + SDL_Rect title_bar = {modal.x, modal.y, modal.w, 40}; + SDL_Rect body = {modal.x + 18, modal.y + 56, modal.w - 36, modal.h - 88}; + SDL_Color body_bg = blend_color(active_theme->footer_mid, active_theme->panel_fill, 70); + SDL_Color title_text = readable_text_color(active_theme->ribbon_mid); + SDL_Color body_text = readable_text_color(body_bg); + SDL_Color sub_text = ensure_contrast(active_theme->row_subtext, body_bg); + + fill_rect_alpha(renderer, &overlay, (SDL_Color){0, 0, 0, 120}); + draw_panel_shadow(renderer, &modal); + draw_rounded_top_panel(renderer, + &modal, + body_bg, + active_theme->panel_border, + active_theme->rounded_radius > 0 ? active_theme->rounded_radius : 8); + fill_rect(renderer, &(SDL_Rect){modal.x, modal.y + 40, modal.w, modal.h - 40}, body_bg); + draw_beveled_bar(renderer, + &title_bar, + active_theme->ribbon_top, + active_theme->ribbon_mid, + active_theme->ribbon_bottom, + color_with_alpha(active_theme->gloss, 32), + active_theme->panel_border); + draw_text_shadowed(renderer, fonts->medium, "ABOUT", &modal, modal.x + 16, modal.y + 10, title_text, color_with_alpha(COLOR_BLACK, 255)); + draw_text_shadowed(renderer, fonts->large, "FreePassport-C 0.1", &body, body.x, body.y, body_text, color_with_alpha(COLOR_BLACK, 255)); + draw_text_shadowed(renderer, + fonts->small, + "by markmental (Mark Robillard Jr)", + &body, + body.x, + body.y + 42, + sub_text, + color_with_alpha(COLOR_BLACK, 255)); + draw_text_shadowed(renderer, + fonts->small, + "Your media library turned into", + &body, + body.x, + body.y + 86, + body_text, + color_with_alpha(COLOR_BLACK, 255)); + draw_text_shadowed(renderer, + fonts->small, + "an early 2000s Passport cable box", + &body, + body.x, + body.y + 112, + body_text, + color_with_alpha(COLOR_BLACK, 255)); + draw_text_shadowed(renderer, + fonts->small, + "inspired virtual TV guide", + &body, + body.x, + body.y + 138, + body_text, + color_with_alpha(COLOR_BLACK, 255)); + draw_text_shadowed(renderer, + fonts->small, + "A CLOSE ESC CLOSE", + &body, + body.x, + modal.y + modal.h - 28, + sub_text, + color_with_alpha(COLOR_BLACK, 255)); +} + void ui_render_no_media(SDL_Renderer *renderer, const UiCache *cache, int window_width, int window_height) { SDL_Rect full = {0, 0, window_width, window_height}; fill_rect(renderer, &full, COLOR_NAVY_DARK); diff --git a/src/ui.h b/src/ui.h index c26f57f..c716f65 100644 --- a/src/ui.h +++ b/src/ui.h @@ -74,6 +74,11 @@ void ui_render_theme_picker(SDL_Renderer *renderer, const GuideTheme *active_theme, int current_theme_index, int selected_theme_index); +void ui_render_about_modal(SDL_Renderer *renderer, + const UiFonts *fonts, + int window_width, + int window_height, + const GuideTheme *active_theme); void ui_render_no_media(SDL_Renderer *renderer, const UiCache *cache, int window_width, int window_height); int ui_load_fonts(UiFonts *fonts); void ui_destroy_fonts(UiFonts *fonts); diff --git a/src/ui.o b/src/ui.o index ca7fc81..1fd93d9 100644 Binary files a/src/ui.o and b/src/ui.o differ