Adds about screen for v 0.1

This commit is contained in:
markmental 2026-03-28 02:12:06 -04:00
commit d91b8d5cff
6 changed files with 105 additions and 1 deletions

View file

@ -162,6 +162,17 @@ static void handle_event(App *app, const SDL_Event *event) {
return; 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) { if (app->theme_picker_open) {
switch (event->key.keysym.sym) { switch (event->key.keysym.sym) {
case SDLK_ESCAPE: case SDLK_ESCAPE:
@ -202,9 +213,17 @@ static void handle_event(App *app, const SDL_Event *event) {
if (app->mode == MODE_FULLSCREEN) { if (app->mode == MODE_FULLSCREEN) {
app->mode = MODE_GUIDE; app->mode = MODE_GUIDE;
} }
app->about_modal_open = 0;
app->theme_picker_open = !app->theme_picker_open; app->theme_picker_open = !app->theme_picker_open;
app->theme_picker_selection = app->theme_index; app->theme_picker_selection = app->theme_index;
break; 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: case SDLK_UP:
tune_relative(app, -1); tune_relative(app, -1);
break; break;
@ -348,6 +367,12 @@ void app_run(App *app) {
&GUIDE_THEMES[app->theme_index], &GUIDE_THEMES[app->theme_index],
app->theme_index, app->theme_index,
app->theme_picker_selection); 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 { } else {
if (!in_blackout) { if (!in_blackout) {

View file

@ -20,6 +20,7 @@ typedef struct App {
int theme_index; int theme_index;
int theme_picker_open; int theme_picker_open;
int theme_picker_selection; int theme_picker_selection;
int about_modal_open;
int startup_handoff_active; int startup_handoff_active;
int last_blackout_state; int last_blackout_state;
Uint32 startup_handoff_until; Uint32 startup_handoff_until;

BIN
src/app.o

Binary file not shown.

View file

@ -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_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->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; chip.x += 144;
draw_pill_button(renderer, theme, &chip, theme->block_mid, theme->panel_border); 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) 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) { 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}; SDL_Rect full = {0, 0, window_width, window_height};
fill_rect(renderer, &full, COLOR_NAVY_DARK); fill_rect(renderer, &full, COLOR_NAVY_DARK);

View file

@ -74,6 +74,11 @@ void ui_render_theme_picker(SDL_Renderer *renderer,
const GuideTheme *active_theme, const GuideTheme *active_theme,
int current_theme_index, int current_theme_index,
int selected_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); void ui_render_no_media(SDL_Renderer *renderer, const UiCache *cache, int window_width, int window_height);
int ui_load_fonts(UiFonts *fonts); int ui_load_fonts(UiFonts *fonts);
void ui_destroy_fonts(UiFonts *fonts); void ui_destroy_fonts(UiFonts *fonts);

BIN
src/ui.o

Binary file not shown.