freepassport-c/src/ui.h

69 lines
2 KiB
C

#ifndef UI_H
#define UI_H
#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
#include <time.h>
#include "channel.h"
#include "theme.h"
typedef struct UiFonts {
TTF_Font *small;
TTF_Font *medium;
TTF_Font *large;
} UiFonts;
typedef struct UiTextTexture {
SDL_Texture *texture;
int width;
int height;
} UiTextTexture;
typedef struct UiChannelCache {
UiTextTexture name_medium;
UiTextTexture number_medium;
UiTextTexture file_small;
UiTextTexture program_small_light;
UiTextTexture program_medium_dark;
UiTextTexture detail_small_dark;
} UiChannelCache;
typedef struct UiCache {
SDL_Renderer *renderer;
UiTextTexture no_media_title;
UiTextTexture no_media_body;
UiTextTexture no_media_hint;
UiTextTexture timeline_day;
UiTextTexture footer_a;
UiTextTexture footer_time;
UiTextTexture footer_b;
UiTextTexture footer_theme;
UiTextTexture footer_c;
UiTextTexture footer_title;
UiTextTexture preview_badge;
UiTextTexture *timeline_labels;
time_t timeline_label_slot;
UiChannelCache *channels;
int channel_count;
} UiCache;
void ui_render_fullscreen(SDL_Renderer *renderer, SDL_Texture *video_texture, int texture_width, int texture_height);
void ui_render_guide(SDL_Renderer *renderer,
SDL_Texture *video_texture,
int texture_width,
int texture_height,
const UiFonts *fonts,
UiCache *cache,
const ChannelList *channels,
int active_channel,
Uint64 app_start_ticks,
Uint64 now_ticks,
time_t now_wall);
void ui_render_no_media(SDL_Renderer *renderer, const UiCache *cache);
int ui_load_fonts(UiFonts *fonts);
void ui_destroy_fonts(UiFonts *fonts);
int ui_cache_init(UiCache *cache, SDL_Renderer *renderer, const UiFonts *fonts, const ChannelList *channels);
void ui_cache_destroy(UiCache *cache);
#endif