59 lines
2.3 KiB
C++
59 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include <SDL3/SDL.h>
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace Overlay {
|
|
void init();
|
|
void destroy();
|
|
|
|
// Pinta l'overlay sobre el buffer ARGB — cridar abans de presentar
|
|
void render(Uint32* pixel_data);
|
|
|
|
// Posició + animació d'una notificació
|
|
enum class NotifPosition {
|
|
TOP_LEFT_SLIDE, // Cantó superior esquerra, slide horizontal des de fora
|
|
TOP_CENTER_DROP, // Centrat horitzontal, baixa des de sobre
|
|
};
|
|
|
|
// Estil de la notificació: caixa de fons, ombra o contorn del text
|
|
enum class NotifStyle {
|
|
BOX, // Rectangle de fons amb accent_color
|
|
SHADOW, // Sense fons, text amb ombra (offset +1,+1) en accent_color
|
|
OUTLINE, // Sense fons, text amb contorn 4-direccional en accent_color
|
|
};
|
|
|
|
// Mostra una notificació amb animació slide-in/stay/slide-out (API simple)
|
|
void showNotification(const char* text, float duration_seconds = 2.0F);
|
|
|
|
// Versió extensa: múltiples línies, posició, estil, colors i durada personalitzats.
|
|
// accent_color s'usa com a fons (si style=BOX) o com a ombra (si style=SHADOW).
|
|
void showNotification(const std::vector<std::string>& lines,
|
|
float duration_seconds,
|
|
NotifPosition pos,
|
|
NotifStyle style,
|
|
Uint32 accent_color,
|
|
Uint32 text_color);
|
|
|
|
// Activa/desactiva la info de renderitzat (FPS, driver, shader, preset)
|
|
void toggleRenderInfo();
|
|
void cycleRenderInfo(int dir); // dir=+1 avant, -1 endarrere
|
|
// Configura els segments del render info. Cada segment (nullptr o string buit
|
|
// per amagar) apareix/desapareix amb animació; el conjunt es centra dinàmicament.
|
|
// `mono_mask` és un bitfield: bit N = 1 → segment N amb amplada monoespaiada.
|
|
void setRenderInfoSegments(const char* s0, const char* s1, const char* s2, const char* s3, unsigned int mono_mask = 0);
|
|
|
|
// Crèdits seqüencials cinematogràfics (2 blocs fade-in/hold/fade-out)
|
|
void startCredits();
|
|
void cancelCredits();
|
|
auto creditsActive() -> bool;
|
|
|
|
// Gestió d'eixida amb doble ESC
|
|
// Retorna true si l'ESC ha sigut consumit (no s'ha de passar al joc)
|
|
auto handleEscape() -> bool;
|
|
// True mentre s'espera la segona pulsació d'ESC
|
|
auto isEscConsumed() -> bool;
|
|
} // namespace Overlay
|