|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Bookshelf screen: a grid of book cards with cover thumbnails. More...
#include <string.h>#include "ra8_box.h"#include "ra8_gfx.h"#include "ra8_gfx_font.h"#include "sh_app.h"Go to the source code of this file.
Enumerations | |
| enum | sh_shelf_const_t : uint32_t { k_sh_box_cap = 32U , k_sh_sel_border = 4U , k_sh_card_bord = 2U , k_sh_title_gap = 6U , k_sh_two = 2U , k_sh_card_h = 272U } |
| Shelf-layout constants. More... | |
Functions | |
| void | sh_decode_cover (uint16_t idx, const book_src_t *src) |
Decode the open rabook source's 4bpp cover into thumbnail slot idx. | |
| void | sh_shelf_build_thumbs (void) |
| Copy the baked books' pre-decoded covers into sh_state_t::thumb at boot. | |
| static void | sh_draw_card (ra8_ui_rect_t r, uint16_t idx) |
| Draw one book card: cover thumbnail (or placeholder) + title + author. | |
| static uint16_t | sh_layout_cards (void) |
| Lay out the shelf grid into sh_state_t::card_rect; returns count placed. | |
| void | sh_shelf_render (void) |
| Render the shelf grid (cover cards) into the framebuffer. | |
| int32_t | sh_shelf_hit (int32_t x, int32_t y) |
| Hit-test a shelf tap; returns the book index or -1. | |
Bookshelf screen: a grid of book cards with cover thumbnails.
Lays out the unified baked+SD entry table as an ra8_box grid, drawing each book's cached cover thumbnail above its title and author. Baked thumbnails are pre-decoded gray8 arrays copied straight out of library.h at boot (sh_shelf_build_thumbs); SD covers decode lazily on first open through the demand-paged source, so the shelf paints without holding any book in RAM. The selected card is highlighted.
[Ring 6 / App] {World: NS}
Definition in file sh_shelf.c.
| enum sh_shelf_const_t : uint32_t |
Shelf-layout constants.
Definition at line 28 of file sh_shelf.c.
| void sh_decode_cover | ( | uint16_t | idx, |
| const book_src_t * | src ) |
Decode the open rabook source's 4bpp cover into thumbnail slot idx.
Definition at line 37 of file sh_shelf.c.
References book_header_t::cover_image_index, g_sh, book_src_t::hdr, k_book_nil, k_ra8_ok, k_sh_thumb_h, k_sh_thumb_w, and sh_image_decode_gray8().
Referenced by sh_book_decode_thumb().
|
static |
Draw one book card: cover thumbnail (or placeholder) + title + author.
Definition at line 81 of file sh_shelf.c.
References g_sh, ra8_ui_rect_t::h, k_sh_card_bord, k_sh_card_pad, k_sh_col_card, k_sh_col_card_hi, k_sh_col_edge, k_sh_col_ink, k_sh_col_sel, k_sh_col_sub, k_sh_glyph_h, k_sh_linebuf, k_sh_sel_border, k_sh_thumb_h, k_sh_thumb_w, k_sh_title_gap, k_sh_two, ra8_gfx_font_8x16, ra8_gfx_rect(), ra8_gfx_text_out(), sh_border(), sh_cells(), sh_fit(), sh_image_blit_gray8(), ra8_ui_rect_t::w, ra8_ui_rect_t::x, and ra8_ui_rect_t::y.
Referenced by sh_shelf_render().
|
static |
Lay out the shelf grid into sh_state_t::card_rect; returns count placed.
Definition at line 126 of file sh_shelf.c.
References g_sh, k_ra8_box_grid, k_ra8_box_leaf, k_ra8_box_none, k_ra8_ok, k_sh_bar_h, k_sh_box_cap, k_sh_card_h, k_sh_fb_h, k_sh_fb_w, k_sh_gap, k_sh_grid_cols, k_sh_pad, ra8_box_add(), ra8_box_layout(), ra8_box_tree_init(), and ra8_box_t::rect.
Referenced by sh_shelf_render().
| void sh_shelf_build_thumbs | ( | void | ) |
Copy the baked books' pre-decoded covers into sh_state_t::thumb at boot.
Definition at line 62 of file sh_shelf.c.
References sh_entry_t::from_sd, g_sh, memcpy(), sh_entry_t::thumb, sh_entry_t::thumb_h, and sh_entry_t::thumb_w.
Referenced by main().
| int32_t sh_shelf_hit | ( | int32_t | x, |
| int32_t | y ) |
Hit-test a shelf tap; returns the book index or -1.
Definition at line 170 of file sh_shelf.c.
References g_sh, ra8_ui_rect_t::h, ra8_ui_rect_t::w, ra8_ui_rect_t::x, and ra8_ui_rect_t::y.
Referenced by sh_handle_tap().
| void sh_shelf_render | ( | void | ) |
Render the shelf grid (cover cards) into the framebuffer.
Definition at line 160 of file sh_shelf.c.
References g_sh, k_sh_col_bg, ra8_gfx_clear(), sh_draw_card(), sh_layout_cards(), and sh_titlebar().
Referenced by sh_present().