feat(service-menu): pobla SISTEMA amb reinici, eixir i confirmacions

This commit is contained in:
2026-05-24 12:18:39 +02:00
parent 8c21345f14
commit 22827c28fa
8 changed files with 338 additions and 38 deletions
+16 -3
View File
@@ -62,6 +62,10 @@ namespace System {
struct Page {
std::string title_key;
// Subtitol opcional, renderitzat sota el titol amb tipografia mes
// petita i color apagat. Es una funcio perque pot ser dinamic
// (versio+hash, etc.). Si esta buit, no es renderitza.
std::function<std::string()> subtitle_provider;
std::vector<Item> items;
std::size_t cursor = 0;
};
@@ -88,10 +92,13 @@ namespace System {
ServiceMenu(Rendering::Renderer* renderer, SDLManager* sdl, DebugOverlay* debug_overlay);
void buildRootPage();
void pushSubmenuPlaceholder(const std::string& title_key);
[[nodiscard]] auto buildVideoPage() const -> Page;
[[nodiscard]] static auto buildAudioPage() -> Page;
[[nodiscard]] auto buildOptionsPage() const -> Page;
[[nodiscard]] auto buildSystemPage() -> Page;
// Pagina de confirmacio "ESTAS SEGUR? NO/SI". on_yes s'executa si
// l'usuari selecciona SI; el cursor per defecte apunta a NO.
void pushConfirmPage(const std::string& title_key, std::function<void()> on_yes);
void pushPage(Page page);
void popPage();
void moveCursor(int direction);
@@ -103,8 +110,13 @@ namespace System {
// Alçada objectiu de la caixa per a la pagina superior (sense animacio).
[[nodiscard]] auto computeTargetHeight() const -> float;
// Y (top) de l'item index dins una caixa col·locada a box_y.
[[nodiscard]] static auto computeItemTopY(float box_y, std::size_t index) -> float;
// Ample objectiu de la caixa per a la pagina superior (sense animacio).
// Pren com a base BOX_WIDTH_MIN i s'eixampla si algun text no hi cap.
[[nodiscard]] auto computeTargetWidth() const -> float;
// Y (top) de l'item index dins una caixa col·locada a box_y. Si la
// pagina te subtitol, els items es desplacen cap avall.
[[nodiscard]] static auto computeItemTopY(float box_y, std::size_t index, bool has_subtitle) -> float;
Rendering::Renderer* renderer_;
SDLManager* sdl_;
@@ -116,6 +128,7 @@ namespace System {
bool closing_ = false;
float open_anim_ = 0.0F; // 0..1 raw (sense easing)
float animated_h_ = 0.0F; // Alçada animada amb smoothing exponencial
float animated_w_ = 0.0F; // Ample animat (eixampla segons contingut)
// Estat del highlight (rectangle del cursor). Es lerpa cap a l'item
// actiu amb ease-out exponencial; quan el cursor "salta" (open o